]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Moved VG_(first_matching_thread_stack), removing m_threadstate's dependency
authorNicholas Nethercote <njn@valgrind.org>
Tue, 21 Jun 2005 04:01:51 +0000 (04:01 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Tue, 21 Jun 2005 04:01:51 +0000 (04:01 +0000)
on m_machine.

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

coregrind/m_machine.c
coregrind/m_threadstate.c
include/pub_tool_machine.h
include/pub_tool_threadstate.h
massif/ms_main.c

index 71c41b5e5f798d6e36f7c9832e6ea810374cfd36..a92d15d18c8dd33e900ffef17665859e593203cb 100644 (file)
@@ -178,7 +178,23 @@ void VG_(apply_to_GP_regs)(void (*f)(UWord))
    }
 }
 
+// Try and identify a thread whose stack satisfies the predicate p, or
+// return VG_INVALID_THREADID if none do.
+ThreadId VG_(first_matching_thread_stack)
+              ( Bool (*p) ( Addr stack_min, Addr stack_max, void* d ),
+                void* d )
+{
+   ThreadId tid;
+
+   for (tid = 1; tid < VG_N_THREADS; tid++) {
+      if (VG_(threads)[tid].status == VgTs_Empty) continue;
 
+      if ( p ( VG_(get_SP)(tid),
+               VG_(threads)[tid].client_stack_highest_word, d ) )
+         return tid;
+   }
+   return VG_INVALID_THREADID;
+}
 
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
index b38642bce36fa63504f0e88fefafdf8eec53509d..6c426bdc2c92a389c5eed17485068a5a9099ef64 100644 (file)
@@ -31,7 +31,6 @@
 #include "pub_core_basics.h"
 #include "pub_core_threadstate.h"
 #include "pub_core_libcassert.h"
-#include "pub_core_machine.h"       // For VG_(get_SP)
 
 /*------------------------------------------------------------*/
 /*--- Data structures.                                     ---*/
@@ -123,26 +122,6 @@ ThreadId VG_(get_lwp_tid)(Int lwp)
    return VG_INVALID_THREADID;
 }
 
-/* For constructing error messages only: try and identify a thread
-   whose stack satisfies the predicate p, or return VG_INVALID_THREADID
-   if none do.
-*/
-ThreadId VG_(first_matching_thread_stack)
-              ( Bool (*p) ( Addr stack_min, Addr stack_max, void* d ),
-                void* d )
-{
-   ThreadId tid;
-
-   for (tid = 1; tid < VG_N_THREADS; tid++) {
-      if (VG_(threads)[tid].status == VgTs_Empty) continue;
-
-      if ( p ( VG_(get_SP)(tid),
-               VG_(threads)[tid].client_stack_highest_word, d ) )
-         return tid;
-   }
-   return VG_INVALID_THREADID;
-}
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 46ff9d66dd69201eb9e9971e7bc59c2933030426..a707b5faeefa2c720929d67a417984222362ff08 100644 (file)
@@ -74,6 +74,12 @@ extern void VG_(set_shadow_regs_area) ( ThreadId tid, OffT guest_state_offset,
 // doing leak checking.
 extern void VG_(apply_to_GP_regs)(void (*f)(UWord val));
 
+// Searches through all thread stacks to see if any match.  Returns
+// VG_INVALID_THREADID if none match.
+extern ThreadId VG_(first_matching_thread_stack)
+                        ( Bool (*p) ( Addr stack_min, Addr stack_max, void* d ),
+                          void* d );
+
 #endif   // __PUB_TOOL_MACHINE_H
 
 /*--------------------------------------------------------------------*/
index 439fec0255c4fd6f8881d405c0811a3e055b1cd5..4dcb8dedba382126bf78beb2f840e076b6c8324d 100644 (file)
 /* Get the TID of the thread which currently has the CPU. */
 extern ThreadId VG_(get_running_tid) ( void );
 
-/* Searches through all thread's stacks to see if any match.  Returns
-   VG_INVALID_THREADID if none match. */
-extern ThreadId VG_(first_matching_thread_stack)
-                        ( Bool (*p) ( Addr stack_min, Addr stack_max, void* d ),
-                          void* d );
-
 #endif   // __PUB_TOOL_THREADSTATE_H
 
 /*--------------------------------------------------------------------*/
index 16f387d470babae35037bf529b8176886f061825..48090be8219f600443743a0ed8c89aa8a00c2a7a 100644 (file)
 #include "pub_tool_libcmman.h"
 #include "pub_tool_libcprint.h"
 #include "pub_tool_libcproc.h"
+#include "pub_tool_machine.h"
 #include "pub_tool_mallocfree.h"
 #include "pub_tool_options.h"
 #include "pub_tool_profile.h"
 #include "pub_tool_replacemalloc.h"
 #include "pub_tool_stacktrace.h"
-#include "pub_tool_threadstate.h"
 #include "pub_tool_tooliface.h"
 
 #include "valgrind.h"           // For {MALLOC,FREE}LIKE_BLOCK