3 <title>GDB Internals
</title>
4 <meta http-equiv=
"Content-Type" content=
"text/html">
5 <meta name=
"description" content=
"GDB Internals">
6 <meta name=
"generator" content=
"makeinfo 4.3">
7 <link href=
"http://www.gnu.org/software/texinfo/" rel=
"generator-home">
12 Node:
<a name=
"Overall%20Structure">Overall Structure
</a>,
13 Next:
<a rel=
"next" accesskey=
"n" href=
"Algorithms.html#Algorithms">Algorithms
</a>,
14 Previous:
<a rel=
"previous" accesskey=
"p" href=
"Requirements.html#Requirements">Requirements
</a>,
15 Up:
<a rel=
"up" accesskey=
"u" href=
"index.html#Top">Top
</a>
19 <h2 class=
"chapter">Overall Structure
</h2>
21 GDB consists of three major subsystems: user interface,
22 symbol handling (the
<dfn>symbol side
</dfn>), and target system handling (the
23 <dfn>target side
</dfn>).
25 <p>The user interface consists of several actual interfaces, plus
28 <p>The symbol side consists of object file readers, debugging info
29 interpreters, symbol table management, source language expression
30 parsing, type and value printing.
32 <p>The target side consists of execution control, stack frame analysis, and
33 physical target manipulation.
35 <p>The target side/symbol side division is not formal, and there are a
36 number of exceptions. For instance, core file support involves symbolic
37 elements (the basic core file reader is in BFD) and target elements (it
38 supplies the contents of memory and the values of registers). Instead,
39 this division is useful for understanding how the minor subsystems
42 <h3 class=
"section">The Symbol Side
</h3>
44 <p>The symbolic side of GDB can be thought of as
"everything
45 you can do in GDB without having a live program running".
46 For instance, you can look at the types of variables, and evaluate
47 many kinds of expressions.
49 <h3 class=
"section">The Target Side
</h3>
51 <p>The target side of GDB is the
"bits and bytes manipulator".
52 Although it may make reference to symbolic info here and there, most
53 of the target side will run with only a stripped executable
54 available--or even no executable at all, in remote debugging cases.
56 <p>Operations such as disassembly, stack frame crawls, and register
57 display, are able to work with no symbolic info at all. In some cases,
58 such as disassembly, GDB will use symbolic info to present addresses
59 relative to symbols rather than as raw numbers, but it will work either
62 <h3 class=
"section">Configurations
</h3>
64 <p><dfn>Host
</dfn> refers to attributes of the system where GDB runs.
65 <dfn>Target
</dfn> refers to the system where the program being debugged
66 executes. In most cases they are the same machine, in which case a
67 third type of
<dfn>Native
</dfn> attributes come into play.
69 <p>Defines and include files needed to build on the host are host support.
70 Examples are tty support, system defined types, host byte order, host
73 <p>Defines and information needed to handle the target format are target
74 dependent. Examples are the stack frame format, instruction set,
75 breakpoint instruction, registers, and how to set up and tear down the stack
78 <p>Information that is only needed when the host and target are the same,
79 is native dependent. One example is Unix child process support; if the
80 host and target are not the same, doing a fork to start the target
81 process is a bad idea. The various macros needed for finding the
82 registers in the
<code>upage
</code>, running
<code>ptrace
</code>, and such are all
83 in the native-dependent files.
85 <p>Another example of native-dependent code is support for features that
86 are really part of the target environment, but which require
87 <code>#include
</code> files that are only available on the host system. Core
88 file handling and
<code>setjmp
</code> handling are two common cases.
90 <p>When you want to make GDB work
"native" on a particular machine, you
91 have to include all three kinds of information.