{ Addr* seg_starts;
Int n_seg_starts;
+ /* Mark the main thread as running while we tell the tool about
+ the client memory so that the tool can associate that memory
+ with the main thread. */
+ tl_assert(VG_(running_tid) == VG_INVALID_THREADID);
+ VG_(running_tid) = tid_main;
+
seg_starts = get_seg_starts( &n_seg_starts );
vg_assert(seg_starts && n_seg_starts >= 0);
False, /* readable? */
False, /* writable? */
True /* executable? */ );
+
+ /* Clear the running thread indicator */
+ VG_(running_tid) = VG_INVALID_THREADID;
+ tl_assert(VG_(running_tid) == VG_INVALID_THREADID);
}
//--------------------------------------------------------------
const DrdThreadId drd_creator = VgThreadIdToDrdThreadId(creator);
tl_assert(created != VG_INVALID_THREADID);
thread_pre_create(drd_creator, created);
-#if 1
- // Hack: compensation for code missing in coregrind/m_main.c.
- if (created == 1)
- {
- thread_set_running_tid(1, 1);
- }
-#endif
if (IsValidDrdThreadId(drd_creator))
{
thread_new_segment(drd_creator);
DrdThreadId thread_get_running_tid(void)
{
- // HACK. To do: remove the if-statement and keep the assert.
- if (VG_(get_running_tid)() != VG_INVALID_THREADID)
- tl_assert(VG_(get_running_tid)() == s_vg_running_tid);
+ tl_assert(VG_(get_running_tid)() == s_vg_running_tid);
tl_assert(s_drd_running_tid != DRD_INVALID_THREADID);
return s_drd_running_tid;
}
void thread_set_vg_running_tid(const ThreadId vg_tid)
{
- // HACK. To do: uncomment the line below.
- // tl_assert(vg_tid != VG_INVALID_THREADID);
+ tl_assert(vg_tid != VG_INVALID_THREADID);
if (vg_tid != s_vg_running_tid)
{
void thread_set_running_tid(const ThreadId vg_tid, const DrdThreadId drd_tid)
{
- // HACK. To do: remove the next two lines.
- if (vg_tid == VG_INVALID_THREADID)
- return;
-
tl_assert(vg_tid != VG_INVALID_THREADID);
tl_assert(drd_tid != DRD_INVALID_THREADID);