manpagez: man pages & more
info gdb
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10.1.1 Create and Delete Tracepoints


The trace command is very similar to the break command. Its argument can be a source line, a function name, or an address in the target program. See section Setting Breakpoints. The trace command defines a tracepoint, which is a point in the target program where the debugger will briefly stop, collect some data, and then allow the program to continue. Setting a tracepoint or changing its commands doesn't take effect until the next tstart command; thus, you cannot change the tracepoint attributes once a trace experiment is running.

Here are some examples of using the trace command:

(No value for GDBP) trace foo.c:121    // a source file and line number

(No value for GDBP) trace +2           // 2 lines forward

(No value for GDBP) trace my_function  // first source line of function

(No value for GDBP) trace *my_function // EXACT start address of function

(No value for GDBP) trace *0x2117c4    // an address

You can abbreviate trace as tr.

The convenience variable $tpnum records the tracepoint number of the most recently set tracepoint.

delete tracepoint [num]

Permanently delete one or more tracepoints. With no argument, the default is to delete all tracepoints.


(No value for GDBP) delete trace 1 2 3 // remove three tracepoints

(No value for GDBP) delete trace       // remove all tracepoints

You can abbreviate this command as del tr.

© 2000-2021
Individual documents may contain additional copyright information.