s_threadinfo[i].vg_thread_exists = True;
s_threadinfo[i].vg_threadid = tid;
s_threadinfo[i].pt_threadid = INVALID_POSIX_THREADID;
- s_threadinfo[i].stack_min_min = 0;
s_threadinfo[i].stack_min = 0;
s_threadinfo[i].stack_startup = 0;
s_threadinfo[i].stack_max = 0;
s_threadinfo[created].stack_max = VG_(thread_get_stack_max)(vg_created);
s_threadinfo[created].stack_startup = s_threadinfo[created].stack_max;
s_threadinfo[created].stack_min = s_threadinfo[created].stack_max;
- s_threadinfo[created].stack_min_min = s_threadinfo[created].stack_max;
tl_assert(s_threadinfo[created].stack_max != 0);
return created;
return s_threadinfo[tid].stack_min;
}
-void thread_set_stack_min(const DrdThreadId tid, const Addr stack_min)
-{
-#if 0
- VG_(message)(Vg_DebugMsg, "thread %d (%d) stack_min = 0x%x"
- " (size %d, max %d, delta %d)",
- s_threadinfo[tid].vg_threadid, tid,
- stack_min,
- s_threadinfo[tid].stack_max - stack_min,
- s_threadinfo[tid].stack_max - s_threadinfo[tid].stack_min_min,
- s_threadinfo[tid].stack_min - stack_min);
-#endif
- tl_assert(0 <= tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID);
- if (s_threadinfo[tid].stack_max)
- {
- s_threadinfo[tid].stack_min = stack_min;
- if (stack_min < s_threadinfo[tid].stack_min_min)
- {
- s_threadinfo[tid].stack_min_min = stack_min;
- }
- tl_assert(s_threadinfo[tid].stack_min_min
- <= s_threadinfo[tid].stack_min);
- tl_assert(s_threadinfo[tid].stack_min < s_threadinfo[tid].stack_max);
- }
-}
-
DrdThreadId thread_lookup_stackaddr(const Addr a,
Addr* const stack_min,
Addr* const stack_max)
s_threadinfo[tid].name[sizeof(s_threadinfo[tid].name) - 1] = 0;
}
-DrdThreadId thread_get_running_tid(void)
-{
- tl_assert(s_drd_running_tid != DRD_INVALID_THREADID);
- return s_drd_running_tid;
-}
-
void thread_set_vg_running_tid(const ThreadId vg_tid)
{
tl_assert(vg_tid != VG_INVALID_THREADID);
if (s_danger_set)
{
- bm_clear_all(s_danger_set);
- }
- else
- {
- s_danger_set = bm_new();
+ bm_delete(s_danger_set);
}
+ s_danger_set = bm_new();
if (s_trace_danger_set)
{
Segment* last;
ThreadId vg_threadid;
PThreadId pt_threadid;
- Addr stack_min_min;
Addr stack_min;
Addr stack_startup;
Addr stack_max;
void thread_finished(const DrdThreadId tid);
void thread_set_stack_startup(const DrdThreadId tid, const Addr stack_startup);
Addr thread_get_stack_min(const DrdThreadId tid);
-void thread_set_stack_min(const DrdThreadId tid, const Addr stack_min);
DrdThreadId thread_lookup_stackaddr(const Addr a,
Addr* const stack_min,
Addr* const stack_max);
void thread_set_name(const DrdThreadId tid, const char* const name);
void thread_set_name_fmt(const DrdThreadId tid, const char* const name,
const UWord arg);
-DrdThreadId thread_get_running_tid(void);
void thread_set_vg_running_tid(const ThreadId vg_tid);
void thread_set_running_tid(const ThreadId vg_tid,
const DrdThreadId drd_tid);
ULong thread_get_danger_set_bitmap2_creation_count(void);
-static
-inline struct bitmap* thread_get_danger_set(void)
+static inline
+DrdThreadId thread_get_running_tid(void)
+{
+ tl_assert(s_drd_running_tid != DRD_INVALID_THREADID);
+ return s_drd_running_tid;
+}
+
+static inline
+struct bitmap* thread_get_danger_set(void)
{
return s_danger_set;
}
&& s_threadinfo[s_drd_running_tid].is_recording);
}
+static inline
+void thread_set_stack_min(const DrdThreadId tid, const Addr stack_min)
+{
+#if 0
+ tl_assert(0 <= tid && tid < DRD_N_THREADS && tid != DRD_INVALID_THREADID);
+#endif
+ if (s_threadinfo[tid].stack_max)
+ {
+ s_threadinfo[tid].stack_min = stack_min;
+#if 0
+ tl_assert(s_threadinfo[tid].stack_min < s_threadinfo[tid].stack_max);
+#endif
+ }
+}
+
/** Return a pointer to the latest segment for the specified thread. */
static inline
Segment* thread_get_segment(const DrdThreadId tid)