From 54e5bf28562a26caa01ea954a4f73f95dd9cd0b8 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Sun, 25 Nov 2007 14:08:53 +0000 Subject: [PATCH] Misc changes needed to support exp-drd (Bart Van Assche). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7213 --- Makefile.am | 13 +++++++++---- configure.in | 3 +++ coregrind/m_debuginfo/debuginfo.c | 29 ++++++++++++++++++++++++++++- coregrind/m_libcbase.c | 18 ++++++++++++++++++ coregrind/m_machine.c | 7 +++++++ include/pub_tool_debuginfo.h | 3 +++ include/pub_tool_libcbase.h | 1 + include/pub_tool_machine.h | 3 +++ 8 files changed, 72 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index f53bf5d14b..ef84ca8e97 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,19 +9,22 @@ TOOLS = memcheck \ massif \ lackey \ none \ - helgrind \ - exp-omega + helgrind + +EXP_TOOLS = exp-omega \ + exp-drd # Put docs last because building the HTML is slow and we want to get # everything else working before we try it. -SUBDIRS = include coregrind . tests perf auxprogs $(TOOLS) docs +SUBDIRS = include coregrind . tests perf auxprogs $(TOOLS) $(EXP_TOOLS) docs DIST_SUBDIRS = $(SUBDIRS) SUPP_FILES = \ glibc-2.2.supp glibc-2.3.supp glibc-2.4.supp glibc-2.5.supp \ glibc-2.6.supp aix5libc.supp xfree-3.supp xfree-4.supp \ glibc-2.34567-NPTL-helgrind.supp \ - glibc-2.2-LinuxThreads-helgrind.supp + glibc-2.2-LinuxThreads-helgrind.supp \ + glibc-2.X-drd.supp dist_val_DATA = $(SUPP_FILES) default.supp @@ -65,6 +68,8 @@ default.supp: $(SUPP_FILES) ## Preprend @PERL@ because tests/vg_regtest isn't executable regtest: check @PERL@ tests/vg_regtest $(TOOLS) +exp-regtest: check + @PERL@ tests/vg_regtest $(EXP_TOOLS) ## Preprend @PERL@ because tests/vg_per isn't executable perf: check diff --git a/configure.in b/configure.in index bfac904a36..adb1877300 100644 --- a/configure.in +++ b/configure.in @@ -1018,6 +1018,9 @@ AC_OUTPUT( exp-omega/Makefile exp-omega/tests/Makefile exp-omega/docs/Makefile + exp-drd/Makefile + exp-drd/docs/Makefile + exp-drd/tests/Makefile ) cat<symtab_used; diff --git a/coregrind/m_libcbase.c b/coregrind/m_libcbase.c index 280efedff8..d895bd3b02 100644 --- a/coregrind/m_libcbase.c +++ b/coregrind/m_libcbase.c @@ -501,6 +501,24 @@ void* VG_(memcpy) ( void *dest, const void *src, SizeT sz ) return dest; } +void* VG_(memmove)(void *dest, const void *src, SizeT sz) +{ + SizeT i; + if (sz == 0) + return dest; + if (dest < src) { + for (i = 0; i < sz; i++) { + ((UChar*)dest)[i] = ((UChar*)src)[i]; + } + } + else if (dest > src) { + for (i = sz - 1; i >= 0; i--) { + ((UChar*)dest)[i] = ((UChar*)src)[i]; + } + } + return dest; +} + void* VG_(memset) ( void *dest, Int c, SizeT sz ) { Char *d = (Char *)dest; diff --git a/coregrind/m_machine.c b/coregrind/m_machine.c index 358cc652dc..bb4faf7064 100644 --- a/coregrind/m_machine.c +++ b/coregrind/m_machine.c @@ -215,6 +215,13 @@ Bool VG_(thread_stack_next)(ThreadId* tid, Addr* stack_min, Addr* stack_max) return False; } +Addr VG_(thread_get_stack_max)(ThreadId tid) +{ + vg_assert(0 <= tid && tid < VG_N_THREADS && tid != VG_INVALID_THREADID); + vg_assert(VG_(threads)[tid].status != VgTs_Empty); + return VG_(threads)[tid].client_stack_highest_word; +} + //------------------------------------------------------------- /* Details about the capabilities of the underlying (host) CPU. These details are acquired by (1) enquiring with the CPU at startup, or diff --git a/include/pub_tool_debuginfo.h b/include/pub_tool_debuginfo.h index 76dd6b22b1..0387d1fe4f 100644 --- a/include/pub_tool_debuginfo.h +++ b/include/pub_tool_debuginfo.h @@ -136,6 +136,9 @@ typedef extern VgSectKind VG_(seginfo_sect_kind)(Addr); +extern Char* VG_(seginfo_sect_kind_name)(Addr a, Char* buf, UInt n_buf); + + #endif // __PUB_TOOL_DEBUGINFO_H /*--------------------------------------------------------------------*/ diff --git a/include/pub_tool_libcbase.h b/include/pub_tool_libcbase.h index 0be7534e51..f262377160 100644 --- a/include/pub_tool_libcbase.h +++ b/include/pub_tool_libcbase.h @@ -104,6 +104,7 @@ extern Bool VG_(string_match) ( const Char* pat, const Char* str ); ------------------------------------------------------------------ */ extern void* VG_(memcpy) ( void *d, const void *s, SizeT sz ); +extern void* VG_(memmove)( void *d, const void *s, SizeT sz ); extern void* VG_(memset) ( void *s, Int c, SizeT sz ); extern Int VG_(memcmp) ( const void* s1, const void* s2, SizeT n ); diff --git a/include/pub_tool_machine.h b/include/pub_tool_machine.h index 338c3b8c6a..04831e4b7d 100644 --- a/include/pub_tool_machine.h +++ b/include/pub_tool_machine.h @@ -100,6 +100,9 @@ extern void VG_(thread_stack_reset_iter) ( void ); extern Bool VG_(thread_stack_next) ( ThreadId* tid, Addr* stack_min, Addr* stack_max ); +// Returns .client_stack_highest_word for the given thread +extern Addr VG_(thread_get_stack_max) ( ThreadId tid ); + // Given a pointer to a function as obtained by "& functionname" in C, // produce a pointer to the actual entry point for the function. For // most platforms it's the identity function. Unfortunately, on -- 2.47.2