]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Update ugly Callgrind hack for supporting instrumentation modes
authorJosef Weidendorfer <Josef.Weidendorfer@gmx.de>
Thu, 21 Jul 2011 20:24:54 +0000 (20:24 +0000)
committerJosef Weidendorfer <Josef.Weidendorfer@gmx.de>
Thu, 21 Jul 2011 20:24:54 +0000 (20:24 +0000)
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

callgrind/main.c

index 4670698957a68c2b57820ac659db685efda4d437..00c076b7abe216bf8c00f02d5413b23b9f158aad 100644 (file)
@@ -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);