3 <title>Debugging with GDB
</title>
4 <meta http-equiv=
"Content-Type" content=
"text/html">
5 <meta name=
"description" content=
"Debugging with GDB">
6 <meta name=
"generator" content=
"makeinfo 4.3">
7 <link href=
"http://www.gnu.org/software/texinfo/" rel=
"generator-home">
12 Node:
<a name=
"Automatic%20Overlay%20Debugging">Automatic Overlay Debugging
</a>,
13 Next:
<a rel=
"next" accesskey=
"n" href=
"Overlay-Sample-Program.html#Overlay%20Sample%20Program">Overlay Sample Program
</a>,
14 Previous:
<a rel=
"previous" accesskey=
"p" href=
"Overlay-Commands.html#Overlay%20Commands">Overlay Commands
</a>,
15 Up:
<a rel=
"up" accesskey=
"u" href=
"Overlays.html#Overlays">Overlays
</a>
19 <h3 class=
"section">Automatic Overlay Debugging
</h3>
21 GDB can automatically track which overlays are mapped and which
22 are not, given some simple co-operation from the overlay manager in the
23 inferior. If you enable automatic overlay debugging with the
24 <code>overlay auto
</code> command (see
<a href=
"Overlay-Commands.html#Overlay%20Commands">Overlay Commands
</a>), GDB
25 looks in the inferior's memory for certain variables describing the
26 current state of the overlays.
28 <p>Here are the variables your overlay manager must define to support
29 GDB's automatic overlay debugging:
33 <br><dt><code>_ovly_table
</code>:
34 <dd>This variable must be an array of the following structures:
36 <pre class=
"example"> struct
38 /* The overlay's mapped address. */
41 /* The size of the overlay, in bytes. */
44 /* The overlay's load address. */
47 /* Non-zero if the overlay is currently mapped;
53 <br><dt><code>_novlys
</code>:
54 <dd>This variable must be a four-byte signed integer, holding the total
55 number of elements in
<code>_ovly_table
</code>.
59 <p>To decide whether a particular overlay is mapped or not, GDB
60 looks for an entry in
<code>_ovly_table
</code> whose
<code>vma
</code> and
61 <code>lma
</code> members equal the VMA and LMA of the overlay's section in the
62 executable file. When GDB finds a matching entry, it consults
63 the entry's
<code>mapped
</code> member to determine whether the overlay is
66 <p>In addition, your overlay manager may define a function called
67 <code>_ovly_debug_event
</code>. If this function is defined, GDB
68 will silently set a breakpoint there. If the overlay manager then
69 calls this function whenever it has changed the overlay table, this
70 will enable GDB to accurately keep track of which overlays
71 are in program memory, and update any breakpoints that may be set
72 in overlays. This will allow breakpoints to work even if the
73 overlays are kept in ROM or other non-writable memory while they
74 are not being executed.