|
From: <sv...@va...> - 2006-09-12 19:10:15
|
Author: weidendo
Date: 2006-09-12 20:10:08 +0100 (Tue, 12 Sep 2006)
New Revision: 6053
Log:
Callgrind: fix segfault when dumping after toggling instrumentation mode
This bug shows up when callgrind dumps data of a BB with 0 instructions
(the segfault only appears on x86_64; for x86 we were "lucky").
"BB with 0 instructions" happens when you switch on instrumentation
(and callgrinds call graph tracing starts with an emtpy shadow call
stack) in the middle of a run: Whenever the shadow callstack
is empty, but callgrind sees a return instruction (ie. a shadow
callstack underrun), it creates an artifical BB which is faked to
have called the function we are returning from.
This way, the call arc is noted and will appear in the dump.
Modified:
trunk/callgrind/global.h
Modified: trunk/callgrind/global.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/callgrind/global.h 2006-09-11 20:34:36 UTC (rev 6052)
+++ trunk/callgrind/global.h 2006-09-12 19:10:08 UTC (rev 6053)
@@ -688,7 +688,8 @@
static __inline__ Addr bb_addr(BB* bb)
{ return bb->offset + bb->obj->offset; }
static __inline__ Addr bb_jmpaddr(BB* bb)
- { return bb->instr[bb->instr_count-1].instr_offset + bb->offset + bb->o=
bj->offset; }
+ { UInt off =3D (bb->instr_count > 0) ? bb->instr[bb->instr_count-1].ins=
tr_offset : 0;
+ return off + bb->offset + bb->obj->offset; }
=20
/* from fn.c */
void CLG_(init_fn_array)(fn_array*);
|