Add modern Babeltrace man pages
[babeltrace.git] / doc / man / babeltrace-filter.lttng-utils.debug-info.7.txt
CommitLineData
0659f3af
PP
1babeltrace-filter.lttng-utils.debug-info(7)
2===========================================
3:manpagetype: component class
4:revdate: 5 October 2017
5:comp: compcls:filter.lttng-utils.debug-info
6:defdebuginfoname: `debug_info`
7
8
9NAME
10----
11babeltrace-filter.lttng-utils.debug-info - Babeltrace's debugging
12information filter component class for LTTng traces
13
14
15DESCRIPTION
16-----------
17The Babeltrace {comp} component class, provided by the the
18man:babeltrace-plugin-lttng-utils(7) plugin, once instantiated, receives
19events from http://lttng.org/[LTTng] traces and creates new ones
20which are copies of the original ones with extra debugging information
21when it's available and possible.
22
23A {comp} component uses the LTTng state dump events as well as the event
24context's `ip` (instruction pointer) field to locate and read the
25corresponding debugging information. The component can find the extra
26debugging information in an executable file or in a directory containing
27debugging information created by the compiler.
28
29The new events contain the exact same fields as the original ones and,
30when possible, a new event context's structure field (besides the `ip`
31field) named {defdebuginfoname} by default. This structure field
32contains the following fields:
33
34`bin` (string field)::
35 Executable path or name followed by `@ADDR` or `+ADDR`, where
36 `ADDR` is the address where it was loaded while being traced.
37 `@ADDR` means `ADDR` is an absolute address, and `+ADDR` means
38 `ADDR` is a relative address.
39+
40Example: `my-program@0x401040`.
41
42[[field-func]]`func` (string field)::
43 Function name followed by `+OFFSET`, where `OFFSET` is the
44 offset from the beginning of the function symbol in the executable
45 file.
46+
47Example: `load_user_config+0x194`.
48
49[[field-src]]`src` (string field)::
50 Source file path or name followed by `:LINE`, where `LINE` is the
51 line number in this source file at which the event occured.
52+
53Example: `user-config.c:1025`.
54
55Any of those the previous fields can be an empty string if the
56debugging information was not available for the analyzed original
57LTTng event.
58
59When a filter component creates a new event with debugging
60information, it discards the original event. If the component receives a
61non-LTTng event, the component moves the event to its output port
62without alteration.
63
64
65Compile an executable for debugging information analysis
66~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67With GCC or Clang, you should compile the program or library source
68files in debug mode with the nlopt:-g option. This option makes the
69compiler generate debugging information in the operating system's native
70format. This format is recognized by a {comp} component: it can
71translate the instruction pointer field of an event's context to a
72source file and line number, along with the name of the surrounding
73function.
74
75NOTE: This component class only supports the debugging information in
76DWARF format, version{nbsp}2 or later. Use the nlopt:-gdwarf or
77nlopt:-gdwarf-VERSION (where `VERSION` is the DWARF version) compiler
78options to explicitly generate DWARF debugging information.
79
80If you don't compile the executable's source files with the nlopt:-g
81option or with an equivalent option, no DWARF information is available:
82the component uses ELF symbols from the executable file instead. In this
83case, the events that the component creates do not contain the source
84file and line number (<<field-src,`src` field>>), but only the name of
85the nearest function symbol with an offset in bytes to the location in
86the executable from which the LTTng event occured (<<field-func,`func`
87field>>).
88
89If the executable file has neither ELF symbols nor DWARF information,
90the {comp} component cannot map the event to
91its source location: it emits the original LTTng event which has no
92special {defdebuginfoname} context field.
93
94
95LTTng prerequisites
96~~~~~~~~~~~~~~~~~~~
97A {comp} component can only analyze user space events generated by
98http://lttng.org[LTTng]{nbsp}2.8.0 or later.
99
100The filter component needs the LTTng-UST events to contain the
101`ip` and `vpid` fields in their context.
102
103To add those context fields with the man:lttng(1) command-line tool
104before the tracers are active (before `lttng start`):
105
106[role="term"]
107----
108$ lttng add-context --userspace --type=ip --type=vpid
109----
110
111See man:lttng-add-context(1) for more information.
112
113To get debugging information for LTTng-UST events which occur in
114dynamically loaded objects, for example plugins, start the application
115to trace with the LTTng-UST dynamic linking helper:
116
117[role="term"]
118----
119$ LD_PRELOAD=liblttng-ust-dl.so my-app
120----
121
122See man:lttng-ust-dl(3) for more information.
123
124
125Separate debugging information
126~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
127It is possible to store DWARF debugging information outside the
128executable itself, whether it is to reduce the executable's file size,
129or simply to facilitate the sharing of the debugging information.
130
131This is usually achieved via one of two mechanisms, namely _build ID_
132and _debug link_. Their use and operation is described in the
133https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html[Debugging
134Information in Separate Files] section of GDB's documentation.
135
136A {comp} component can find separate debugging information files
137automatically, as long as they meet the requirements stated in this man
138page.
139
140The debugging information lookup order is the same as GDB's, namely:
141
142. Within the executable file itself.
143
144. Through the build ID method in the `/usr/lib/debug/.build-id`
145 directory.
146
147. In the various possible debug link locations.
148
149The component uses the first debugging information file that it finds.
150
151You can use the param:deubg-info-dir initialization parameter to
152override the default `/usr/lib/debug` directory used in the build ID and
153debug link methods.
154
155NOTE: It is currently not possible to make this component search for
156debugging information in multiple directories.
157
158
159Target prefix
160~~~~~~~~~~~~~
161The debugging information analysis that a {comp} component performs uses
162the paths to the executables as collected during tracing as the default
163mechanism to resolve DWARF and ELF information.
164
165If the trace was recorded on a separate machine, however, you can use
166the param:target-prefix parameter to specify a prefix directory, that
167is, the root of the target file system.
168
169For example, if an instrumented executable's path is `/usr/bin/foo` on
170the target system, you can place this file at
171`/home/user/target/usr/bin/foo` on the system on which you use the
172component. In this case, the target prefix to use is
173`/home/user/target`.
174
175
176INITIALIZATION PARAMETERS
177-------------------------
178The following parameters are optional.
179
180param:debug-info-dir='DIR' (string)::
181 Use 'DIR' as the directory from which to load debugging information
182 with the build ID and debug link methods instead of
183 `/usr/lib/debug`.
184
185param:debug-info-field-name='NAME' (string)::
186 Name the debugging information structure field in the context of
187 the created events 'NAME' instead of the default {defdebuginfoname}.
188
189param:full-path=`yes` (boolean)::
190 Use the full path when writing the executable name (`bin`) and
191 source file name (`src`) fields in the {defdebuginfoname} context
192 field of the created events.
193
194param:target-prefix='DIR' (string)::
195 Use 'DIR' as the root directory of the target file system instead of
196 `/`.
197
198
199PORTS
200-----
201Input
202~~~~~
203`in`::
204 Single input port from which the component receives the
205 notifications to augment with debugging information.
206
207
208Output
209~~~~~~
210`out`::
211 Single output port to which the component sends the augmented
212 or unaltered notifications.
213
214
215QUERY OBJECTS
216-------------
217This component class has no objects to query.
218
219
220ENVIRONMENT VARIABLES
221---------------------
222include::common-common-compat-env.txt[]
223
224`BABELTRACE_FLT_LTTNG_UTILS_DEBUG_INFO_LOG_LEVEL`::
225 Component class's log level. The available values are the
226 same as for the manopt:babeltrace(1):--log-level option of
227 man:babeltrace(1).
228
229
230include::common-footer.txt[]
231
232
233SEE ALSO
234--------
235man:babeltrace-plugin-lttng-utils(7),
236man:lttng(1),
237man:lttng-add-context(1),
238man:babeltrace-intro(7)
This page took 0.031899 seconds and 4 git commands to generate.