]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Factor out the name of the libpthread library. Also fix a minor stack trace
authorNicholas Nethercote <njn@valgrind.org>
Mon, 11 May 2009 08:01:09 +0000 (08:01 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Mon, 11 May 2009 08:01:09 +0000 (08:01 +0000)
bogon.

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

coregrind/m_libcassert.c
drd/drd_pthread_intercepts.c
helgrind/hg_intercepts.c
include/pub_tool_redir.h
include/valgrind.h

index 1d7e5a7d9b1ba78c7c21fc65b9f9a84bd0b1fecf..3185d8b159253072820f9174f8c426502b1e9945 100644 (file)
@@ -130,6 +130,7 @@ static void report_and_quit ( const Char* report,
 {
    Addr stacktop;
    Addr ips[BACKTRACE_DEPTH];
+   Int  n_ips;
    ThreadState *tst 
       = VG_(get_ThreadState)( VG_(lwpid_to_vgtid)( VG_(gettid)() ) );
  
@@ -142,14 +143,15 @@ static void report_and_quit ( const Char* report,
  
    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)(
index 2af9b28eb41b406ea0e2c757f078e1c25a5d4244..f77569d5994af9b45d0dbd70e3f0a31f136d30b6 100644 (file)
@@ -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. */
index 28b6969c389d872870b976c6035c657d1872976e..698a0829c221b739546ce3b3b4b060168c130d7b 100644 (file)
@@ -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.
index 1cbd03e620e8b5fd40991394907e05f92c595278..ca40bc4f5450ef415be12a7ad6002e4c314c3501 100644 (file)
 #  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)
index 5b4b8af791082211cec364f533d3c9107dfaaffd..1fa63acfad7c4b71d4c45352689b7a79fd08d099 100644 (file)
@@ -581,11 +581,15 @@ typedef
 /* 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.