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) {
8989 let mut context = core:: mem:: zeroed :: < MyContext > ( ) ;
9090 RtlCaptureContext ( & mut context. 0 ) ;
9191
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 {
9495 // The base address of the module containing the function will be stored here
9596 // when RtlLookupFunctionEntry returns successfully.
9697 let mut base = 0 ;
@@ -114,6 +115,8 @@ pub unsafe fn trace(cb: &mut dyn FnMut(&super::Frame) -> bool) {
114115 break ;
115116 }
116117
118+ let previous_ip = context. ip ( ) ;
119+ let previous_sp = context. sp ( ) ;
117120 let mut handler_data = 0usize ;
118121 let mut establisher_frame = 0 ;
119122
@@ -127,5 +130,9 @@ pub unsafe fn trace(cb: &mut dyn FnMut(&super::Frame) -> bool) {
127130 & mut establisher_frame,
128131 ptr:: null_mut ( ) ,
129132 ) ;
133+
134+ if context. ip ( ) == 0 || ( context. ip ( ) == previous_ip && context. sp ( ) == previous_sp) {
135+ break ;
136+ }
130137 }
131138}
You can’t perform that action at this time.
0 commit comments