|
From: Julian S. <js...@ac...> - 2003-12-24 01:51:18
|
> I've been trying to get a valgrind skin i'm tinkering with to get a > program to report whenever it calls or returns from a function. Simple as it sounds, this is a real swamp. For one thing, tail-calls from one function to another just look like plain Jmps, not JmpCall, and so you can't reliably use the mechanism you proposed. Similarly, there are 99 ways to return from a function (98 of them admittedly really stupid), such as popl %edx; jmp *%edx Josef Wiedendorfer is the real guru here as I think kcachegrind/calltree manages to track calls/returns. I'm sure he can elaborate. > Am I misunderstanding something about UCode or what? I'm sure this is a > solved problem, > since I imagine every single skin would depend on the behavior that I am > hoping for (one > call of the instrumentation code for every call/ret). Well, actually, no. As far as I know only calltree does this. For the most part skins like memcheck just see the client program moving values on/off the stack and jumping round the place, but have no concept of calls/returns happening. The stack backtraces you see in error messages are made by walking the stack when an error occurs, but nobody keeps track of when functions are entered/exited, basically because it's nearly impossible to do so reliably. Having said all that ... what is it you are trying to achieve with your skin? J |