On 03/20/08 15:19, Harvey Richardson wrote:
> Aleksandar Donev wrote:
>> Hi,
>> I am wondering if someone knows of a debugging-type tool where one can
>> run a program and can then periodically (at my choice) see where the
>> program currently is, i.e., what procedure is currently executing? The
>> important thing is to be able to choose when to see the execution
>> trace at will, instead of tracing every procedure call.
>
> Solaris has pstack.
>
> I can see references to a couple of Linux ports of this.
>
> You can grab with gdb/dbx and do where but in my experience the
> process might not continue when you let go of it.
Also, I'm not sure what Aleksandar means by "at will".
In gdb (and most debuggers), you can trigger a breakpoint based on a condition; for example, the value of some variable, or the return value of a function call, or the N'th visit to the line of code where the breakpoint was set.
You could even write a function to check for the existence of a file and then (based on the return value of the function) break only when the file is present. So if "at will" really means "whenever you feel like it", you could create the file whenever you feel like it and the program will break the next time it reaches the breakpoint.
-P.
|