-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable backtrace
feature in the generated Xargo.toml
#1589
Conversation
README.md
Outdated
`RUST_BACKTRACE=1 cargo miri test` will not do what you expect. | ||
|
||
To get a backtrace, you need to disable isolation | ||
[using `-Zmiri-disable-isolation`](#miri-flags) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could there be a flag to pretend that RUST_BACKTRACE=1
is set even when isolation is enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could - do you think that wanting to opt-out of isolation only for RUST_BACKTRACE
is a common usecase?
I think it might be better to add more fine-grained isolation in a separate PR. We could add -Zmiri-env-include=VAR
, which would pass through VAR
to the emulated program while leaving the isolation mode unaffected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both of these seem like potentially reasonable next steps, but the PR is useful even without them.
8: std::rt::lang_start_internal | ||
RUSTLIB/std/src/rt.rs:51:25 | ||
9: std::rt::lang_start | ||
RUSTLIB/std/src/rt.rs:65:5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this stacktrace ever changes we'll have to adjust quite a few tests... I can see why you asked for a --bless
^^
f490787
to
e73ac8e
Compare
@RalfJung: I've added an example |
This allows the normal std panic hook to print a backtrace if `RUST_BACKTRACE=1` and `-Z miri-disable-isolation` are set
e73ac8e
to
05bb560
Compare
Thanks! I am surprised that this even works for cross-interpretation; it used to be that @bors r+ |
📌 Commit 05bb560 has been approved by |
☀️ Test successful - checks-actions |
The debuginfo handling has been replaced by addr2line on non-Windows systems by default for a while now. (rust-lang/backtrace-rs#324) One of the reasons for this switch was:
|
It seems to work even for Windows though. :) |
On Windows a system library is used. Because miri doesn't perform any linking, it is fine if that system library turns out to be missing. For unix backtrace-rs used to use libbacktrace, which gets compiled in |
This allows the normal std panic hook to print a backtrace if
RUST_BACKTRACE=1
and-Z miri-disable-isolation
are set