s_threadinfo[i].vg_threadid = tid;
s_threadinfo[i].pt_threadid = INVALID_POSIX_THREADID;
s_threadinfo[i].stack_min = 0;
+ s_threadinfo[i].stack_min_min = 0;
s_threadinfo[i].stack_startup = 0;
s_threadinfo[i].stack_max = 0;
s_threadinfo[i].is_recording = True;
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;
+ s_threadinfo[created].stack_size = VG_(thread_get_stack_size)(vg_created);
tl_assert(s_threadinfo[created].stack_max != 0);
return created;
return s_threadinfo[tid].stack_min;
}
+Addr thread_get_stack_min_min(const DrdThreadId tid)
+{
+ tl_assert(0 <= tid && tid < DRD_N_THREADS
+ && tid != DRD_INVALID_THREADID);
+ return s_threadinfo[tid].stack_min_min;
+}
+
Addr thread_get_stack_max(const DrdThreadId tid)
{
tl_assert(0 <= tid && tid < DRD_N_THREADS
return s_threadinfo[tid].stack_max;
}
+SizeT thread_get_stack_size(const DrdThreadId tid)
+{
+ tl_assert(0 <= tid && tid < DRD_N_THREADS
+ && tid != DRD_INVALID_THREADID);
+ return s_threadinfo[tid].stack_size;
+}
+
/** Clean up thread-specific data structures. Call this just after
* pthread_join().
*/
Segment* last;
ThreadId vg_threadid;
PThreadId pt_threadid;
- Addr stack_min;
- Addr stack_startup;
- Addr stack_max;
+ 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.
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);
+Addr thread_get_stack_min_min(const DrdThreadId tid);
Addr thread_get_stack_max(const DrdThreadId tid);
+SizeT thread_get_stack_size(const DrdThreadId tid);
void thread_set_pthreadid(const DrdThreadId tid, const PThreadId ptid);
Bool thread_get_joinable(const DrdThreadId tid);
void thread_set_joinable(const DrdThreadId tid, const Bool joinable);
#if 0
tl_assert(s_threadinfo[tid].stack_min < s_threadinfo[tid].stack_max);
#endif
+ if (UNLIKELY(stack_min < s_threadinfo[tid].stack_min_min))
+ {
+ s_threadinfo[tid].stack_min_min = stack_min;
+ }
}
}