This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C programs introspection using binutils/gdb


Hello everybody,

I'm currently trying to perform very fine-grained benchmarks on a C
application. Like, saving the values of a variable every time it
changes, or following a chained-list of pointers when some event occurs
in the program. For (good) design reasons I don't want to add special
code to the program's source. In short, what I'd like to achieve is
introspection of C programs without anything else than debugging
symbols, and defining behaviors the monitoring program should adopt when
some even occurs.

As a concrete exemple, let's say I'd like to produce a gnuplot graph
with the time in abscissa and the value of a variable in ordinate. The
time and values would be saved into an array every time the variable
changes.

I've considered using gdb for this. I don't know much about it but it
looks like it is easy to associate a gdb function to an event (i.e.
"scripting" gdb instead of using it in interactive mode). Also, the
great advantage of gdb is that it can catch any kind of event and let
the user see directly through the C structures.

I wonder however if this is the best solution for that purpose, and if I
haven't overestimated gdb scripting capabilities in that respect. Or
maybe there is another tool that allows similar results (I've thought of
gprof but it seems much less controllable than gdb). I'd also be
interested in hearing people who attempted similar experiences (can't
find anything similar after a good google search).

Thank you for your comments and advices,
Alex.
--
Alexandre Courbot - PhD student
RD2P/LIFL
http://www.lifl.fr/~courbot


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]