Add a feature gate to control whether hide self from trace

This commit is contained in:
Gary Guo 2021-08-26 05:40:08 +01:00
parent a942d60e1a
commit 68baa798fb
2 changed files with 3 additions and 2 deletions

View File

@ -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

View File

@ -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));