|
From: Julian S. <js...@ac...> - 2006-09-11 09:54:56
|
Merge to 3.2.1 ? J On Sunday 10 September 2006 23:34, sv...@va... wrote: > Author: weidendo > Date: 2006-09-10 23:34:20 +0100 (Sun, 10 Sep 2006) > New Revision: 6045 > > Log: > Callgrind: Fix failed assertion at toggling instrumentation mode > > When instrumentation mode is switched off, we want to fully > reset callgrinds internal execution state, which includes > the shadow call stack and function stack for context generation. > The latter was not completely reset before. > > The bug showed up when switching the instrumentation mode on for > the second time, leading to > Callgrind: callstack.c:211 (vgCallgrind_push_call_stack): > Assertion 'current_entry->cxt != 0' failed. > > This commit also improves debug output a little bit. > > Modified: > trunk/callgrind/bb.c > trunk/callgrind/context.c > trunk/callgrind/main.c > > > Modified: trunk/callgrind/bb.c > =================================================================== > --- trunk/callgrind/bb.c 2006-08-31 22:54:36 UTC (rev 6044) > +++ trunk/callgrind/bb.c 2006-09-10 22:34:20 UTC (rev 6045) > @@ -306,7 +306,10 @@ > CLG_DEBUG(3, " delete_bb (Obj %s, off %p): NOT FOUND\n", > obj->name, offset); > > - /* we didn't find it. That's strange. */ > + /* we didn't find it. > + * this happens when callgrinds instrumentation mode > + * was off at BB translation time, ie. no BB was created. > + */ > return; > } > > @@ -334,6 +337,7 @@ > + (bb->cjmp_count+1) * sizeof(CJmpInfo); > VG_(memset)( bb, 0xAA, size ); > CLG_FREE(bb); > + return; > } > CLG_DEBUG(3, " delete_bb: BB in use, can not free!\n"); > } > > Modified: trunk/callgrind/context.c > =================================================================== > --- trunk/callgrind/context.c 2006-08-31 22:54:36 UTC (rev 6044) > +++ trunk/callgrind/context.c 2006-09-10 22:34:20 UTC (rev 6045) > @@ -279,6 +279,11 @@ > call_stack* cs = &CLG_(current_call_stack); > Int fn_entries; > > + CLG_DEBUG(5, "+ push_cxt(fn '%s'): old ctx %d\n", > + fn ? fn->name : (Char*)"0x0", > + CLG_(current_state).cxt ? > + CLG_(current_state).cxt->base_number : -1); > + > /* save old context on stack (even if not changed at all!) */ > CLG_ASSERT(cs->sp < cs->size); > CLG_ASSERT(cs->entry[cs->sp].cxt == 0); > @@ -321,8 +326,10 @@ > *(CLG_(current_fn_stack).top) = fn; > CLG_(current_state).cxt = CLG_(get_cxt)(CLG_(current_fn_stack).top); > > - CLG_DEBUG(5, " push_cxt(fn '%s'): %d\n", > - fn ? fn->name : (Char*)"0x0", > - CLG_(current_fn_stack).top - CLG_(current_fn_stack).bottom); > + CLG_DEBUG(5, "- push_cxt(fn '%s'): new cxt %d, fn_sp %d\n", > + fn ? fn->name : (Char*)"0x0", > + CLG_(current_state).cxt ? > + CLG_(current_state).cxt->base_number : -1, > + CLG_(current_fn_stack).top - CLG_(current_fn_stack).bottom); > } > > > Modified: trunk/callgrind/main.c > =================================================================== > --- trunk/callgrind/main.c 2006-08-31 22:54:36 UTC (rev 6044) > +++ trunk/callgrind/main.c 2006-09-10 22:34:20 UTC (rev 6045) > @@ -771,6 +771,10 @@ > /* unwind regular call stack */ > while(CLG_(current_call_stack).sp>0) > CLG_(pop_call_stack)(); > + > + /* reset context and function stack for context generation */ > + CLG_(init_exec_state)( &CLG_(current_state) ); > + CLG_(current_fn_stack).top = CLG_(current_fn_stack).bottom; > } > > /* Ups, this can go wrong... */ > @@ -795,11 +799,8 @@ > if (0) > CLG_(forall_threads)(zero_thread_cost); > > - if (!state) > - CLG_(init_exec_state)( &CLG_(current_state) ); > - > if (VG_(clo_verbosity) > 1) > - VG_(message)(Vg_DebugMsg, "%s: instrumentation switched %s\n", > + VG_(message)(Vg_DebugMsg, "%s: instrumentation switched %s", > reason, state ? "ON" : "OFF"); > } > > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Valgrind-developers mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-developers |