Wrapped DRD_() macro around global and static variables in drd_thread.[ch].
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9167 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/drd/drd_thread.h b/drd/drd_thread.h
index d7eecab..b4534c3 100644
--- a/drd/drd_thread.h
+++ b/drd/drd_thread.h
@@ -27,7 +27,7 @@
#define __THREAD_H
-// Includes.
+/* Include directives. */
#include "drd_basics.h"
#include "drd_segment.h"
@@ -37,7 +37,7 @@
#include "pub_tool_threadstate.h" // VG_N_THREADS
-// Defines.
+/* Defines. */
#define DRD_N_THREADS VG_N_THREADS
@@ -51,7 +51,7 @@
#define INVALID_POSIX_THREADID ((PThreadId)0)
-// Type definitions.
+/* Type definitions. */
typedef UWord PThreadId;
@@ -61,34 +61,38 @@
Segment* last;
ThreadId vg_threadid;
PThreadId pt_threadid;
- Addr stack_min_min; /** Lowest value stack pointer ever had. */
- Addr stack_min; /** Current stack pointer. */
- Addr stack_startup; /** Stack pointer after pthread_create() finished.*/
- Addr stack_max; /** Top of stack. */
- SizeT stack_size; /** Maximum size of stack. */
- /// Indicates whether the Valgrind core knows about this thread.
+ Addr stack_min_min; /**< Lowest value stack pointer ever had. */
+ Addr stack_min; /**< Current stack pointer. */
+ Addr stack_startup; /**<Stack pointer after pthread_create() finished.*/
+ Addr stack_max; /**< Top of stack. */
+ SizeT stack_size; /**< Maximum size of stack. */
+ /** Indicates whether the Valgrind core knows about this thread. */
Bool vg_thread_exists;
- /// Indicates whether there is an associated POSIX thread ID.
+ /** Indicates whether there is an associated POSIX thread ID. */
Bool posix_thread_exists;
- /// If true, indicates that there is a corresponding POSIX thread ID and
- /// a corresponding OS thread that is detached.
+ /**
+ * If true, indicates that there is a corresponding POSIX thread ID and
+ * a corresponding OS thread that is detached.
+ */
Bool detached_posix_thread;
- /// Wether recording of memory accesses is active.
+ /** Wether recording of memory accesses is active. */
Bool is_recording;
- /// Nesting level of synchronization functions called by the client.
+ /** Nesting level of synchronization functions called by the client. */
Int synchr_nesting;
} ThreadInfo;
-// Local variables of drd_thread.c that are declared here such that these
-// can be accessed by inline functions.
+/*
+ * Local variables of drd_thread.c that are declared here such that these
+ * can be accessed by inline functions.
+ */
-extern DrdThreadId s_drd_running_tid;
-extern ThreadInfo s_threadinfo[DRD_N_THREADS];
-extern struct bitmap* s_conflict_set;
+extern DrdThreadId DRD_(g_drd_running_tid);
+extern ThreadInfo DRD_(g_threadinfo)[DRD_N_THREADS];
+extern struct bitmap* DRD_(g_conflict_set);
-// Function declarations.
+/* Function declarations. */
void thread_trace_context_switches(const Bool t);
void thread_trace_conflict_set(const Bool t);
@@ -147,37 +151,39 @@
ULong thread_get_conflict_set_bitmap2_creation_count(void);
+/* Inline function definitions. */
+
static __inline__
Bool IsValidDrdThreadId(const DrdThreadId tid)
{
return (0 <= (int)tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID
- && ! (s_threadinfo[tid].vg_thread_exists == False
- && s_threadinfo[tid].posix_thread_exists == False
- && s_threadinfo[tid].detached_posix_thread == False));
+ && ! (DRD_(g_threadinfo)[tid].vg_thread_exists == False
+ && DRD_(g_threadinfo)[tid].posix_thread_exists == False
+ && DRD_(g_threadinfo)[tid].detached_posix_thread == False));
}
static __inline__
DrdThreadId thread_get_running_tid(void)
{
- tl_assert(s_drd_running_tid != DRD_INVALID_THREADID);
- return s_drd_running_tid;
+ tl_assert(DRD_(g_drd_running_tid) != DRD_INVALID_THREADID);
+ return DRD_(g_drd_running_tid);
}
static __inline__
struct bitmap* thread_get_conflict_set(void)
{
- return s_conflict_set;
+ return DRD_(g_conflict_set);
}
static __inline__
Bool running_thread_is_recording(void)
{
#ifdef ENABLE_DRD_CONSISTENCY_CHECKS
- tl_assert(0 <= (int)s_drd_running_tid && s_drd_running_tid < DRD_N_THREADS
- && s_drd_running_tid != DRD_INVALID_THREADID);
+ tl_assert(0 <= (int)DRD_(g_drd_running_tid) && DRD_(g_drd_running_tid) < DRD_N_THREADS
+ && DRD_(g_drd_running_tid) != DRD_INVALID_THREADID);
#endif
- return (s_threadinfo[s_drd_running_tid].synchr_nesting == 0
- && s_threadinfo[s_drd_running_tid].is_recording);
+ return (DRD_(g_threadinfo)[DRD_(g_drd_running_tid)].synchr_nesting == 0
+ && DRD_(g_threadinfo)[DRD_(g_drd_running_tid)].is_recording);
}
static __inline__
@@ -188,27 +194,28 @@
&& tid < DRD_N_THREADS
&& tid != DRD_INVALID_THREADID);
#endif
- s_threadinfo[tid].stack_min = stack_min;
+ DRD_(g_threadinfo)[tid].stack_min = stack_min;
#ifdef ENABLE_DRD_CONSISTENCY_CHECKS
/* This function can be called after the thread has been created but */
/* before drd_post_thread_create() has filled in stack_max. */
- tl_assert(s_threadinfo[tid].stack_min < s_threadinfo[tid].stack_max
- || s_threadinfo[tid].stack_max == 0);
+ tl_assert(DRD_(g_threadinfo)[tid].stack_min < DRD_(g_threadinfo)[tid].stack_max
+ || DRD_(g_threadinfo)[tid].stack_max == 0);
#endif
- if (UNLIKELY(stack_min < s_threadinfo[tid].stack_min_min))
+ if (UNLIKELY(stack_min < DRD_(g_threadinfo)[tid].stack_min_min))
{
- s_threadinfo[tid].stack_min_min = stack_min;
+ DRD_(g_threadinfo)[tid].stack_min_min = stack_min;
}
}
-/** Return true if and only if the specified address is on the stack of the
- * currently scheduled thread.
+/**
+ * Return true if and only if the specified address is on the stack of the
+ * currently scheduled thread.
*/
static __inline__
Bool thread_address_on_stack(const Addr a)
{
- return (s_threadinfo[s_drd_running_tid].stack_min <= a
- && a < s_threadinfo[s_drd_running_tid].stack_max);
+ return (DRD_(g_threadinfo)[DRD_(g_drd_running_tid)].stack_min <= a
+ && a < DRD_(g_threadinfo)[DRD_(g_drd_running_tid)].stack_max);
}
/** Return a pointer to the latest segment for the specified thread. */
@@ -218,16 +225,16 @@
#ifdef ENABLE_DRD_CONSISTENCY_CHECKS
tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
&& tid != DRD_INVALID_THREADID);
- tl_assert(s_threadinfo[tid].last);
+ tl_assert(DRD_(g_threadinfo)[tid].last);
#endif
- return s_threadinfo[tid].last;
+ return DRD_(g_threadinfo)[tid].last;
}
/** Return a pointer to the latest segment for the running thread. */
static __inline__
Segment* running_thread_get_segment(void)
{
- return thread_get_segment(s_drd_running_tid);
+ return thread_get_segment(DRD_(g_drd_running_tid));
}
#endif // __THREAD_H