From c625bbc784471f2983c6c44bd580a2cb9be6c468332776f5841c18e71e233354 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Thu, 29 Apr 2010 18:49:50 +0000 Subject: [PATCH] - handle pthread apps better (bnc#599585) - prefer CFI for better stack unwinding (bnc#559061) OBS-URL: https://build.opensuse.org/package/show/devel:tools/valgrind?expand=0&rev=12 --- prefer-cfi.diff | 46 ++++++++++++++++++++++++++++++++++++++++++++++ valgrind.changes | 6 ++++++ valgrind.spec | 4 ++++ 3 files changed, 56 insertions(+) create mode 100644 prefer-cfi.diff diff --git a/prefer-cfi.diff b/prefer-cfi.diff new file mode 100644 index 0000000..79cc155 --- /dev/null +++ b/prefer-cfi.diff @@ -0,0 +1,46 @@ +--- 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 ) ) { diff --git a/valgrind.changes b/valgrind.changes index c7c15b2..bb64030 100644 --- a/valgrind.changes +++ b/valgrind.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Apr 26 16:14:02 CEST 2010 - dmueller@suse.de + +- handle pthread apps better (bnc#599585) +- prefer CFI for better stack unwinding (bnc#559061) + ------------------------------------------------------------------- Fri Mar 26 13:56:19 CET 2010 - dmueller@suse.de diff --git a/valgrind.spec b/valgrind.spec index b2509b0..ad678f6 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -36,6 +36,7 @@ Patch1: jit-register-unregister.diff Patch2: deprecated.diff Patch3: glibc-211.diff Patch4: bnc558964.diff +Patch5: prefer-cfi.diff Provides: callgrind = %version Obsoletes: callgrind < %version ExclusiveArch: %ix86 x86_64 ppc ppc64 @@ -122,6 +123,9 @@ cd .. %patch2 %patch3 %patch4 +%if %suse_version >= 1120 +%patch5 +%endif %build export CFLAGS="$RPM_OPT_FLAGS"