gdb supports SDT probes in the code. SDT stands for Statically Defined Tracing, and the probes are designed to have a tiny runtime code and data footprint, and no dynamic relocations. They are usable from assembly, C and C++ languages. See http://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation for a good reference on how the SDT probes are implemented.
Currently, SystemTap
(http://sourceware.org/systemtap/)
SDT probes are supported on ELF-compatible systems. See
http://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps
for more information on how to add SystemTap
SDT probes
in your applications.
Some probes have an associated semaphore variable; for instance, this
happens automatically if you defined your probe using a DTrace-style
.d file. If your probe has a semaphore, gdb will
automatically enable it when you specify a breakpoint using the
‘-probe-stap’ notation. But, if you put a breakpoint at a probe's
location by some other method (e.g., break file:line
), then
gdb will not automatically set the semaphore.
You can examine the available static static probes using info
probes
, with optional arguments:
info probes stap
[provider [name [objfile]]]If given, name is a regular expression to match against probe names when selecting which probes to list. If omitted, probe names are not considered when deciding whether to display them.
If given, objfile is a regular expression used to select which
object files (executable or shared libraries) to examine. If not
given, all object files are considered.
info probes all
A probe may specify up to twelve arguments. These are available at the
point at which the probe is defined—that is, when the current PC is
at the probe's location. The arguments are available using the
convenience variables (see Convenience Vars)
$_probe_arg0
...$_probe_arg11
. Each probe argument is
an integer of the appropriate size; types are not preserved. The
convenience variable $_probe_argc
holds the number of arguments
at the current probe point.
These variables are always available, but attempts to access them at any location other than a probe point will cause gdb to give an error message.