Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upIgnore more frames on backtrace unwinding. #40264
Conversation
rust-highfive
assigned
alexcrichton
Mar 4, 2017
This comment has been minimized.
This comment has been minimized.
|
(rust_highfive has picked a reviewer for you, use r? to override) |
Yamakaky
added some commits
Mar 4, 2017
This comment has been minimized.
This comment has been minimized.
This may be troublesome due to |
This comment has been minimized.
This comment has been minimized.
|
Yeah, I fixed that in the latest commit ;) First post updated. |
This comment has been minimized.
This comment has been minimized.
|
Some thoughts:
|
petrochenkov
reviewed
Mar 4, 2017
| let mut is_rmcp = false; | ||
| let _ = resolve_symname(*frame, |symname| { | ||
| if let Some(mangled_symbol_name) = symname { | ||
| if mangled_symbol_name == "__rust_maybe_catch_panic" { |
This comment has been minimized.
This comment has been minimized.
petrochenkov
Mar 4, 2017
Contributor
This needs to be mangled_symbol_name.contains("rust_maybe_catch_panic") (regardless of other concerns) because the symbol can be named panic_unwind::__rust_maybe_catch_panic or _rust_maybe_catch_panic (on Windows).
This comment has been minimized.
This comment has been minimized.
|
Yamakaky
added some commits
Mar 4, 2017
This comment has been minimized.
This comment has been minimized.
|
C-calling-rust works as expected, all the C frames are kept. |
This comment has been minimized.
This comment has been minimized.
|
@Yamakaky |
This comment has been minimized.
This comment has been minimized.
|
Hum, right. Is it possible to detect if the current crate is a .so or .a? Also, I'm not sure it's that bad. It's a very specific use case, and we can't clean the C backtrace so it would have the same bottom frames than |
alexcrichton
reviewed
Mar 6, 2017
|
I'm getting slightly worried about how aggressively we're trying to hide frames while yet having a desire for this to be general purpose. It looks like we're already dropping frames that are otherwise valid and this continues to be very light on tests.... |
| "_ZN4core6result13unwrap_failed", | ||
| "ZN4core6result13unwrap_failed", | ||
| "core::result::unwrap_failed", | ||
|
|
||
| "rust_begin_unwind", | ||
| "_ZN4drop", |
This comment has been minimized.
This comment has been minimized.
alexcrichton
Mar 6, 2017
Member
Er was this added in the previous PR? This definitely seems like something that we shouldn't be dropping, this is just a normal function?
| $LT$$LP$$RP$$GT$$GT$9call_once", | ||
| "ZN91_$LT$std..panic..AssertUnwindSafe$LT$F$GT$$u20$as$u20$core..ops..FnOnce\ | ||
| $LT$$LP$$RP$$GT$$GT$9call_once", | ||
| "<std::panic::AssertUnwindSafe<F> as core::ops::FnOnce<()>>::call_once", |
This comment has been minimized.
This comment has been minimized.
alexcrichton
Mar 6, 2017
Member
I don't think that these are correct to have because this is just the beginning of a catch_unwind, right?
This comment has been minimized.
This comment has been minimized.
|
|
||
| "_ZN42_$LT$F$u20$as$u20$test..FnBox$LT$T$GT$$GT$8call_box", | ||
| "ZN42_$LT$F$u20$as$u20$test..FnBox$LT$T$GT$$GT$8call_box", | ||
| "<F as test::FnBox<T>>::call_box", |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
The frames in
it will only remove A and not D. I can remove the special handling of |
This comment has been minimized.
This comment has been minimized.
|
I don't think that's the problem though, if the stack trace as B/C/D/E we'd remove everything but E? |
This comment has been minimized.
This comment has been minimized.
|
if |
This comment has been minimized.
This comment has been minimized.
|
Ok but the point still stands I think, can we be less aggressive about pruning frames? Many of these patterns are legitimate Rust functions not related to unwinding. |
alexcrichton
reviewed
Mar 9, 2017
| "__rust_maybe_catch_panic", | ||
| "_rust_maybe_catch_panic", | ||
| "__libc_start_main", | ||
|
|
||
| "__rust_try", |
This comment has been minimized.
This comment has been minimized.
alexcrichton
Mar 9, 2017
Member
I don't think that we want this to be the bottom of a frame, this is just one panic::catch_unwind and there could be many on the stack.
alexcrichton
reviewed
Mar 9, 2017
|
|
||
| "_ZN4core3ops6FnOnce9call_once", | ||
| "ZN4core3ops6FnOnce9call_once", | ||
| "core::ops::FnOnce::call_once", |
This comment has been minimized.
This comment has been minimized.
alexcrichton
Mar 9, 2017
Member
Like above, these could be any rust function, so we shouldn't prune these
This comment has been minimized.
This comment has been minimized.
Yamakaky
Mar 17, 2017
Author
Contributor
I fail to find an example where this frame would be at the beginning of the frame and you would not want to remove it. There will always be the main, or a function if it's a library.
This comment has been minimized.
This comment has been minimized.
|
Like for this backtrace (rustc without optimisations), what would you want to remove?
|
This comment has been minimized.
This comment has been minimized.
|
Ideally we'd only show frame 7 in that stack trace, but I think that we need to show 7-13 because we don't know if frames 8-13 are a nested catch panic or not. I think we can safely assume though that frames 0-6 are panicking machinery which can be ignored by default. Similarly 14-18 are safely system frames. |
This comment has been minimized.
This comment has been minimized.
|
Same question with explicit panic catch (the last example in my first post) https://gist.github.com/Yamakaky/b4c5168b8478311f66b02d47013f7cf1 |
This comment has been minimized.
This comment has been minimized.
|
Yes that should only strip frames 0-6 and 14-24 ideally as those weren't written by the user. I don't know of a heuristic which will actually do that though. |
This comment has been minimized.
This comment has been minimized.
|
That's exactly what the current code does ;) |
alexcrichton
added
the
T-libs
label
Mar 14, 2017
alexcrichton
reviewed
Mar 27, 2017
| "core::result::unwrap_failed", | ||
| "ZN4core6result13unwrap_failed", | ||
|
|
||
| "rust_begin_unwind", | ||
| "_ZN4drop", | ||
| "mingw_set_invalid_parameter_handler", |
This comment has been minimized.
This comment has been minimized.
alexcrichton
reviewed
Mar 27, 2017
| // Frames to remove from the top of the backtrace. | ||
| // | ||
| // The raw form is used so that we don't have to demangle the symbol names. | ||
| // The `a::b::c` form can show up on Windows/MSVC. | ||
| static BAD_PREFIXES_TOP: &'static [&'static str] = &[ |
This comment has been minimized.
This comment has been minimized.
alexcrichton
Mar 27, 2017
Member
Can we remove this array entirely? Currently rust_panic is the "canonical frame name" of the panic, and if there's a lower frame we should start from then we should just give that a canonical name instead.
This comment has been minimized.
This comment has been minimized.
Yamakaky
Mar 27, 2017
Author
Contributor
What to you think about removing the frames from the core::panicking::panic* functions?
This comment has been minimized.
This comment has been minimized.
alexcrichton
Mar 30, 2017
Member
I think it's fine to strive to eliminate them, but we shouldn't have such a long list of what to filter. There should be one frame that we look for and if we find it maybe do a few calculations based off that. Substring searching is basically guarantee to go wrong in the future.
Yamakaky
added some commits
Mar 27, 2017
This comment has been minimized.
This comment has been minimized.
|
@Yamakaky any update on removing the large lists of whitelists to canonical frames to prune? |
This comment has been minimized.
This comment has been minimized.
|
No, sorry. I'm near the end of the school semester so I have a lot of things to do. |
This comment has been minimized.
This comment has been minimized.
|
No worries! Thanks for the update. |
Mark-Simulacrum
added
the
S-waiting-on-author
label
Apr 14, 2017
This comment has been minimized.
This comment has been minimized.
|
Ping @Yamakaky - are you still working on this PR? |
arielb1
closed this
Apr 18, 2017
arielb1
reopened this
Apr 18, 2017
This comment has been minimized.
This comment has been minimized.
|
Not now, I still have a week before the end of the semester. You can work on it if you want! |
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this pull request
Apr 18, 2017
alexcrichton
referenced this pull request
Apr 18, 2017
Merged
std: Back out backtrace pruning logic #41364
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this pull request
Apr 18, 2017
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this pull request
Apr 18, 2017
This comment has been minimized.
This comment has been minimized.
|
|
CryZe
referenced this pull request
Apr 27, 2017
Closed
Rust never lets you know about RUST_BACKTRACE=full #41584
This comment has been minimized.
This comment has been minimized.
|
Ok I'm going to close this for now, but please feel free to resubmit @Yamakaky if you find the time! |
alexcrichton
closed this
Apr 27, 2017
This comment has been minimized.
This comment has been minimized.
|
Is it OK if I open a PR with only the bottom cleaning, and leave the top for a later PR? |
This comment has been minimized.
This comment has been minimized.
|
Certainly! |
Yamakaky
deleted the
Yamakaky:improve-backtrace
branch
May 7, 2017
Yamakaky
referenced this pull request
May 7, 2017
Merged
Improve cleaning of the bottom of the backtrace #41815
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this pull request
May 10, 2017
frewsxcv
added a commit
to frewsxcv/rust
that referenced
this pull request
May 10, 2017
bors
added a commit
that referenced
this pull request
May 10, 2017
This comment has been minimized.
This comment has been minimized.
|
@Yamakaky Do you think you can take another look on this PR? It would be really great to say goodbye to all the junk in the backtraces. |
Yamakaky commentedMar 4, 2017
•
edited
Correctly handles panics in threads and tests. First, the frames after the last
__rust_maybe_catch_panicare discarded, then it uses a blacklist that does some more fine-tuning. Since frames after the call to__rust_maybe_catch_panicseem to be platform-independant,BAD_PREFIXES_BOTTOMcould probably be cleaned a bit.Any idea about use-cases I would have forgotten?