]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
ppc32 stack unwind: if the initial FP looks bad, don't use it.
authorJulian Seward <jseward@acm.org>
Sun, 13 Nov 2005 02:41:35 +0000 (02:41 +0000)
committerJulian Seward <jseward@acm.org>
Sun, 13 Nov 2005 02:41:35 +0000 (02:41 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5111

coregrind/m_stacktrace.c

index c14b57e34787f3e3c221235fcbd6e964ae9d192c..fad1fc37ff73ca5c3ddd454dd6063a7feca589b2 100644 (file)
@@ -189,32 +189,37 @@ UInt VG_(get_StackTrace2) ( Addr* ips, UInt n_ips,
 
    ips[0] = ip;
    i = 1;
-   fp = (((UWord*)fp)[0]);
 
-   while (True) {
+   if (fp_min <= fp && fp < fp_max-4+1) {
 
-      if (i >= n_ips)
-         break;
+      /* initial FP is sane; keep going */
+      fp = (((UWord*)fp)[0]);
 
-      /* Try to derive a new (ip,fp) pair from the current set. */
+      while (True) {
 
-      if (fp_min <= fp && fp <= fp_max) {
-         /* fp looks sane, so use it. */
+         if (i >= n_ips)
+            break;
 
-         if (i == 1 && lr_is_first_RA)
-            ip = lr;
-         else
-            ip = (((UWord*)fp)[1]);
+         /* Try to derive a new (ip,fp) pair from the current set. */
 
-         fp = (((UWord*)fp)[0]);
-         ips[i++] = ip;
-         if (debug)
-            VG_(printf)("     ipsF[%d]=%08p\n", i-1, ips[i-1]);
-         continue;
-      }
+         if (fp_min <= fp && fp <= fp_max) {
+            /* fp looks sane, so use it. */
 
-      /* No luck there.  We have to give up. */
-      break;
+            if (i == 1 && lr_is_first_RA)
+               ip = lr;
+            else
+               ip = (((UWord*)fp)[1]);
+
+            fp = (((UWord*)fp)[0]);
+            ips[i++] = ip;
+            if (debug)
+               VG_(printf)("     ipsF[%d]=%08p\n", i-1, ips[i-1]);
+            continue;
+         }
+
+         /* No luck there.  We have to give up. */
+         break;
+      }
    }
 
 #  else