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

Backtrace line numbers #308

Open
lynaghk opened this Issue May 8, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@lynaghk

lynaghk commented May 8, 2018

First, let me say thanks for Neon --- it's a great project and it allowed me to really dive in and make my first Rust project, Finda.

I'm trying to compile my project so that I have a release build that logs line numbers and backtraces on panic.
I can do this fine with a standard Rust binary, but I can't figure it out with Neon.

Here's a minimal reproducible example repository.
I've included the build details below.

Thanks!


On OS X 10.9.5, Rust can compile a release binary that includes line numbers in the backtrace:

cd native/a_panic
cargo run --release

Output:

2018-05-08 15:22:34 ERROR [log_panics] thread 'main' panicked at 'oh no!': src/lib.rs:7
stack backtrace:
   0:        0x1000fba9e - backtrace::backtrace::trace::h6954c675fdb81650
                        at /Users/dev/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.7/src/backtrace/libunwind.rs:53
   1:        0x1000fa01c - backtrace::capture::Backtrace::new::h44f202edd8c21d9b
                        at /Users/dev/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.7/src/capture.rs:88
...

However, the same code compiled with Neon has no line numbers in the backtrace:

yarn install
node -e 'require("./")'

Output:

2018-05-08 15:27:42 ERROR [log_panics] thread 'unnamed' panicked at 'oh no!': a_panic/src/lib.rs:7
stack backtrace:
   0:        0x106de4e6e - backtrace::backtrace::trace::ha74a84b436b4090e
   1:        0x106de299c - backtrace::capture::Backtrace::new::h180d14cb08d60248
   2:        0x106de1eed - log_panics::init::_$u7b$$u7b$closure$u7d$$u7d$::h990ff31ff59f1e7d
   3:        0x106e12870 - std::panicking::rust_panic_with_hook::hfb431ab23831437f
   4:        0x106dd8821 - std::panicking::begin_panic::h6ef215fe9e0c41fe
   5:        0x106dd878d - a_panic::panic_please::h8d3d02c8208552ed
   6:        0x106dc9cb5 - backtrace_test::hello::hb394c4370bb7ceec
   7:        0x106dc9e5b - std::panicking::try::do_call::h5c5f1cbb0951adfa (.llvm.5600580859378085660)
   8:        0x106e2d38e - __rust_maybe_catch_panic
...

The output is the same, even when using the --debug flag:

yarn run -- neon build --debug
node -e 'require("./")'

or when adding

[profile.release]
debug = true

to Cargo.toml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment