]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
When unwinding the stack on x86/amd64 subtract one from the value of
authorTom Hughes <tom@compton.nu>
Fri, 4 Nov 2005 11:31:33 +0000 (11:31 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 4 Nov 2005 11:31:33 +0000 (11:31 +0000)
ip before starting a new pass of the loop.

The reason for this is that (except for the first pass of the loop) the
value of ip is actually a return address, which is therefore after the
instruction that was executing at the time. This means that if there is
a boundary in the CFI information at that point we can wind up using the
wrong CFI data to do the next unwind if we do it based on the return
address.

This most commonly happens with a tail call where we wind up using the
data for the next function to do the unwind and getting hopelessly lost.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4996

coregrind/m_stacktrace.c

index e9824883bcbe8c1b1a110a063435288e2a445487..62b83c29da0e977f8039237483a17dd1b0f6b28b 100644 (file)
@@ -124,6 +124,7 @@ UInt VG_(get_StackTrace2) ( Addr* ips, UInt n_ips,
          ips[i++] = ip;
          if (debug)
             VG_(printf)("     ipsC[%d]=%08p\n", i-1, ips[i-1]);
+         ip = ip - 1;
          continue;
       }
 
@@ -145,6 +146,7 @@ UInt VG_(get_StackTrace2) ( Addr* ips, UInt n_ips,
          ips[i++] = ip;
          if (debug)
             VG_(printf)("     ipsF[%d]=%08p\n", i-1, ips[i-1]);
+         ip = ip - 1;
          continue;
       }