]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Cachegrind was aborting if it hit a client request. Now it doesn't.
authorNicholas Nethercote <njn@valgrind.org>
Thu, 10 Nov 2005 15:20:37 +0000 (15:20 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Thu, 10 Nov 2005 15:20:37 +0000 (15:20 +0000)
This fixes #116057, I think.  I added a regtest so it won't regress again.

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

cachegrind/cg_main.c
cachegrind/tests/Makefile.am
cachegrind/tests/clreq.c [new file with mode: 0644]
cachegrind/tests/clreq.stderr.exp [new file with mode: 0644]
cachegrind/tests/clreq.vgtest [new file with mode: 0644]
include/pub_tool_machine.h

index ec493c7656b4d2977b8431f15853ee75997c525c..99d70696437e68ba4d384d4961f9a4330b308d69 100644 (file)
@@ -800,8 +800,9 @@ IRBB* cg_instrument ( IRBB* bbIn, VexGuestLayout* layout,
             // Pretend otherwise.
             if (isize == 0) isize = VG_MIN_INSTR_SZB;
 
-            // Check size.  XXX: broken for client requests!
-            tl_assert(VG_MIN_INSTR_SZB <= isize && isize <= VG_MAX_INSTR_SZB);
+            // Sanity-check size.
+            tl_assert( (VG_MIN_INSTR_SZB <= isize && isize <= VG_MAX_INSTR_SZB)
+                     || VG_CLREQ_SZB == isize );
 
             // Get space for and init the inode, record it as the current one.
             // Subsequent Dr/Dw/Dm events from the same instruction will 
index 58e62163ff0c7b7b3697fc655a7718037a8a0a19..480c0391d5d22f38883f054f0ce789516acfe9a0 100644 (file)
@@ -5,10 +5,11 @@ noinst_SCRIPTS = filter_stderr filter_cachesim_discards
 
 EXTRA_DIST = $(noinst_SCRIPTS) \
        chdir.vgtest chdir.stderr.exp \
+       clreq.vgtest clreq.stderr.exp \
        dlclose.vgtest dlclose.stderr.exp dlclose.stdout.exp
 
 check_PROGRAMS = \
-       chdir dlclose myprint.so
+       chdir clreq dlclose myprint.so
 
 AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow -g
 
diff --git a/cachegrind/tests/clreq.c b/cachegrind/tests/clreq.c
new file mode 100644 (file)
index 0000000..0f2bc2e
--- /dev/null
@@ -0,0 +1,11 @@
+
+// Prior to 3.0.1, Cachegrind was failing if run on a program that uses
+// client requests.  It was fixed in 3.0.1, but then reintroduced
+// afterwards (reported as bug #116057).  So here we test it.
+
+#include "../../include/valgrind.h"
+
+int main(void)
+{
+   return RUNNING_ON_VALGRIND;
+}
diff --git a/cachegrind/tests/clreq.stderr.exp b/cachegrind/tests/clreq.stderr.exp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/cachegrind/tests/clreq.vgtest b/cachegrind/tests/clreq.vgtest
new file mode 100644 (file)
index 0000000..c0cf5fa
--- /dev/null
@@ -0,0 +1,3 @@
+prog: clreq
+vgopts: -q
+cleanup: rm cachegrind.out.*
index 1b24f0f74d1372473fe2cbe7d038776482c475d9..b569e859cd79f58a93db439de4a12d3e3ab2c960 100644 (file)
 #ifndef __PUB_TOOL_MACHINE_H
 #define __PUB_TOOL_MACHINE_H
 
-/* VG_STACK_REDZONE_SZB: how many bytes below the stack pointer are validly
- * addressible? */
 #if defined(VGA_x86)
-#  define VG_MIN_INSTR_SZB          1
-#  define VG_MAX_INSTR_SZB         16
-#  define VG_STACK_REDZONE_SZB      0
+#  define VG_MIN_INSTR_SZB          1  // min length of native instruction
+#  define VG_MAX_INSTR_SZB         16  // max length of native instruction
+#  define VG_CLREQ_SZB             18  // length of a client request, may
+                                       //   be larger than VG_MAX_INSTR_SZB
+#  define VG_STACK_REDZONE_SZB      0  // number of addressable bytes below SP
 #elif defined(VGA_amd64)
 #  define VG_MIN_INSTR_SZB          1
 #  define VG_MAX_INSTR_SZB         16
+#  define VG_CLREQ_SZB             18
 #  define VG_STACK_REDZONE_SZB    128
 #elif defined(VGA_ppc32)
 #  define VG_MIN_INSTR_SZB          4
 #  define VG_MAX_INSTR_SZB          4 
+#  define VG_CLREQ_SZB             24
 #  define VG_STACK_REDZONE_SZB      0
 #else
 #  error Unknown arch