To get execution trace of a program

To get execution trace of a program

Post by V. Ra » Sun, 30 Sep 2001 14:19:06



Greetings,
What is an easy way to get the execution trace for compiled code? This could
be as simple as inserting a "printf" statement at the beginning of each user
function & possibly a way to contain recursion. Is there a way to do this
using profiled code (gprof) or using a de*?

Thanks in advance,

 
 
 

To get execution trace of a program

Post by Ragnar Hojland Espino » Mon, 01 Oct 2001 21:27:23



> Greetings,
> What is an easy way to get the execution trace for compiled code? This could
> be as simple as inserting a "printf" statement at the beginning of each user
> function & possibly a way to contain recursion. Is there a way to do this
> using profiled code (gprof) or using a de*?

No, no easy way for compiled code.  The best you can use is ptrace(2),
or strace/truss and ltrace (1)

Ragnar H?jland      Freedom - Linux - OpenGL |    Brainbench MVP
PGP94C4B2F0D27DE025BE2302C104B78C56 B72F0822 | for Unix Programming
"Thou shalt not follow the NULL pointer for  |  www.brainbench.com
 chaos and madness await thee at its end."

 
 
 

1. Producing a trace of a program's execution?

I'm debugging a program under SVR4, and I'd like to be able to produce
an output file showing (at least) the functions calls (with
parameters) which were executed on a given run of the program, and
optionally a higher level of detail such as is produced by single
stepping using a debugger.  Can 'debug' or 'sdb' (or some other
debugger) do this?  I've read the docs and it seems that maybe I could
write a macro to do it, but I don't really know where to begin, not
being very experienced at using debug.  Is there some other tool
available which would do what I want - it seems such a useful thing to
have that someone must have wanted this before?

--
Steve Loft, Doncaster, UK.

2. laser printer for Linux - recommendations?

3. getting stack trace from inside program?

4. Help! compiling kernel

5. Problems calling a gdb stack trace from inside the program thats being traced.

6. admintool - database manager

7. whether the program execution efficiency will be affected if debug information is added into the program

8. Changing monitor type for CDE

9. To get execution trace ...

10. tracing csh execution to track down a "variable name too long error"

11. generating an execution trace using adb?

12. whether the program execution efficiency will be affected if debug information is added into the program

13. To get execution trace ...