File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -89,8 +89,9 @@ pub unsafe fn trace(cb: &mut dyn FnMut(&super::Frame) -> bool) {
89
89
let mut context = core:: mem:: zeroed :: < MyContext > ( ) ;
90
90
RtlCaptureContext ( & mut context. 0 ) ;
91
91
92
- // Call `RtlVirtualUnwind` to find the previous stack frame, walking until we hit ip = 0.
93
- while context. ip ( ) != 0 {
92
+ // Call `RtlVirtualUnwind` to find the previous stack frame, walking until we hit ip = 0
93
+ // or we are no longer making progress.
94
+ loop {
94
95
// The base address of the module containing the function will be stored here
95
96
// when RtlLookupFunctionEntry returns successfully.
96
97
let mut base = 0 ;
@@ -114,6 +115,8 @@ pub unsafe fn trace(cb: &mut dyn FnMut(&super::Frame) -> bool) {
114
115
break ;
115
116
}
116
117
118
+ let previous_ip = context. ip ( ) ;
119
+ let previous_sp = context. sp ( ) ;
117
120
let mut handler_data = 0usize ;
118
121
let mut establisher_frame = 0 ;
119
122
@@ -127,5 +130,9 @@ pub unsafe fn trace(cb: &mut dyn FnMut(&super::Frame) -> bool) {
127
130
& mut establisher_frame,
128
131
ptr:: null_mut ( ) ,
129
132
) ;
133
+
134
+ if context. ip ( ) == 0 || ( context. ip ( ) == previous_ip && context. sp ( ) == previous_sp) {
135
+ break ;
136
+ }
130
137
}
131
138
}
You can’t perform that action at this time.
0 commit comments