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