diff -u -r ./ORIGINAL/drd/drd_main.c drd/drd_main.c --- ./ORIGINAL/drd/drd_main.c 2006-08-14 16:43:23.000000000 +0100 +++ drd/drd_main.c 2006-08-22 03:08:58.000000000 +0100 @@ -327,20 +327,35 @@ { IRDirty* d = st->Ist.Dirty.details; IREffect const mFx = d->mFx; - if (mFx != Ifx_None) - { - VG_(message)(Vg_UserMsg, - "Encountered Ist_Dirty with effect %s addr %p size %d", - mFx == Ifx_None ? "-" - : mFx == Ifx_Read ? "R" - : mFx == Ifx_Write ? "W" - : mFx == Ifx_Modify ? "RW" - : "?", - d->mAddr, - d->mSize); + switch (mFx) { + case Ifx_None: + break; + case Ifx_Read: + case Ifx_Write: + case Ifx_Modify: + tl_assert(d->mAddr); + tl_assert(d->mSize > 0); + argv = mkIRExprVec_2(d->mAddr, mkIRExpr_HWord(d->mSize)); + if (mFx == Ifx_Read || mFx == Ifx_Modify) { + di = unsafeIRDirty_0_N( + /*regparms*/2, + "drd_trace_load", + VG_(fnptr_to_fnentry)(drd_trace_load), + argv); + addStmtToIRBB(bb, IRStmt_Dirty(di)); + } + if (mFx == Ifx_Write || mFx == Ifx_Modify) { + di = unsafeIRDirty_0_N( + /*regparms*/2, + "drd_trace_store", + VG_(fnptr_to_fnentry)(drd_trace_store), + argv); + addStmtToIRBB(bb, IRStmt_Dirty(di)); + } + break; + default: + tl_assert(0); } - // To do: implement handling of Ist_Dirty. - tl_assert(mFx == Ifx_None); } addStmtToIRBB(bb, st); break; Only in drd: drd_main.c~ Only in drd: drd_malloc_wrappers.c~ diff -u -r ./ORIGINAL/drd/drd_thread.c drd/drd_thread.c --- ./ORIGINAL/drd/drd_thread.c 2006-08-14 15:46:26.000000000 +0100 +++ drd/drd_thread.c 2006-08-25 22:51:53.000000000 +0100 @@ -48,6 +48,25 @@ struct segment* last; } ThreadInfo; +static Bool sane_ThreadInfo ( ThreadInfo* ti ) +{ + Int n_fwd = 0, n_bwd = 0; + struct segment* p; + for (p = ti->first; p; p = p->next) { + if (p->next && p->next->prev != p) + return False; + n_fwd ++; + } + for (p = ti->last; p; p = p->prev) { + if (p->prev && p->prev->next != p) + return False; + n_bwd ++; + } + if (n_fwd != n_bwd) + return False; + return True; +} + // Local variables. @@ -108,11 +127,15 @@ static void thread_append_segment(ThreadId const threadid, struct segment* const sg) { + tl_assert(sane_ThreadInfo( &s_threadinfo[threadid] )); sg->prev = s_threadinfo[threadid].last; sg->next = 0; s_threadinfo[threadid].last = sg; if (s_threadinfo[threadid].first == 0) s_threadinfo[threadid].first = sg; + if (sg->prev != 0) + sg->prev->next = sg; + tl_assert(sane_ThreadInfo( &s_threadinfo[threadid] )); } /** @@ -122,6 +145,7 @@ static void thread_discard_segment(ThreadId const threadid, struct segment* const sg) { + tl_assert(sane_ThreadInfo( &s_threadinfo[threadid] )); if (sg->prev) sg->prev->next = sg->next; if (sg->next) @@ -131,6 +155,7 @@ if (sg == s_threadinfo[threadid].last) s_threadinfo[threadid].last = sg->prev; sg_delete(sg); + tl_assert(sane_ThreadInfo( &s_threadinfo[threadid] )); } struct vectorclock* thread_get_vc(ThreadId const threadid) @@ -232,7 +257,7 @@ sg && (sg_next = sg->next) && vc_lte(&sg->vc, &thread_vc_min); sg = sg_next) { -#if 1 +#if 0 VG_(printf)("Discarding a segment of thread %d: ", i); vc_print(&sg->vc); VG_(printf)("\n");