File tree 3 files changed +30
-24
lines changed
3 files changed +30
-24
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,10 @@ extern "C" fn trace_fn(
64
64
arg : * mut libc:: c_void ,
65
65
) -> uw:: _Unwind_Reason_Code {
66
66
let cx = unsafe { & mut * ( arg as * mut Context ) } ;
67
+ if cx. idx >= cx. frames . len ( ) {
68
+ return uw:: _URC_NORMAL_STOP;
69
+ }
70
+
67
71
let mut ip_before_insn = 0 ;
68
72
let mut ip = unsafe { uw:: _Unwind_GetIPInfo ( ctx, & mut ip_before_insn) as * mut libc:: c_void } ;
69
73
if !ip. is_null ( ) && ip_before_insn == 0 {
@@ -73,14 +77,12 @@ extern "C" fn trace_fn(
73
77
}
74
78
75
79
let symaddr = unsafe { uw:: _Unwind_FindEnclosingFunction ( ip) } ;
76
- if cx. idx < cx. frames . len ( ) {
77
- cx. frames [ cx. idx ] = Frame {
78
- symbol_addr : symaddr as * mut u8 ,
79
- exact_position : ip as * mut u8 ,
80
- inline_context : 0 ,
81
- } ;
82
- cx. idx += 1 ;
83
- }
80
+ cx. frames [ cx. idx ] = Frame {
81
+ symbol_addr : symaddr as * mut u8 ,
82
+ exact_position : ip as * mut u8 ,
83
+ inline_context : 0 ,
84
+ } ;
85
+ cx. idx += 1 ;
84
86
85
87
uw:: _URC_NO_REASON
86
88
}
Original file line number Diff line number Diff line change @@ -68,6 +68,10 @@ pub fn unwind_backtrace(frames: &mut [Frame])
68
68
extern fn trace_fn ( ctx : * mut uw:: _Unwind_Context ,
69
69
arg : * mut libc:: c_void ) -> uw:: _Unwind_Reason_Code {
70
70
let cx = unsafe { & mut * ( arg as * mut Context ) } ;
71
+ if cx. idx >= cx. frames . len ( ) {
72
+ return uw:: _URC_NORMAL_STOP;
73
+ }
74
+
71
75
let mut ip_before_insn = 0 ;
72
76
let mut ip = unsafe {
73
77
uw:: _Unwind_GetIPInfo ( ctx, & mut ip_before_insn) as * mut libc:: c_void
@@ -94,14 +98,12 @@ extern fn trace_fn(ctx: *mut uw::_Unwind_Context,
94
98
unsafe { uw:: _Unwind_FindEnclosingFunction ( ip) }
95
99
} ;
96
100
97
- if cx. idx < cx. frames . len ( ) {
98
- cx. frames [ cx. idx ] = Frame {
99
- symbol_addr : symaddr as * mut u8 ,
100
- exact_position : ip as * mut u8 ,
101
- inline_context : 0 ,
102
- } ;
103
- cx. idx += 1 ;
104
- }
101
+ cx. frames [ cx. idx ] = Frame {
102
+ symbol_addr : symaddr as * mut u8 ,
103
+ exact_position : ip as * mut u8 ,
104
+ inline_context : 0 ,
105
+ } ;
106
+ cx. idx += 1 ;
105
107
106
108
uw:: _URC_NO_REASON
107
109
}
Original file line number Diff line number Diff line change @@ -68,6 +68,10 @@ pub fn unwind_backtrace(frames: &mut [Frame])
68
68
extern fn trace_fn ( ctx : * mut uw:: _Unwind_Context ,
69
69
arg : * mut libc:: c_void ) -> uw:: _Unwind_Reason_Code {
70
70
let cx = unsafe { & mut * ( arg as * mut Context ) } ;
71
+ if cx. idx >= cx. frames . len ( ) {
72
+ return uw:: _URC_NORMAL_STOP;
73
+ }
74
+
71
75
let mut ip_before_insn = 0 ;
72
76
let mut ip = unsafe {
73
77
uw:: _Unwind_GetIPInfo ( ctx, & mut ip_before_insn) as * mut libc:: c_void
@@ -94,14 +98,12 @@ extern fn trace_fn(ctx: *mut uw::_Unwind_Context,
94
98
unsafe { uw:: _Unwind_FindEnclosingFunction ( ip) }
95
99
} ;
96
100
97
- if cx. idx < cx. frames . len ( ) {
98
- cx. frames [ cx. idx ] = Frame {
99
- symbol_addr : symaddr as * mut u8 ,
100
- exact_position : ip as * mut u8 ,
101
- inline_context : 0 ,
102
- } ;
103
- cx. idx += 1 ;
104
- }
101
+ cx. frames [ cx. idx ] = Frame {
102
+ symbol_addr : symaddr as * mut u8 ,
103
+ exact_position : ip as * mut u8 ,
104
+ inline_context : 0 ,
105
+ } ;
106
+ cx. idx += 1 ;
105
107
106
108
uw:: _URC_NO_REASON
107
109
}
You can’t perform that action at this time.
0 commit comments