Using gdb as a trace agent

Alexandre Courbot Alexandre.Courbot@lifl.fr
Mon May 17 22:17:00 GMT 2004


> Yep.  Here's why it's only been implemented remotely:

Is it possible to use tracepoints remotely as of today? I mean, the code 
seems to be here in GDB, but is there a target that supports them?

Say I have 2 computers running GNU/Linux and a network connection 
between them. Can I then use tracepoints to analyze my program as of today?

> So for native configurations, the challenge is to find a low-overhead
> way to handle those traps.  For example, one could add tracepoint
> support to gdbserver, but then you'd have one process collecting data
> from another process via ptrace or some other system call, and it
> wouldn't be very lightweight.

If gdbserver is running on a different host than gdb, then I guess the 
overhead would be comparable to any other system, right? (just a 
question, I'm just a regular gdb user for now). So maybe the first thing 
to do would be to add tracepoint support to gdbserver, since you seem to 
say it's missing.

On a completely local configuration, the problem is different indeed. 
Maybe if you can evaluate the amount of data to be collected, you can 
reserve a large enough area of memory that would receive all the traced 
datas, without any expression evaluation during collection. Evaluation 
would occur during data examination, so the program gets disturbed as 
less as possible while running. Problem: make sure memory doesn't blow 
up and avoid allocations while debugging. These two reasons are probably 
what makes tracepoints implementation easier on a distributed architecture.

Well, these are just random ideas. As I said, I don't have a clear idea 
yet of gdb's internals.

I'm very interested in that anyway. We need here to be able to evaluate 
our OSes in an easy, non-intrusive and efficient way. GDB has proven it 
was great even for non-debugging purposes (for instance, introspecting a 
program and get some datas out of it to be exploited by gnuplot), with 
tracepoints it would be just *fine*. Oh, and file IOs to write the 
collected datas into files without debuggee and GDB output with them. ;)

Just saw that there has been some discussion about this subject recently:

http://sources.redhat.com/ml/gdb/2004-01/msg00012.html

Seems the ideas were nearly the same. Did it give some results (i.e. code)?

Alex.

-- 
Alexandre Courbot - PhD student
RD2P/LIFL
http://www.lifl.fr/~courbot



More information about the Gdb mailing list