|
From: <sv...@va...> - 2009-05-11 08:01:15
|
Author: njn
Date: 2009-05-11 09:01:09 +0100 (Mon, 11 May 2009)
New Revision: 9832
Log:
Factor out the name of the libpthread library. Also fix a minor stack trace
bogon.
Modified:
trunk/coregrind/m_libcassert.c
trunk/drd/drd_pthread_intercepts.c
trunk/helgrind/hg_intercepts.c
trunk/include/pub_tool_redir.h
trunk/include/valgrind.h
Modified: trunk/coregrind/m_libcassert.c
===================================================================
--- trunk/coregrind/m_libcassert.c 2009-05-10 22:42:19 UTC (rev 9831)
+++ trunk/coregrind/m_libcassert.c 2009-05-11 08:01:09 UTC (rev 9832)
@@ -130,6 +130,7 @@
{
Addr stacktop;
Addr ips[BACKTRACE_DEPTH];
+ Int n_ips;
ThreadState *tst
= VG_(get_ThreadState)( VG_(lwpid_to_vgtid)( VG_(gettid)() ) );
@@ -142,14 +143,15 @@
stacktop = tst->os_state.valgrind_stack_init_SP;
- VG_(get_StackTrace_wrk)(
- 0/*tid is unknown*/,
- ips, BACKTRACE_DEPTH,
- NULL/*array to dump SP values in*/,
- NULL/*array to dump FP values in*/,
- ip, sp, fp, lr, sp, stacktop
- );
- VG_(pp_StackTrace) (ips, BACKTRACE_DEPTH);
+ n_ips =
+ VG_(get_StackTrace_wrk)(
+ 0/*tid is unknown*/,
+ ips, BACKTRACE_DEPTH,
+ NULL/*array to dump SP values in*/,
+ NULL/*array to dump FP values in*/,
+ ip, sp, fp, lr, sp, stacktop
+ );
+ VG_(pp_StackTrace) (ips, n_ips);
VG_(show_sched_status)();
VG_(printf)(
Modified: trunk/drd/drd_pthread_intercepts.c
===================================================================
--- trunk/drd/drd_pthread_intercepts.c 2009-05-10 22:42:19 UTC (rev 9831)
+++ trunk/drd/drd_pthread_intercepts.c 2009-05-11 08:01:09 UTC (rev 9832)
@@ -79,8 +79,8 @@
#define ALLOCATE_THREAD_ARGS_ON_THE_STACK
#define PTH_FUNC(ret_ty, f, args...) \
- ret_ty VG_WRAP_FUNCTION_ZZ(libpthreadZdsoZd0,f)(args); \
- ret_ty VG_WRAP_FUNCTION_ZZ(libpthreadZdsoZd0,f)(args)
+ ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,f)(args); \
+ ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,f)(args)
/* Local data structures. */
Modified: trunk/helgrind/hg_intercepts.c
===================================================================
--- trunk/helgrind/hg_intercepts.c 2009-05-10 22:42:19 UTC (rev 9831)
+++ trunk/helgrind/hg_intercepts.c 2009-05-11 08:01:09 UTC (rev 9832)
@@ -59,8 +59,8 @@
/*----------------------------------------------------------------*/
#define PTH_FUNC(ret_ty, f, args...) \
- ret_ty I_WRAP_SONAME_FNNAME_ZZ(libpthreadZdsoZd0,f)(args); \
- ret_ty I_WRAP_SONAME_FNNAME_ZZ(libpthreadZdsoZd0,f)(args)
+ ret_ty I_WRAP_SONAME_FNNAME_ZZ(VG_Z_LIBPTHREAD_SONAME,f)(args); \
+ ret_ty I_WRAP_SONAME_FNNAME_ZZ(VG_Z_LIBPTHREAD_SONAME,f)(args)
// Do a client request. This is a macro rather than a function
// so as to avoid having an extra function in the stack trace.
Modified: trunk/include/pub_tool_redir.h
===================================================================
--- trunk/include/pub_tool_redir.h 2009-05-10 22:42:19 UTC (rev 9831)
+++ trunk/include/pub_tool_redir.h 2009-05-11 08:01:09 UTC (rev 9832)
@@ -198,6 +198,14 @@
# define VG_Z_LIBC_DOT_A libCZdaZLansicoreZu64ZdoZR // libC.a(ansicore_64.o)
#endif
+/* --- Soname of the pthreads library. --- */
+
+#if defined(VGO_linux) || defined(VGO_aix5)
+# define VG_Z_LIBPTHREAD_SONAME libpthreadZdsoZd0 // libpthread.so.0
+#else
+# error "Unknown platform"
+#endif
+
/* --- Sonames for Linux ELF linkers. --- */
#if defined(VGO_linux)
Modified: trunk/include/valgrind.h
===================================================================
--- trunk/include/valgrind.h 2009-05-10 22:42:19 UTC (rev 9831)
+++ trunk/include/valgrind.h 2009-05-11 08:01:09 UTC (rev 9832)
@@ -581,11 +581,15 @@
/* Use these to write the name of your wrapper. NOTE: duplicates
VG_WRAP_FUNCTION_Z{U,Z} in pub_tool_redir.h. */
+/* Use an extra level of macroisation so as to ensure the soname/fnname
+ args are fully macro-expanded before pasting them together. */
+#define VG_CONCAT4(_aa,_bb,_cc,_dd) _aa##_bb##_cc##_dd
+
#define I_WRAP_SONAME_FNNAME_ZU(soname,fnname) \
- _vgwZU_##soname##_##fnname
+ VG_CONCAT4(_vgwZU_,soname,_,fnname)
#define I_WRAP_SONAME_FNNAME_ZZ(soname,fnname) \
- _vgwZZ_##soname##_##fnname
+ VG_CONCAT4(_vgwZZ_,soname,_,fnname)
/* Use this macro from within a wrapper function to collect the
context (address and possibly other info) of the original function.
|