babeltrace2-filter.lttng-utils.debug-info — Babeltrace 2's debugging information filter component class for LTTng traces
A Babeltrace 2 filter.lttng-utils.debug-info message iterator creates and emits copies of upstream messages, augmenting LTTng event messages with debugging information when it’s available and possible.
Messages without debugging information | | +----------------------------+ | | flt.lttng-utils.debug-info | | | | '->@ in out @--> Messages with +----------------------------+ debugging information
See babeltrace2-intro(7) to learn more about the Babeltrace 2 project and its core concepts.
A filter.lttng-utils.debug-info message iterator uses the LTTng state dump events as well as
the event common context’s
ip (instruction pointer) and
(process ID) fields to locate and read the corresponding debugging
information. The message iterator can find the extra debugging
information in an executable file or in a directory containing debugging
information which the compiler creates.
The new LTTng events (copies of the original ones with added debugging
information) contain, when possible, a new event common context’s
structure field (besides the
ip field) named
default (you can use the
debug-info-field-name parameter to choose
another name). This structure field contains the following fields:
Executable path or name followed with
ADDRis the address (hexadecimal) where it was loaded while being traced.
ADDRis an absolute address, and
ADDRis a relative address.
Function name followed with
OFFSETis the offset (hexadecimal) from the beginning of the function symbol in the executable file.
Source file path or name followed with
LINEis the line number in this source file at which the event occured.
Any of the previous fields can be an empty string if the debugging information was not available for the analyzed original LTTng event.
A filter.lttng-utils.debug-info message iterator systematically copies the upstream messages, but it only augments compatible LTTng event classes. This means that the message iterator copies messages of non-LTTng trace (see LTTng prerequisites) without alteration.
With GCC or Clang, you need to compile the program or library source
files in debug mode with the
-g option. This option makes the
compiler generate debugging information in the operating system’s native
format. This format is recognized by a filter.lttng-utils.debug-info component: it can
translate the instruction pointer field of an event’s common context to
a source file and line number, along with the name of the surrounding
ImportantThis component class only supports the debugging information
in DWARF format, version 2 or later. Use the
VERSION is the DWARF version) compiler
options to explicitly generate DWARF debugging information.
If you don’t compile the executable’s source files with the
option or with an equivalent option, no DWARF information is available:
the message iterator uses ELF symbols from the executable file instead.
In this case, the events that the message iterator creates do not
contain the source file and line number (see the
src field), but only the name of the nearest function symbol with an
offset in bytes to the location in the executable from which the LTTng
event occured (see the
If the executable file has neither ELF symbols nor DWARF information, the filter.lttng-utils.debug-info message iterator cannot map the event to its source location: the message iterator still copies the upstream messages but without altering them.
A filter.lttng-utils.debug-info message iterator can only analyze user space events which LTTng 2.8.0 or later generates.
To get debugging information for LTTng-UST events which occur in executables and libraries which the system’s loader loads (what you can see with ldd(1)):
vpidcontext fields to user space event records:
$ lttng add-context --userspace --type=ip --type=vpid
See lttng-add-context(1) for more details.
Enable the LTTng-UST state dump events:
$ lttng enable-event --userspace 'lttng_ust_statedump:*'
To get debugging information for LTTng-UST events which occur in dynamically loaded objects, for example plugins:
Do the previous steps (add context fields and enable the LTTng-UST state dump events).
Enable the LTTng-UST dynamic linker tracing helper events:
$ lttng enable-event --userspace 'lttng_ust_dl:*'
See lttng-ust-dl(3) for more details.
When you are ready to trace, start your application with the
LD_PRELOADenvironment variable set to
$ LD_PRELOAD=liblttng-ust-dl.so my-app
You can store DWARF debugging information outside the executable itself, whether it is to reduce the executable’s file size or simply to facilitate sharing the debugging information.
This is usually achieved via one of two mechanisms, namely build ID and debug link. Their use and operation is described in the Debugging Information in Separate Files section of GDB’s documentation.
A filter.lttng-utils.debug-info message iterator can find separate debugging information files automatically, as long as they meet the requirements stated in this manual page.
The debugging information lookup order is the same as GDB’s, namely:
Within the executable file itself.
Through the build ID method in the
In the various possible debug link locations.
The message iterator uses the first debugging information file that it finds.
You can use the
debug-info-dir initialization parameter to
override the default
/usr/lib/debug directory used in the build ID and
debug link methods.
NoteIt is currently not possible to make this component search for debugging information in multiple directories.
The debugging information analysis that a filter.lttng-utils.debug-info message iterator performs uses the paths to the executables as collected during tracing as the default mechanism to resolve DWARF and ELF information.
If the trace was recorded on a separate machine, however, you can use
target-prefix parameter to specify a prefix directory, that
is, the root of the target file system.
For example, if an instrumented executable’s path is
the target system, you can place this file at
/home/user/target/usr/bin/foo on the system on which you use a
filter.lttng-utils.debug-info component. In this case, the target prefix to use is
DIRas the directory from which to load debugging information with the build ID and debug link methods instead of
Name the debugging information structure field in the common context of the created events
NAMEinstead of the default
Use the full path when writing the executable name (
bin) and source file name (
src) fields in the
debug_infocontext field of the created events.
DIRas the root directory of the target file system instead of
+----------------------------+ | flt.lttng-utils.debug-info | | | @ in out @ +----------------------------+
Single input port.
Single output port.