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

backtraces have blank lines and <unknown> instead of function names on FreeBSD #54434

Closed
umanwizard opened this issue Sep 21, 2018 · 5 comments · Fixed by rust-lang/backtrace-rs#294 or #70361
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) O-freebsd Operating system: FreeBSD

Comments

@umanwizard
Copy link
Contributor

Note that I am using rustup, not the FreeBSD lang/rust port.

$ cat test.rs
fn main() {
    panic!();
}
$ rustc test.rs && RUST_BACKTRACE=1 ./test                                                                                        
thread 'main' panicked at 'explicit panic', test.rs:2:5
stack backtrace:
   0: <std::thread::local::AccessError as core::fmt::Debug>::fmt
   1: <std::ffi::c_str::NulError as core::fmt::Debug>::fmt
   2: <std::ffi::c_str::NulError as core::fmt::Debug>::fmt
   3: <std::ffi::c_str::NulError as core::fmt::Debug>::fmt
   4: <std::ffi::c_str::NulError as core::fmt::Debug>::fmt
   5: 
   6: 
   7: 
   8: <std::ffi::c_str::NulError as core::fmt::Debug>::fmt
   9: <std::ffi::c_str::NulError as core::fmt::Debug>::fmt
  10: 
  11: 
  12: 
  13: 
  14: <unknown>
$ rustc --version --verbose
rustc 1.29.0 (aa3ca1994 2018-09-11)
binary: rustc
commit-hash: aa3ca1994904f2e056679fce1f185db8c7ed2703
commit-date: 2018-09-11
host: x86_64-unknown-freebsd
release: 1.29.0
LLVM version: 7.0
$ freebsd-version
11.2-RELEASE-p3
@umanwizard
Copy link
Contributor Author

umanwizard commented Sep 21, 2018

Output for the same code on macOS -- notice that test::main appears on frame 6, as expected.

~ ❯❯❯ RUST_BACKTRACE=1 ./test                                            ✘ 101 
thread 'main' panicked at 'explicit panic', test.rs:2:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::begin_panic
   6: test::main
   7: std::rt::lang_start::{{closure}}
   8: std::panicking::try::do_call
   9: __rust_maybe_catch_panic
  10: std::rt::lang_start_internal
  11: std::rt::lang_start
  12: main

@umanwizard umanwizard changed the title backtraces have <unknown> instead of function names on FreeBSD backtraces have blank lines and <unknown> instead of function names on FreeBSD Sep 21, 2018
@estebank
Copy link
Contributor

estebank commented Sep 21, 2018

There's a downstream patch for this https://reviews.freebsd.org/D11574 (found through https://svnweb.freebsd.org/ports/head/lang/rust/files/)

Upstreamed path to gcc: https://gcc.gnu.org/ml/gcc-patches/2018-03/msg00068.html (don't know how to tell if it's been merged)

@estebank estebank added A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) O-freebsd Operating system: FreeBSD labels Sep 21, 2018
@tromey
Copy link
Contributor

tromey commented Sep 24, 2018

Upstreamed path to gcc: https://gcc.gnu.org/ml/gcc-patches/2018-03/msg00068.html (don't know how to tell if it's been merged)

I looked at gcc git and that patch is not there. It also isn't in https://github.com/ianlancetaylor/libbacktrace (I'm not sure anymore if one repository is canonical or if merges are done both ways).

@umanwizard
Copy link
Contributor Author

By the way, mounting /proc fixes this. But mounting /proc is considered a Linuxism so it would be best if this weren't necessary on FreeBSD.

@tromey
Copy link
Contributor

tromey commented Sep 26, 2018

I'd suggest sending the patch as a PR to the aforementioned libbacktrace repository, then once it lands, also update the libbacktrace in rust-lang-nursery.

alexcrichton pushed a commit to rust-lang/backtrace-rs that referenced this issue Mar 24, 2020
* Define HAVE_KERN_PROC on FreeBSD to fix rust-lang/rust#54434

For the same reason define HAVE_KERN_PROC_ARGS on NetBSD.

This depends on having [1] available in libbacktrace.

[1] ianlancetaylor/libbacktrace@0f06cda

* Add dragonfly too
Centril added a commit to Centril/rust that referenced this issue Mar 25, 2020
Update backtrace crate to 0.3.46

* Support line-tables-only when using libbacktrace
* Update libbacktrace to latest master
* Define HAVE_KERN_PROC on FreeBSD to fix rust-lang#54434
Centril added a commit to Centril/rust that referenced this issue Mar 25, 2020
Update backtrace crate to 0.3.46

* Support line-tables-only when using libbacktrace
* Update libbacktrace to latest master
* Define HAVE_KERN_PROC on FreeBSD to fix rust-lang#54434
Centril added a commit to Centril/rust that referenced this issue Mar 25, 2020
Update backtrace crate to 0.3.46

* Support line-tables-only when using libbacktrace
* Update libbacktrace to latest master
* Define HAVE_KERN_PROC on FreeBSD to fix rust-lang#54434
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) O-freebsd Operating system: FreeBSD
Projects
None yet
3 participants