Skip to content

Support breakpoint intrinsic#1733

Merged
bors merged 2 commits intorust-lang:masterfrom
syvb:breakpoint-intrinsic
Mar 5, 2021
Merged

Support breakpoint intrinsic#1733
bors merged 2 commits intorust-lang:masterfrom
syvb:breakpoint-intrinsic

Conversation

@syvb
Copy link
Contributor

@syvb syvb commented Mar 4, 2021

The breakpoint intrinsic raises a SIGTRAP signal. If a debugger is attached to a normal program, then SIGTRAP can be used to trigger breakpoints in debuggers like gdb. If there is no debugger, then the program exits with a message like Trace/breakpoint trap (core dumped). This adds support for the intrinsic in Miri. While actually passing through the SIGTRAP doesn't make sense in a Miri context (if it just raised the signal normally then it would allow for debugging Miri itself, not the program being evaluated). As such, it just raises an error.

@bjorn3
Copy link
Member

bjorn3 commented Mar 4, 2021

Can you expose some way for priroda to intercept the breakpoint and later continue execution?

@RalfJung
Copy link
Member

RalfJung commented Mar 4, 2021

@bjorn3 can't Priroda just intercept intrinsic calls and handle brekapoint before falling back to Miri's intrinsic handling?

@bjorn3
Copy link
Member

bjorn3 commented Mar 4, 2021

@bjorn3 can't Priroda just intercept intrinsic calls and handle brekapoint before falling back to Miri's intrinsic handling?

The Frame's current_loc is read-only. This means that I think the only way to intercept the intrinsic call would be to duplicate miri's EvalContext.

@RalfJung
Copy link
Member

RalfJung commented Mar 4, 2021

The Frame's current_loc is read-only. This means that I think the only way to intercept the intrinsic call would be to duplicate miri's EvalContext.

I don't see what the first sentence has to do with the second. And I expected Priroda anyway has its own EvalContext implementation that just calls the Miri methods as fallbacks? No code would have to be duplicated, just the signatures, right?

@RalfJung
Copy link
Member

RalfJung commented Mar 4, 2021

What other method do you suggest for Priroda to hook breakpoints? Does that have to block the PR? It's not like the PR makes things any worse here for Priroda, right? It seems unfair to expect @Smittyvb, a first time-contributor, to develop such a system.

@bjorn3
Copy link
Member

bjorn3 commented Mar 4, 2021

And I expected Priroda anyway has its own EvalContext implementation that just calls the Miri methods as fallbacks?

Priroda directly uses miri's EvalContext at the moment.

No code would have to be duplicated, just the signatures, right?

I guess so. I will open an issue on priroda for implementing this.

@RalfJung
Copy link
Member

RalfJung commented Mar 4, 2021

I guess so. I will open an issue on priroda for implementing this.

Okay, so I assume we can land this PR then. :)

@Smittyvb aside from the open comment about the error message, this is ready to land. Thanks a lot for this PR. :)

@syvb syvb force-pushed the breakpoint-intrinsic branch from 79bfdac to 26e97ec Compare March 4, 2021 18:18
Co-authored-by: Ralf Jung <post@ralfj.de>
@RalfJung
Copy link
Member

RalfJung commented Mar 5, 2021

Awesome, and thanks @Smittyvb for you first PR here. :)
@bors r+

@RalfJung
Copy link
Member

RalfJung commented Mar 5, 2021

Hello, bors, are you listening?
@bors r+

@bors
Copy link
Contributor

bors commented Mar 5, 2021

📌 Commit 8d43d72 has been approved by RalfJung

@bors
Copy link
Contributor

bors commented Mar 5, 2021

⌛ Testing commit 8d43d72 with merge 0a0e366...

@bors
Copy link
Contributor

bors commented Mar 5, 2021

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing 0a0e366 to master...

@bors bors merged commit 0a0e366 into rust-lang:master Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants