Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

Only generate backtraces with RUST_BACKTRACE set (closes #7) #27

Merged
merged 1 commit into from
Aug 11, 2016
Merged

Only generate backtraces with RUST_BACKTRACE set (closes #7) #27

merged 1 commit into from
Aug 11, 2016

Conversation

birkenfeld
Copy link
Contributor

No description provided.

//! propagates it down the stack through `From` and `ChainErr`
//! conversions.
//! * If `RUST_BACKTRACE` is enabled, it collects a single backtrace at
//! the earliest opportunity andpropagates it down the stack through
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "and propagates"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@brson
Copy link
Contributor

brson commented Aug 9, 2016

@birkenfeld #[inline(always)] should fix the extra stack frame if you still want to do that.

@birkenfeld
Copy link
Contributor Author

I thought so as well, but in debug mode it does not:

   0:     0x55615e0787c0 - backtrace::backtrace::libunwind::trace
                        at /home/gbr/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.2.3/src/backtrace/libunwind.rs:54
                         - backtrace::backtrace::trace<closure>
                        at /home/gbr/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.2.3/src/backtrace/mod.rs:70
   1:     0x55615e07913a - backtrace::capture::{{impl}}::new
                        at /home/gbr/devel/ext/error-chain/target/debug/build/backtrace-3bc1ff360ebb00cb/out/capture.rs:79
   2:     0x55615e070642 - {{inlined-root}}::make_backtrace
                        at /home/gbr/devel/ext/error-chain/src/lib.rs:685
                         - tests::has_backtrace_depending_on_env::{{impl}}::from
                        at /home/gbr/devel/ext/error-chain/<error_chain macros>:42
   3:     0x55615e0702e8 - tests::has_backtrace_depending_on_env
                        at /home/gbr/devel/ext/error-chain/tests/tests.rs:155
   4:     0x55615e08c6c6 - _<F as alloc..boxed..FnBox<A>>::call_box::h6c46b1f51a5f97cd
   5:     0x55615e0819eb - std::panicking::try::call::h8d6a00e6c0ac8b9e
   6:     0x55615e0cb0c6 - __rust_maybe_catch_panic
   7:     0x55615e08bf6c - _<F as alloc..boxed..FnBox<A>>::call_box::h173484225f9723d2
   8:     0x55615e0c12f7 - std::sys::thread::Thread::new::thread_start::h8f3bd45211e9f5ea
   9:     0x7fc160624423 - <unknown>
  10:     0x7fc160154ecc - clone
  11:                0x0 - <unknown>

Note the {{inlined-root}}::make_backtrace in there. Without inline(always):


   0:     0x55a6b9ade3a0 - backtrace::backtrace::libunwind::trace
                        at /home/gbr/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.2.3/src/backtrace/libunwind.rs:54
                         - backtrace::backtrace::trace<closure>
                        at /home/gbr/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.2.3/src/backtrace/mod.rs:70
   1:     0x55a6b9aded1a - backtrace::capture::{{impl}}::new
                        at /home/gbr/devel/ext/error-chain/target/debug/build/backtrace-3bc1ff360ebb00cb/out/capture.rs:79
   2:     0x55a6b9ad8c12 - error_chain::make_backtrace
                        at /home/gbr/devel/ext/error-chain/src/lib.rs:685
   3:     0x55a6b9ad52bf - tests::has_backtrace_depending_on_env::{{impl}}::from
                        at /home/gbr/devel/ext/error-chain/<error_chain macros>:42
   4:     0x55a6b9ad5038 - tests::has_backtrace_depending_on_env
                        at /home/gbr/devel/ext/error-chain/tests/tests.rs:155
   5:     0x55a6b9af22a6 - _<F as alloc..boxed..FnBox<A>>::call_box::h6c46b1f51a5f97cd
   6:     0x55a6b9ae75cb - std::panicking::try::call::h8d6a00e6c0ac8b9e
   7:     0x55a6b9b30ca6 - __rust_maybe_catch_panic
   8:     0x55a6b9af1b4c - _<F as alloc..boxed..FnBox<A>>::call_box::h173484225f9723d2
   9:     0x55a6b9b26ed7 - std::sys::thread::Thread::new::thread_start::h8f3bd45211e9f5ea
  10:     0x7f8a425b6423 - <unknown>
  11:     0x7f8a420e6ecc - clone
  12:                0x0 - <unknown>

In light of that, I think it's better to read with the explicit frame in there.

@brson brson merged commit 8854a15 into rust-lang-deprecated:master Aug 11, 2016
@brson
Copy link
Contributor

brson commented Aug 11, 2016

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants