This fixeds bug 150606.
When switching on instrumentation, the current function got the
wrong (too large) inclusive cost when instrumentation ever was on before.
The reason was that the global (ever increasing) event counters where
not reset on toggling instrumentation state. The global counters
are used to calculate inclusive cost of a function by getting the
difference of the global counters at leaving minus their value at
enter time. When leaving a function which was not encountered
to be entered before (a stack underrun of the shadow stack), it is
assumed that this function was entered with instrumentation switched
off. Then, the absolute value of global counters is used to calculate
the inclusive cost. Thus, these global counters have to be zeroed
at instrumentation change to allow for senseable inclusive costs
of functions which were not observed to be entered.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10386
es->jmps_passed = 0;
es->bbcc = 0;
es->nonskipped = 0;
+ CLG_(init_cost)( CLG_(sets).full, es->cost );
}
/* allocate real cost space: needed as incremented by
* simulation functions */
es->cost = CLG_(get_eventset_cost)(CLG_(sets).full);
- CLG_(init_cost)( CLG_(sets).full, es->cost );
CLG_(init_exec_state)(es);
es->sig = sigNum;