From: Josef Weidendorfer Date: Thu, 21 Jul 2011 20:24:54 +0000 (+0000) Subject: Update ugly Callgrind hack for supporting instrumentation modes X-Git-Tag: svn/VALGRIND_3_7_0~331 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3bb3954eb5388058fa81738a4f44831902080dc2;p=thirdparty%2Fvalgrind.git Update ugly Callgrind hack for supporting instrumentation modes To support different instrumentation modes, callgrind calls VG_(discard_translations), which up to now does not belong to the functions allowed to call from tools, as this is unsafe if called from generated code. Callgrind hacks around that by defining the prototype itself. However, in r4789 (from Sep 27 2005!) a 3rd arg was added for debugging output. Thus, callgrind could crash if called with "-d -d". As the "instrumentation off" feature seems to be used quite often, it really would be nice to have VG_(discard_translations) callable from tools... git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11906 --- diff --git a/callgrind/main.c b/callgrind/main.c index 4670698957..00c076b7ab 100644 --- a/callgrind/main.c +++ b/callgrind/main.c @@ -1330,8 +1330,8 @@ void zero_state_cost(thread_info* t) CLG_(zero_cost)( CLG_(sets).full, CLG_(current_state).cost ); } -/* Ups, this can go wrong... */ -extern void VG_(discard_translations) ( Addr64 start, ULong range ); +/* Ups, this can go very wrong... */ +extern void VG_(discard_translations) ( Addr64 start, ULong range, HChar* who ); void CLG_(set_instrument_state)(Char* reason, Bool state) { @@ -1344,7 +1344,7 @@ void CLG_(set_instrument_state)(Char* reason, Bool state) CLG_DEBUG(2, "%s: Switching instrumentation %s ...\n", reason, state ? "ON" : "OFF"); - VG_(discard_translations)( (Addr64)0x1000, (ULong) ~0xfffl); + VG_(discard_translations)( (Addr64)0x1000, (ULong) ~0xfffl, "callgrind"); /* reset internal state: call stacks, simulator */ CLG_(forall_threads)(unwind_thread);