Closed
Description
% 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.
Metadata
Metadata
Assignees
Labels
Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsCategory: An issue proposing an enhancement or a PR with one.Relevant to the compiler team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Activity
Zoxc commentedon Jan 14, 2018
#45637 contains a fix for this
jonhoo commentedon Jan 30, 2018
Now being worked on in #47824 instead afaict?
Zoxc commentedon Jan 30, 2018
@jonhoo It is.
reuvenpo commentedon 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:
and after setting that, also claim that:
even though no details were omitted at all (which is the issue of course)
brson commentedon 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..
__rust_begin_short_backtrace
frames from being tail-call optimised away #750489 remaining items