Browse Source

Add a feature gate to control whether hide self from trace

Gary Guo 3 years ago
parent
commit
68baa798fb
2 changed files with 3 additions and 2 deletions
  1. 2 1
      Cargo.toml
  2. 1 1
      src/abi.rs

+ 2 - 1
Cargo.toml

@@ -17,8 +17,9 @@ alloc = []
 fde-phdr = ["libc"]
 fde-registry = ["alloc"]
 dwarf-expr = []
+hide-trace = []
 system-alloc = []
-default = ["dwarf-expr", "fde-phdr", "fde-registry"]
+default = ["dwarf-expr", "hide-trace", "fde-phdr", "fde-registry"]
 
 [profile.dev]
 # Must be turned on due to Rust bug https://github.com/rust-lang/rust/issues/50007

+ 1 - 1
src/abi.rs

@@ -402,7 +402,7 @@ pub unsafe extern "C-unwind" fn _Unwind_Backtrace(
     trace_argument: *mut c_void,
 ) -> UnwindReasonCode {
     let mut ctx = save_context();
-    let mut skipping = true;
+    let mut skipping = cfg!(feature = "hide-trace");
 
     loop {
         let frame = try1!(Frame::from_context(&ctx));