1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
5 | %general-entities;
|
---|
6 |
|
---|
7 | <!ENTITY gdb-download-http "&gnu-http;/gdb/gdb-&gdb-version;.tar.xz">
|
---|
8 | <!ENTITY gdb-download-ftp "&gnu-ftp;/gdb/gdb-&gdb-version;.tar.xz">
|
---|
9 | <!ENTITY gdb-md5sum "fbd3cdae16c581e8a742cb766ba35076">
|
---|
10 | <!ENTITY gdb-size "23 MB">
|
---|
11 | <!ENTITY gdb-buildsize "914 MB (add 805 MB for docs; add 575 MB for tests)">
|
---|
12 | <!ENTITY gdb-time "2.1 SBU (add 0.4 SBU for docs; add 18 SBU for tests; all using parallelism=4)">
|
---|
13 | ]>
|
---|
14 |
|
---|
15 | <sect1 id="gdb" xreflabel="GDB-&gdb-version;">
|
---|
16 | <?dbhtml filename="gdb.html"?>
|
---|
17 |
|
---|
18 |
|
---|
19 | <title>GDB-&gdb-version;</title>
|
---|
20 |
|
---|
21 | <indexterm zone="gdb">
|
---|
22 | <primary sortas="a-GDB">GDB</primary>
|
---|
23 | </indexterm>
|
---|
24 |
|
---|
25 | <sect2 role="package">
|
---|
26 | <title>Introduction to GDB</title>
|
---|
27 |
|
---|
28 | <para>
|
---|
29 | <application>GDB</application>, the GNU Project debugger, allows you
|
---|
30 | to see what is going on <quote>inside</quote> another program while it
|
---|
31 | executes -- or what another program was doing at the moment it crashed.
|
---|
32 | Note that <application>GDB</application> is most effective when tracing
|
---|
33 | programs and libraries that were built with debugging symbols and not
|
---|
34 | stripped.
|
---|
35 | </para>
|
---|
36 |
|
---|
37 | &lfs120_checked;
|
---|
38 |
|
---|
39 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
40 | <itemizedlist spacing="compact">
|
---|
41 | <listitem>
|
---|
42 | <para>
|
---|
43 | Download (HTTP): <ulink url="&gdb-download-http;"/>
|
---|
44 | </para>
|
---|
45 | </listitem>
|
---|
46 | <listitem>
|
---|
47 | <para>
|
---|
48 | Download (FTP): <ulink url="&gdb-download-ftp;"/>
|
---|
49 | </para>
|
---|
50 | </listitem>
|
---|
51 | <listitem>
|
---|
52 | <para>
|
---|
53 | Download MD5 sum: &gdb-md5sum;
|
---|
54 | </para>
|
---|
55 | </listitem>
|
---|
56 | <listitem>
|
---|
57 | <para>
|
---|
58 | Download size: &gdb-size;
|
---|
59 | </para>
|
---|
60 | </listitem>
|
---|
61 | <listitem>
|
---|
62 | <para>
|
---|
63 | Estimated disk space required: &gdb-buildsize;
|
---|
64 | </para>
|
---|
65 | </listitem>
|
---|
66 | <listitem>
|
---|
67 | <para>
|
---|
68 | Estimated build time: &gdb-time;
|
---|
69 | </para>
|
---|
70 | </listitem>
|
---|
71 | </itemizedlist>
|
---|
72 | <!--
|
---|
73 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
74 | <itemizedlist spacing="compact">
|
---|
75 | <listitem>
|
---|
76 | <para>
|
---|
77 | Required patch:
|
---|
78 | <ulink url="&patch-root;/gdb-&gdb-version;-upstream_fixes-1.patch"/>
|
---|
79 | </para>
|
---|
80 | </listitem>
|
---|
81 | </itemizedlist>
|
---|
82 | -->
|
---|
83 | <bridgehead renderas="sect3">GDB Dependencies</bridgehead>
|
---|
84 |
|
---|
85 | <bridgehead renderas="sect4">Recommended Runtime Dependency</bridgehead>
|
---|
86 | <para role="recommended">
|
---|
87 | <xref linkend="six"/> (Python 3 module, required at run-time to
|
---|
88 | use GDB scripts from various LFS/BLFS packages with Python 3
|
---|
89 | installed in LFS)
|
---|
90 | </para>
|
---|
91 |
|
---|
92 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
93 | <para role="optional">
|
---|
94 | <xref linkend="doxygen"/>,
|
---|
95 | <xref linkend="gcc"/> (ada, gfortran, and go are used for tests),
|
---|
96 | <xref linkend="guile"/>,
|
---|
97 | <!-- don't advertise python2...
|
---|
98 | <xref linkend="python2"/>,-->
|
---|
99 | <xref linkend="rust"/> (used for some tests),
|
---|
100 | <xref linkend="valgrind"/>, and
|
---|
101 | <ulink url="https://sourceware.org/systemtap/">SystemTap</ulink>
|
---|
102 | (run-time, used for tests)
|
---|
103 | </para>
|
---|
104 |
|
---|
105 | </sect2>
|
---|
106 |
|
---|
107 | <sect2 role="installation">
|
---|
108 | <title>Installation of GDB</title>
|
---|
109 | <!--
|
---|
110 | <para>
|
---|
111 | First, apply a patch that fixes problems when debugging programs compiled
|
---|
112 | with <xref linkend="rust" role="nodep"/>:
|
---|
113 | </para>
|
---|
114 |
|
---|
115 | <screen><userinput remap="pre">patch -Np1 -i ../gdb-&gdb-version;-upstream_fixes-1.patch</userinput></screen>
|
---|
116 | -->
|
---|
117 | <para>
|
---|
118 | Install <application>GDB</application> by running the following
|
---|
119 | commands:
|
---|
120 | </para>
|
---|
121 |
|
---|
122 | <screen><userinput>mkdir build &&
|
---|
123 | cd build &&
|
---|
124 |
|
---|
125 | ../configure --prefix=/usr \
|
---|
126 | --with-system-readline \
|
---|
127 | --with-python=/usr/bin/python3 &&
|
---|
128 | make</userinput></screen>
|
---|
129 |
|
---|
130 | <para>
|
---|
131 | Optionally, to build the API documentation using
|
---|
132 | <xref linkend="doxygen"/>, run:
|
---|
133 | </para>
|
---|
134 |
|
---|
135 | <screen remap="doc"><userinput>make -C gdb/doc doxy</userinput></screen>
|
---|
136 |
|
---|
137 | <para>
|
---|
138 | To test the results, issue:
|
---|
139 | </para>
|
---|
140 |
|
---|
141 | <screen remap="test"><userinput>pushd gdb/testsuite &&
|
---|
142 | make site.exp &&
|
---|
143 | echo "set gdb_test_timeout 120" >> site.exp &&
|
---|
144 | runtest
|
---|
145 | popd</userinput></screen>
|
---|
146 |
|
---|
147 | <para>
|
---|
148 | See <emphasis>gdb/testsuite/README</emphasis> and <ulink
|
---|
149 | url="https://sourceware.org/gdb/wiki/TestingGDB">TestingGDB</ulink>.
|
---|
150 | There are many problems with the test suite:
|
---|
151 | </para>
|
---|
152 |
|
---|
153 | <itemizedlist>
|
---|
154 | <listitem>
|
---|
155 | <para>
|
---|
156 | Clean directories are needed if re-running the tests. For that
|
---|
157 | reason, make a copy of the compiled source code
|
---|
158 | directory before the tests in case you need to run the tests again.
|
---|
159 | </para>
|
---|
160 | </listitem>
|
---|
161 |
|
---|
162 | <listitem>
|
---|
163 | <para>
|
---|
164 | Results depend on installed compilers.
|
---|
165 | </para>
|
---|
166 | </listitem>
|
---|
167 | <!-- I did not see this
|
---|
168 | <listitem>
|
---|
169 | <para>
|
---|
170 | There are a large number of timeouts (there is a variable
|
---|
171 | that can be set to increase time for timeout, but
|
---|
172 | changing it will result in a different number of tests being
|
---|
173 | run).
|
---|
174 | </para>
|
---|
175 | </listitem>
|
---|
176 | or this
|
---|
177 | <listitem>
|
---|
178 | <para>
|
---|
179 | There are failures associated with system readline 6.x.
|
---|
180 | </para>
|
---|
181 | </listitem>
|
---|
182 | -->
|
---|
183 | <!--
|
---|
184 | <listitem>
|
---|
185 | <para>
|
---|
186 | A few tests assume that the header file
|
---|
187 | <filename><sys/sdt.h></filename>, part of <ulink
|
---|
188 | url="https://sourceware.org/systemtap/">SystemTap</ulink>, is
|
---|
189 | present.
|
---|
190 | </para>
|
---|
191 | </listitem>
|
---|
192 | -->
|
---|
193 | <!-- I don't know if this is true or not. I tested on a Haswell.
|
---|
194 | <listitem>
|
---|
195 | <para>
|
---|
196 | If the test suite is run on a Skylake-based Intel CPU or newer,
|
---|
197 | many tests will fail due to the removal of the deprecated/problematic
|
---|
198 | libmpx library in GCC.
|
---|
199 | </para>
|
---|
200 | </listitem>
|
---|
201 | -->
|
---|
202 | <listitem>
|
---|
203 | <para>
|
---|
204 | <!-- for gdb-11.1, gcc-11.2 - pierre
|
---|
205 | A test run of the test suite had about 1700 unexpected failures
|
---|
206 | (out of over 80000 tests). Over 1370 of the failures were related
|
---|
207 | to FORTRAN tests. -->
|
---|
208 | <!-- for gdb-12.1, gcc-11.3.0 - bdubbs
|
---|
209 | A test run of the test suite had a little over 200 unexpected failures
|
---|
210 | out of over 94000 tests.-->
|
---|
211 | <!-- for gdb-13.0, gcc-12.2.0 - bdubbs
|
---|
212 | A test run of the test suite had 33 unexpected failures
|
---|
213 | out of over 106000 tests. -->
|
---|
214 | <!-- for gdb-13.2, gcc-13.1.0 - pierre -->
|
---|
215 | A test run of the test suite had 183 unexpected failures
|
---|
216 | out of over 105000 tests.
|
---|
217 | </para>
|
---|
218 | </listitem>
|
---|
219 |
|
---|
220 | <listitem>
|
---|
221 | <para>
|
---|
222 | On some systems, the gdb.tui test suite will fail if running over
|
---|
223 | SSH.
|
---|
224 | </para>
|
---|
225 | </listitem>
|
---|
226 |
|
---|
227 | <listitem>
|
---|
228 | <para>
|
---|
229 | On some AMD-based systems, over 200 additional tests
|
---|
230 | may fail due to a difference in the threading implementation
|
---|
231 | on those CPUs.
|
---|
232 | </para>
|
---|
233 | </listitem>
|
---|
234 |
|
---|
235 | </itemizedlist>
|
---|
236 |
|
---|
237 | <para>
|
---|
238 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
239 | </para>
|
---|
240 |
|
---|
241 | <screen role="root"><userinput>make -C gdb install &&
|
---|
242 | make -C gdbserver install</userinput></screen>
|
---|
243 |
|
---|
244 | <para>
|
---|
245 | If you have built the API documentation, it is now in gdb/doc/doxy.
|
---|
246 | You can install it (as the <systemitem class="username">root</systemitem>
|
---|
247 | user):
|
---|
248 | </para>
|
---|
249 |
|
---|
250 | <screen role="root"
|
---|
251 | remap="doc"><userinput>install -d /usr/share/doc/gdb-&gdb-version; &&
|
---|
252 | rm -rf gdb/doc/doxy/xml &&
|
---|
253 | cp -Rv gdb/doc/doxy /usr/share/doc/gdb-&gdb-version;</userinput></screen>
|
---|
254 |
|
---|
255 | </sect2>
|
---|
256 |
|
---|
257 | <sect2 role="commands">
|
---|
258 | <title>Command Explanations</title>
|
---|
259 |
|
---|
260 | <para>
|
---|
261 | <parameter>--with-system-readline</parameter>: This switch forces
|
---|
262 | <application>GDB</application> to use the copy of
|
---|
263 | <application>Readline</application> installed in LFS.
|
---|
264 | </para>
|
---|
265 |
|
---|
266 | <para>
|
---|
267 | <parameter>--with-python=/usr/bin/python3</parameter>: This switch
|
---|
268 | forces <application>GDB</application> to use Python 3.
|
---|
269 | <!-- We don't advise to use python2 anymore
|
---|
270 | Remove this switch if you have installed
|
---|
271 | <xref linkend="python2"/> and want to use it instead of Python 3.-->
|
---|
272 | </para>
|
---|
273 |
|
---|
274 | </sect2>
|
---|
275 |
|
---|
276 | <sect2 role="content">
|
---|
277 | <title>Contents</title>
|
---|
278 |
|
---|
279 | <segmentedlist>
|
---|
280 | <segtitle>Installed Programs</segtitle>
|
---|
281 | <segtitle>Installed Library</segtitle>
|
---|
282 | <segtitle>Installed Directories</segtitle>
|
---|
283 |
|
---|
284 | <seglistitem>
|
---|
285 | <seg>
|
---|
286 | gcore, gdb, gdbserver, and gdb-add-index
|
---|
287 | </seg>
|
---|
288 | <seg>
|
---|
289 | libinproctrace.so
|
---|
290 | </seg>
|
---|
291 | <seg>
|
---|
292 | /usr/{include,share}/gdb and /usr/share/doc/gdb-&gdb-version;
|
---|
293 | </seg>
|
---|
294 | </seglistitem>
|
---|
295 | </segmentedlist>
|
---|
296 |
|
---|
297 | <variablelist>
|
---|
298 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
299 | <?dbfo list-presentation="list"?>
|
---|
300 | <?dbhtml list-presentation="table"?>
|
---|
301 |
|
---|
302 | <varlistentry id="gcore">
|
---|
303 | <term><command>gcore</command></term>
|
---|
304 | <listitem>
|
---|
305 | <para>
|
---|
306 | generates a core dump of a running program
|
---|
307 | </para>
|
---|
308 | <indexterm zone="gdb gcore">
|
---|
309 | <primary sortas="b-gcore">gcore</primary>
|
---|
310 | </indexterm>
|
---|
311 | </listitem>
|
---|
312 | </varlistentry>
|
---|
313 |
|
---|
314 | <varlistentry id="gdb-prog">
|
---|
315 | <term><command>gdb</command></term>
|
---|
316 | <listitem>
|
---|
317 | <para>
|
---|
318 | is the GNU Debugger
|
---|
319 | </para>
|
---|
320 | <indexterm zone="gdb gdb-prog">
|
---|
321 | <primary sortas="b-gdb-prog">gdb-prog</primary>
|
---|
322 | </indexterm>
|
---|
323 | </listitem>
|
---|
324 | </varlistentry>
|
---|
325 |
|
---|
326 | <varlistentry id="gdbserver">
|
---|
327 | <term><command>gdbserver</command></term>
|
---|
328 | <listitem>
|
---|
329 | <para>
|
---|
330 | is a remote server for the GNU debugger (it allows programs
|
---|
331 | to be debugged from a different machine)
|
---|
332 | </para>
|
---|
333 | <indexterm zone="gdb gdbserver">
|
---|
334 | <primary sortas="b-gdbserver">gdbserver</primary>
|
---|
335 | </indexterm>
|
---|
336 | </listitem>
|
---|
337 | </varlistentry>
|
---|
338 |
|
---|
339 | <varlistentry id="gdb-add-index">
|
---|
340 | <term><command>gdb-add-index</command></term>
|
---|
341 | <listitem>
|
---|
342 | <para>
|
---|
343 | Allows adding index files to ELF binaries. This speeds up
|
---|
344 | <command>gdb</command> start on large programs.
|
---|
345 | </para>
|
---|
346 | <indexterm zone="gdb gdb-add-index">
|
---|
347 | <primary sortas="b-gdb-add-index">gdb-add-index</primary>
|
---|
348 | </indexterm>
|
---|
349 | </listitem>
|
---|
350 | </varlistentry>
|
---|
351 |
|
---|
352 | <varlistentry id="libinproctrace">
|
---|
353 | <term><filename class="libraryfile">libinproctrace.so</filename></term>
|
---|
354 | <listitem>
|
---|
355 | <para>
|
---|
356 | contains functions for the in-process tracing agent. The agent
|
---|
357 | allows for installing fast tracepoints, listing static tracepoint
|
---|
358 | markers, probing static tracepoints markers, and starting trace
|
---|
359 | monitoring.
|
---|
360 | </para>
|
---|
361 | <indexterm zone="gdb libinproctrace">
|
---|
362 | <primary sortas="c-libinproctrace">libinproctrace.so</primary>
|
---|
363 | </indexterm>
|
---|
364 | </listitem>
|
---|
365 | </varlistentry>
|
---|
366 |
|
---|
367 | </variablelist>
|
---|
368 |
|
---|
369 | </sect2>
|
---|
370 |
|
---|
371 | </sect1>
|
---|