diff options
| author | FenrirWolf <[email protected]> | 2018-08-19 18:01:18 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-08-19 18:01:18 -0600 |
| commit | 15cb3c1e91842a68a8e50e1e1a42aefab13cc25e (patch) | |
| tree | a514fde042ff2a504a03305bfe0894ff8cd8d47e /ctr-std/src/sys/cloudabi/backtrace.rs | |
| parent | Update for latest nightly 2018-06-09 (#70) (diff) | |
| parent | Update for nightly-2018-08-18 (diff) | |
| download | ctru-rs-15cb3c1e91842a68a8e50e1e1a42aefab13cc25e.tar.xz ctru-rs-15cb3c1e91842a68a8e50e1e1a42aefab13cc25e.zip | |
Merge pull request #73 from FenrirWolf/update-2018-08-18
Update for nightly-2018-08-18
Diffstat (limited to 'ctr-std/src/sys/cloudabi/backtrace.rs')
| -rw-r--r-- | ctr-std/src/sys/cloudabi/backtrace.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/ctr-std/src/sys/cloudabi/backtrace.rs b/ctr-std/src/sys/cloudabi/backtrace.rs index 1b97018..2c43b59 100644 --- a/ctr-std/src/sys/cloudabi/backtrace.rs +++ b/ctr-std/src/sys/cloudabi/backtrace.rs @@ -64,6 +64,10 @@ extern "C" fn trace_fn( arg: *mut libc::c_void, ) -> uw::_Unwind_Reason_Code { let cx = unsafe { &mut *(arg as *mut Context) }; + if cx.idx >= cx.frames.len() { + return uw::_URC_NORMAL_STOP; + } + let mut ip_before_insn = 0; let mut ip = unsafe { uw::_Unwind_GetIPInfo(ctx, &mut ip_before_insn) as *mut libc::c_void }; if !ip.is_null() && ip_before_insn == 0 { @@ -73,14 +77,12 @@ extern "C" fn trace_fn( } let symaddr = unsafe { uw::_Unwind_FindEnclosingFunction(ip) }; - if cx.idx < cx.frames.len() { - cx.frames[cx.idx] = Frame { - symbol_addr: symaddr as *mut u8, - exact_position: ip as *mut u8, - inline_context: 0, - }; - cx.idx += 1; - } + cx.frames[cx.idx] = Frame { + symbol_addr: symaddr as *mut u8, + exact_position: ip as *mut u8, + inline_context: 0, + }; + cx.idx += 1; uw::_URC_NO_REASON } |