From: Nicholas Nethercote Date: Mon, 16 May 2005 13:31:23 +0000 (+0000) Subject: No need to generate valgrind.h from valgrind.h.in. We can just use the X-Git-Tag: svn/VALGRIND_3_0_0~579 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=816419fa9a28f2c405d073314af35c0fc901ab9e;p=thirdparty%2Fvalgrind.git No need to generate valgrind.h from valgrind.h.in. We can just use the compiler symbols rather than our own symbols for the architectures (we already were, more or less). This simplifies the build, hurrah! I also inverted the sense of the NVALGRIND ifdefs, to make them easier to read, and fixed up some comments. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3739 --- diff --git a/configure.in b/configure.in index 0a45429c83..f7db9808df 100644 --- a/configure.in +++ b/configure.in @@ -382,7 +382,6 @@ AC_OUTPUT( tests/Makefile tests/vg_regtest tests/unused/Makefile - include/valgrind.h include/Makefile auxprogs/Makefile coregrind/Makefile diff --git a/include/Makefile.am b/include/Makefile.am index a2a059c2f0..f831906768 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,6 +1,5 @@ EXTRA_DIST = \ - valgrind.h.in \ vg_profile.c incincdir = $(includedir)/valgrind @@ -25,6 +24,3 @@ incinc_HEADERS = \ vki_posixtypes-amd64-linux.h \ vki_posixtypes-arm-linux.h \ vki_posixtypes-x86-linux.h - -BUILT_SOURCES = valgrind.h -CLEANFILES = valgrind.h diff --git a/include/valgrind.h.in b/include/valgrind.h similarity index 95% rename from include/valgrind.h.in rename to include/valgrind.h index 8df4f62a31..750a9d9457 100644 --- a/include/valgrind.h.in +++ b/include/valgrind.h @@ -60,14 +60,11 @@ #include -#undef __@VG_ARCH@__ -#define __@VG_ARCH@__ 1 // Architecture we're installed on - - /* If we're not compiling for our target architecture, don't generate - any inline asms. This would be a bit neater if we used the same - CPP symbols as the compiler for identifying architectures. */ -#if !defined(__i386__) && !defined(__amd64__) + any inline asms. Note that in this file we're using the compiler's + CPP symbols for identifying architectures, which are different to + the ones we use within the rest of Valgrind. */ +#if !defined(__i386__) && !defined(__x86_64__) # ifndef NVALGRIND # define NVALGRIND 1 # endif /* NVALGRIND */ @@ -88,7 +85,18 @@ problem, you can compile with the NVALGRIND symbol defined (gcc -DNVALGRIND) so that client requests are not even compiled in. */ -#ifndef NVALGRIND +#ifdef NVALGRIND + +/* Define NVALGRIND to completely remove the Valgrind magic sequence + from the compiled code (analogous to NDEBUG's effects on assert()) */ +#define VALGRIND_MAGIC_SEQUENCE( \ + _zzq_rlval, _zzq_default, _zzq_request, \ + _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4) \ + { \ + (_zzq_rlval) = (_zzq_default); \ + } + +#else /* NVALGRIND */ /* The following defines the magic code sequences which the JITter spots and handles magically. Don't look too closely at them; they will rot @@ -104,11 +112,11 @@ _zzq_arg1..4 request params Nb: we put the assembly code sequences for all architectures in this one - file. This is because this file must be stand-alone, so we can't rely on - eg. x86/ subdirectories like we do within the rest of Valgrind. + file. This is because this file must be stand-alone, and we don't want + to have multiple files. */ -#ifdef __amd64__ +#ifdef __x86_64__ extern int printf (__const char *__restrict __format, ...); extern void exit (int __status); #define VALGRIND_MAGIC_SEQUENCE( \ @@ -129,10 +137,7 @@ extern void exit (int __status); : "cc", "memory" \ ); \ } -// XXX: make sure that the register holding the args and the register taking -// the return value match VGA_CLREQ_ARGS and VGA_CLREQ_RET in -// amd64/core_arch.h! -#endif // __amd64__ +#endif // __x86_64__ #ifdef __i386__ #define VALGRIND_MAGIC_SEQUENCE( \ @@ -154,10 +159,9 @@ extern void exit (int __status); ); \ } #endif // __i386__ -// Insert assembly code for other architectures here... #ifdef __arm__ -// XXX: terporary, until MAGIC_SEQUENCE is written properly +// XXX: temporary, until MAGIC_SEQUENCE is written properly extern int printf (__const char *__restrict __format, ...); extern void exit (int __status); #define VALGRIND_MAGIC_SEQUENCE( \ @@ -175,20 +179,11 @@ extern void exit (int __status); asm volatile(""); \ } // XXX: make sure that the register holding the args and the register taking -// the return value match VGA_CLREQ_ARGS and VGA_CLREQ_RET in -// arm/core_arch.h! +// the return value match what the scheduler is expecting. #endif // __arm__ -#else /* NVALGRIND */ -/* Define NVALGRIND to completely remove the Valgrind magic sequence - from the compiled code (analogous to NDEBUG's effects on - assert()) */ -#define VALGRIND_MAGIC_SEQUENCE( \ - _zzq_rlval, _zzq_default, _zzq_request, \ - _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4) \ - { \ - (_zzq_rlval) = (_zzq_default); \ - } +// Insert assembly code for other architectures here... + #endif /* NVALGRIND */ @@ -267,7 +262,12 @@ typedef _qzz_addr, _qzz_len, 0, 0); \ } -#ifndef NVALGRIND +#ifdef NVALGRIND + +#define VALGRIND_PRINTF(...) +#define VALGRIND_PRINTF_BACKTRACE(...) + +#else /* NVALGRIND */ int VALGRIND_PRINTF(const char *format, ...) __attribute__((format(__printf__, 1, 2))); @@ -299,11 +299,6 @@ VALGRIND_PRINTF_BACKTRACE(const char *format, ...) return (int)_qzz_res; } -#else /* NVALGRIND */ - -#define VALGRIND_PRINTF(...) -#define VALGRIND_PRINTF_BACKTRACE(...) - #endif /* NVALGRIND */ /* These requests allow control to move from the simulated CPU to the