Closed
Description
RUST_BACKTRACE=1
segfaults on locally compiled programs when they panic. Externally built binaries such as those installed through rustup work as expected, yielding the ICE backtrace in #44858 .
I use Exherbo Linux. I can use -C panic=abort
to get traces from gdb
, but that forbids anything graceful.
fn main() {
panic!("test")
}
thread 'main' panicked at 'test', segfault.rs:2:4
Segmentation fault (core dumped)
GNU gdb (GDB) 8.0
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from segfault...done.
(gdb) run
Starting program: /segfault
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/x86_64-pc-linux-gnu/lib/libthread_db.so.1".
thread 'main' panicked at 'test', segfault.rs:2:4
Program received signal SIGSEGV, Segmentation fault.
0x00007f4abc952e96 in strlen () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
(gdb) bt
#0 0x00007f4abc952e96 in strlen () from /usr/x86_64-pc-linux-gnu/lib/libc.so.6
#1 0x0000000100009378 in std::ffi::c_str::CStr::from_ptr () at /checkout/src/libstd/ffi/c_str.rs:749
#2 std::sys_common::gnu::libbacktrace::resolve_symname<closure> () at /checkout/src/libstd/sys_common/gnu/libbacktrace.rs:89
#3 std::sys::imp::backtrace::printing::resolve_symname<closure> () at /checkout/src/libstd/sys/unix/backtrace/printing/mod.rs:36
#4 std::sys_common::backtrace::filter_frames::{{closure}} () at /checkout/src/libstd/sys_common/backtrace.rs:110
#5 core::slice::{{impl}}::position::{{closure}}<std::sys_common::backtrace::Frame,closure> () at /checkout/src/libcore/slice/mod.rs:1201
#6 0x000000010000c9e1 in core::slice::Iter<std::sys_common::backtrace::Frame>::search_while<std::sys_common::backtrace::Frame,core::option::Option<usize>,closure> () at /checkout/src/libcore/slice/mod.rs:1268
#7 core::slice::{{impl}}::position<std::sys_common::backtrace::Frame,closure> () at /checkout/src/libcore/slice/mod.rs:1200
#8 std::sys_common::backtrace::filter_frames () at /checkout/src/libstd/sys_common/backtrace.rs:108
#9 std::sys_common::backtrace::_print () at /checkout/src/libstd/sys_common/backtrace.rs:73
#10 0x00000001000114e4 in std::sys_common::backtrace::print () at /checkout/src/libstd/sys_common/backtrace.rs:60
#11 std::panicking::default_hook::{{closure}} () at /checkout/src/libstd/panicking.rs:381
#12 0x0000000100011253 in std::panicking::default_hook () at /checkout/src/libstd/panicking.rs:397
#13 0x00000001000118e8 in std::panicking::rust_panic_with_hook () at /checkout/src/libstd/panicking.rs:577
#14 0x0000000100007082 in std::panicking::begin_panic ()
#15 0x000000010000761b in segfault::main ()
#16 0x0000000100042fdd in panic_unwind::__rust_maybe_catch_panic () at /checkout/src/libpanic_unwind/lib.rs:99
#17 0x0000000100011eac in std::panicking::try<(),closure> () at /checkout/src/libstd/panicking.rs:459
#18 std::panic::catch_unwind<closure,()> () at /checkout/src/libstd/panic.rs:361
#19 std::rt::lang_start () at /checkout/src/libstd/rt.rs:59
#20 0x000000010000764a in main ()
(gdb) q
A debugging session is active.
Inferior 1 [process 3744] will be killed.
Quit anyway? (y or n) y
rustc 1.22.0-nightly (26015da01 2017-09-23)
Linux 4.12.7 x86_64 GNU/Linux