From: Nicholas Nethercote Date: Thu, 10 Nov 2005 15:20:37 +0000 (+0000) Subject: Cachegrind was aborting if it hit a client request. Now it doesn't. X-Git-Tag: svn/VALGRIND_3_1_0~160 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3035e5abeee97d04f0deb0d42e08e0452b565c03;p=thirdparty%2Fvalgrind.git Cachegrind was aborting if it hit a client request. Now it doesn't. 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 --- diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c index ec493c7656..99d7069643 100644 --- a/cachegrind/cg_main.c +++ b/cachegrind/cg_main.c @@ -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 diff --git a/cachegrind/tests/Makefile.am b/cachegrind/tests/Makefile.am index 58e62163ff..480c0391d5 100644 --- a/cachegrind/tests/Makefile.am +++ b/cachegrind/tests/Makefile.am @@ -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 index 0000000000..0f2bc2ed0b --- /dev/null +++ b/cachegrind/tests/clreq.c @@ -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 index 0000000000..e69de29bb2 diff --git a/cachegrind/tests/clreq.vgtest b/cachegrind/tests/clreq.vgtest new file mode 100644 index 0000000000..c0cf5fadfa --- /dev/null +++ b/cachegrind/tests/clreq.vgtest @@ -0,0 +1,3 @@ +prog: clreq +vgopts: -q +cleanup: rm cachegrind.out.* diff --git a/include/pub_tool_machine.h b/include/pub_tool_machine.h index 1b24f0f74d..b569e859cd 100644 --- a/include/pub_tool_machine.h +++ b/include/pub_tool_machine.h @@ -31,19 +31,21 @@ #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