|
From: Josef W. <Jos...@gm...> - 2003-12-31 02:14:03
|
Hi, (hope you all had a nice XMas :-) Am Mittwoch, 24. Dezember 2003 03:45 schrieb Nicholas Seow: > > Josef Wiedendorfer is the real guru here as I think kcachegrind/calltree > > manages to track calls/returns. I'm sure he can elaborate. > > Ah. He's the one who originally suggested to me that it might be a linkage > gotcha. I'd been digging through the calltree code to try and find out how > it deals with this, but I've had little success groking it so far. Hmm, I should clean up and comment the code... You are using VG_(get_fnname_if_entry)() only for the first instruction of every basic block. I'm not quite sure this is always correct. Does it work if you check at every instruction? As Julian said, function calls are sometimes done by JMP or PUSH/RET (runtime linker), and there are setjmp/longjmp and C++ exceptions, unwinding multiple stack frames with a ESP write. Besides, I'm sure there are functions with multiple entry points. In calltree, I unconditionally need a call to a helper function at start of every basic block, and so I am doing a lot of things dynamically which perhaps could be done once at instrumentation time. This isn't the best solution efficiency-wise, but fairly robust. To locate the multiple "CALL from a", it can help to print instruction addresses and compare with the disassembled code, and use --tracegen=10100. > I've had a go at using dyninst for this (www.dyninst.org), but it's very > experimental and we had limited success getting it to compile and run on > our various systems (Various versions of Redhat and Debian). Doesn't have dyninst the same problems as it is manipulating instructions directly, too? Cheers, Josef |