valgrind/prefer-cfi.diff

47 lines
1.9 KiB
Diff

--- coregrind/m_stacktrace.c
+++ coregrind/m_stacktrace.c
@@ -153,11 +153,18 @@
/* Try to derive a new (ip,sp,fp) triple from the current
set. */
- /* On x86, first try the old-fashioned method of following the
- %ebp-chain. Code which doesn't use this (that is, compiled
- with -fomit-frame-pointer) is not ABI compliant and so
- relatively rare. Besides, trying the CFI first almost always
- fails, and is expensive. */
+ /* That didn't work out, so see if there is any CF info to hand
+ which can be used. */
+ if ( VG_(use_CF_info)( &ip, &sp, &fp, fp_min, fp_max ) ) {
+ if (0 == ip || 1 == ip) break;
+ if (sps) sps[i] = sp;
+ if (fps) fps[i] = fp;
+ ips[i++] = ip - 1; /* -1: refer to calling insn, not the RA */
+ if (debug)
+ VG_(printf)(" ipsC[%d]=0x%08lx\n", i-1, ips[i-1]);
+ ip = ip - 1; /* as per comment at the head of this loop */
+ continue;
+ }
/* Deal with frames resulting from functions which begin "pushl%
ebp ; movl %esp, %ebp" which is the ABI-mandated preamble. */
if (fp_min <= fp &&
@@ -183,19 +190,6 @@
ip = ip - 1; /* as per comment at the head of this loop */
continue;
}
-
- /* That didn't work out, so see if there is any CF info to hand
- which can be used. */
- if ( VG_(use_CF_info)( &ip, &sp, &fp, fp_min, fp_max ) ) {
- if (0 == ip || 1 == ip) break;
- if (sps) sps[i] = sp;
- if (fps) fps[i] = fp;
- ips[i++] = ip - 1; /* -1: refer to calling insn, not the RA */
- if (debug)
- VG_(printf)(" ipsC[%d]=0x%08lx\n", i-1, ips[i-1]);
- ip = ip - 1; /* as per comment at the head of this loop */
- continue;
- }
/* And, similarly, try for MSVC FPO unwind info. */
if ( VG_(use_FPO_info)( &ip, &sp, &fp, fp_min, fp_max ) ) {