|
From: <sv...@va...> - 2010-09-02 14:43:26
|
Author: bart
Date: 2010-09-02 15:43:18 +0100 (Thu, 02 Sep 2010)
New Revision: 11326
Log:
Added the per-thread property 'on_alt_stack'.
Modified:
trunk/drd/drd_thread.c
trunk/drd/drd_thread.h
Modified: trunk/drd/drd_thread.c
===================================================================
--- trunk/drd/drd_thread.c 2010-09-02 14:41:05 UTC (rev 11325)
+++ trunk/drd/drd_thread.c 2010-09-02 14:43:18 UTC (rev 11326)
@@ -181,6 +181,7 @@
DRD_(g_threadinfo)[i].stack_startup = 0;
DRD_(g_threadinfo)[i].stack_max = 0;
DRD_(thread_set_name)(i, "");
+ DRD_(g_threadinfo)[i].on_alt_stack = False;
DRD_(g_threadinfo)[i].is_recording_loads = True;
DRD_(g_threadinfo)[i].is_recording_stores = True;
DRD_(g_threadinfo)[i].pthread_create_nesting_level = 0;
@@ -420,6 +421,31 @@
return DRD_(g_threadinfo)[tid].stack_size;
}
+Bool DRD_(thread_get_on_alt_stack)(const DrdThreadId tid)
+{
+ tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
+ && tid != DRD_INVALID_THREADID);
+ return DRD_(g_threadinfo)[tid].on_alt_stack;
+}
+
+void DRD_(thread_set_on_alt_stack)(const DrdThreadId tid,
+ const Bool on_alt_stack)
+{
+ tl_assert(0 <= (int)tid && tid < DRD_N_THREADS
+ && tid != DRD_INVALID_THREADID);
+ tl_assert(on_alt_stack == !!on_alt_stack);
+ DRD_(g_threadinfo)[tid].on_alt_stack = on_alt_stack;
+}
+
+Int DRD_(thread_get_threads_on_alt_stack)(void)
+{
+ int i, n = 0;
+
+ for (i = 1; i < DRD_N_THREADS; i++)
+ n += DRD_(g_threadinfo)[i].on_alt_stack;
+ return n;
+}
+
/**
* Clean up thread-specific data structures. Call this just after
* pthread_join().
Modified: trunk/drd/drd_thread.h
===================================================================
--- trunk/drd/drd_thread.h 2010-09-02 14:41:05 UTC (rev 11325)
+++ trunk/drd/drd_thread.h 2010-09-02 14:43:18 UTC (rev 11326)
@@ -77,6 +77,7 @@
Addr stack_max; /**< Top of stack. */
SizeT stack_size; /**< Maximum size of stack. */
char name[64]; /**< User-assigned thread name. */
+ Bool on_alt_stack;
/** Indicates whether the Valgrind core knows about this thread. */
Bool vg_thread_exists;
/** Indicates whether there is an associated POSIX thread ID. */
@@ -142,6 +143,10 @@
Addr DRD_(thread_get_stack_min_min)(const DrdThreadId tid);
Addr DRD_(thread_get_stack_max)(const DrdThreadId tid);
SizeT DRD_(thread_get_stack_size)(const DrdThreadId tid);
+Bool DRD_(thread_get_on_alt_stack)(const DrdThreadId tid);
+void DRD_(thread_set_on_alt_stack)(const DrdThreadId tid,
+ const Bool on_alt_stack);
+Int DRD_(thread_get_threads_on_alt_stack)(void);
void DRD_(thread_set_pthreadid)(const DrdThreadId tid, const PThreadId ptid);
Bool DRD_(thread_get_joinable)(const DrdThreadId tid);
void DRD_(thread_set_joinable)(const DrdThreadId tid, const Bool joinable);
|