Skip to content
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

Short backtrace have regressed #47429

Closed
SimonSapin opened this issue Jan 14, 2018 · 7 comments · Fixed by #75048
Closed

Short backtrace have regressed #47429

SimonSapin opened this issue Jan 14, 2018 · 7 comments · Fixed by #75048
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@SimonSapin
Copy link
Contributor

% rustc +nightly -V
rustc 1.25.0-nightly (51b0b3734 2018-01-12)
% echo 'fn main() { panic!() }' > a.rs
% rustc +nightly -g a.rs
% RUST_BACKTRACE=1 ./a   
thread 'main' panicked at 'explicit panic', a.rs:1:13
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:68
             at libstd/sys_common/backtrace.rs:57
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:380
   3: std::panicking::default_hook
             at libstd/panicking.rs:396
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:576
   5: std::panicking::begin_panic
             at /checkout/src/libstd/panicking.rs:537
   6: a::main
             at ./a.rs:1
   7: std::rt::lang_start::{{closure}}
             at /checkout/src/libstd/rt.rs:74
   8: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:479
   9: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:102
  10: std::rt::lang_start_internal
             at libstd/panicking.rs:458
             at libstd/panic.rs:365
             at libstd/rt.rs:58
  11: std::rt::lang_start
             at /checkout/src/libstd/rt.rs:74
  12: main
  13: __libc_start_main
  14: _start
% RUST_BACKTRACE=full ./a
thread 'main' panicked at 'explicit panic', a.rs:1:13
stack backtrace:
   0:     0x557717de85fb - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h5875a9b214742a4d
                               at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x557717deb9f1 - std::sys_common::backtrace::print::h143d03afdd7f5f00
                               at libstd/sys_common/backtrace.rs:68
                               at libstd/sys_common/backtrace.rs:57
   2:     0x557717de6620 - std::panicking::default_hook::{{closure}}::h8ff827baa6fe8dc7
                               at libstd/panicking.rs:380
   3:     0x557717de6158 - std::panicking::default_hook::h23592ba8d5e03a89
                               at libstd/panicking.rs:396
   4:     0x557717de69ab - std::panicking::rust_panic_with_hook::ha49ba53377acd9fa
                               at libstd/panicking.rs:576
   5:     0x557717de4677 - std::panicking::begin_panic::hb09c91adc2d20ae1
                               at /checkout/src/libstd/panicking.rs:537
   6:     0x557717de45cd - a::main::hed51cb165992ecb8
                               at /tmp/a.rs:1
   7:     0x557717de41a1 - std::rt::lang_start::{{closure}}::h996750b753d22e78
                               at /checkout/src/libstd/rt.rs:74
   8:     0x557717de66c7 - std::panicking::try::do_call::he88b5e1c2ad945b3
                               at libstd/rt.rs:59
                               at libstd/panicking.rs:479
   9:     0x557717df80be - __rust_maybe_catch_panic
                               at libpanic_unwind/lib.rs:102
  10:     0x557717de83cf - std::rt::lang_start_internal::h4b0a952236374327
                               at libstd/panicking.rs:458
                               at libstd/panic.rs:365
                               at libstd/rt.rs:58
  11:     0x557717de4181 - std::rt::lang_start::h9e17a65d1bce7359
                               at /checkout/src/libstd/rt.rs:74
  12:     0x557717de45fd - main
  13:     0x7ff5d955bf49 - __libc_start_main
  14:     0x557717de3f39 - _start
  15:                0x0 - <unknown>

1 v.s. full is less verbose, but I remember it also filtering out some stack frames in some previous compiler versions. (Only frame # 6 is really useful to me here.) Indeed, src/libstd/sys_common/backtrace.rs contains some code that looks for a __rust_begin_short_backtrace symbol on the stack to find out what to filter. It looks like some functionality has regressed.

Stepping through the program in gdb it looks like the __rust_begin_short_backtrace function is called, but despite #[inline(never)] there’s apparently no stack frame (anymore?) for it.

CC @Yamakaky and @alexcrichton for #41815, #38165, and #40264.

@Zoxc
Copy link
Contributor

Zoxc commented Jan 14, 2018

#45637 contains a fix for this

@jonhoo
Copy link
Contributor

jonhoo commented Jan 30, 2018

Now being worked on in #47824 instead afaict?

@Zoxc
Copy link
Contributor

Zoxc commented Jan 30, 2018

@jonhoo It is.

@pietroalbini pietroalbini added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 6, 2018
@reuvenpo
Copy link

reuvenpo commented Nov 11, 2019

This issue hasn't been active in almost two years, and so have the issues linked here. Is there any intention of resuming work on this? It's mostly a small papercut because currently when crashing, programs suggest:

run with RUST_BACKTRACE=1 environment variable to display a backtrace.

and after setting that, also claim that:

Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.

even though no details were omitted at all (which is the issue of course)

@brson
Copy link
Contributor

brson commented Nov 27, 2019

A simple fix would be to just look for "std::rt::lang_start::{{closure}}" instead until the real solution to the disappearing function is found..

@jonas-schievink jonas-schievink added A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jun 13, 2020
@bors bors closed this as completed in f3a9de9 Aug 8, 2020
@simonbuchan
Copy link
Contributor

This single fix is likely to have the biggest positive effect on my use of Rust since async/await. Thank you so much!

@reuvenpo
Copy link

reuvenpo commented Aug 8, 2020

Awesome! I'm happy to see this finally fixed :D
Thanks to everyone who had a part in this fix :)

athre0z added a commit to athre0z/color-backtrace that referenced this issue Aug 14, 2020
This frame was added for the exact purpose of allowing proper filtering:

rust-lang/rust#47429
yaahc added a commit to eyre-rs/color-eyre that referenced this issue Aug 14, 2020
This frame was added for the exact purpose of allowing proper filtering:

rust-lang/rust#47429
yaahc added a commit to eyre-rs/color-eyre that referenced this issue Aug 17, 2020
This frame was added for the exact purpose of allowing proper filtering:

rust-lang/rust#47429
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants