[Lula] recommendations on code tracing tools
Christopher Smith
x at xman.org
Sat Apr 29 13:08:54 EDT 2006
al at danial.org wrote:
>I've got a huge package of source code I'm trying to understand.
>Say the source code to Perl.
>
>What I want to be able to do is see the name of each function
>as execution enters and leaves that function, in other words,
>the dynamic call graph of the functions in that package. The
>output might look like
> entering main
> entering init
> entering populate_X
> leaving populate_X
> entering populate_Y
> entering set_y1
> leaving set_y1
> leaving populate_Y
> leaving init
> :
> leaving main
>
>I know I can use gdb to step through the code but that would
>take forever, especially for all the different inputs I plan to
>give the executable. Can gdb be scripted to print function
>entries/exits automatically?
>
>Also I'm familiar with etrace (http://ndevilla.free.fr/etrace/) which
>would be great if it actually worked--but it doesn't (frequently
>hangs on executables produced by GCC v4).
>
>Can anyone recommend a function tracing tool? Ideally the tool
>would be capable of working with externally called libraries
>too. -- Al
>
>
So, for static tracing I recommend GNU's Cflow:
http://www.gnu.org/software/cflow/
For dynamic tracing, as Steve mentioned, DTrace would be nice, but you
need to run Solaris to take advantage of it. One trick we had
demonstrated at SCALE this year was being able to use DTrace while
running a Linux program in emulation inside Solaris (pretty amazing
stuff really). So you could download Solaris, setup a Linux emulation
environment inside Solaris, and then do your tracing there. You can
*sort* of use the output from gprof for this, or if you can't recompile
(i.e. using externally called libraries) use oprofile, but the output
probably won't be quite what you want (the data is probably there to get
the data you want, but I suspect that's non-trivial).
--Chris
_______________________________________________
Lula mailing list
Lula at lula.org
http://www.lula.org/mailman/listinfo/lula
More information about the Lula
mailing list