-
Notifications
You must be signed in to change notification settings - Fork 390
Open
Labels
A-diagnosticserrors and warnings emitted by mirierrors and warnings emitted by miriC-enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancementE-good-first-issueA good way to start contributing, mentoring is availableA good way to start contributing, mentoring is available
Description
When an action is performed that miri cannot handle (or UB is hit), the backtrace shown ends at the start of the thread in which the failure happened. As an example
extern {
fn unknown();
}
fn bad() { unsafe { unknown() } }
fn main() {
std::thread::spawn(bad);
}
fails with
error: unsupported operation: can't call foreign function `unknown` on OS `linux`
--> src/main.rs:5:21
|
5 | fn bad() { unsafe { unknown() } }
| ^^^^^^^^^ can't call foreign function `unknown` on OS `linux`
|
= help: if this is a basic API commonly used on this target, please report an issue with Miri
= help: however, note that Miri does not aim to support every FFI function out there; for instance, we will not support APIs for things such as GUIs, scripting languages, or databases
= note: BACKTRACE on thread `unnamed-1`:
= note: inside `bad` at src/main.rs:5:21: 5:30
pointing solely to the function bad
.
In this simple example that is not an issue, but if a crate spawns a thread somewhere in its internals, it may not be clear why the thread is even running. I don't think it would be expensive to collect a backtrace at every thread spawn and store this information in the thread data structure itself (as we're not going through the backtrace crate, but just iterating over miri's stack).
Metadata
Metadata
Assignees
Labels
A-diagnosticserrors and warnings emitted by mirierrors and warnings emitted by miriC-enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancementE-good-first-issueA good way to start contributing, mentoring is availableA good way to start contributing, mentoring is available