toolchain/share/doc/gdb/Automatic-Overlay-Debugging...

105 lines
4.7 KiB
HTML

<html lang="en">
<head>
<title>Automatic Overlay Debugging - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Overlays.html#Overlays" title="Overlays">
<link rel="prev" href="Overlay-Commands.html#Overlay-Commands" title="Overlay Commands">
<link rel="next" href="Overlay-Sample-Program.html#Overlay-Sample-Program" title="Overlay Sample Program">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Automatic-Overlay-Debugging"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Overlay-Sample-Program.html#Overlay-Sample-Program">Overlay Sample Program</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Overlay-Commands.html#Overlay-Commands">Overlay Commands</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Overlays.html#Overlays">Overlays</a>
<hr>
</div>
<h3 class="section">14.3 Automatic Overlay Debugging</h3>
<p><a name="index-automatic-overlay-debugging-963"></a>
<span class="sc">gdb</span> can automatically track which overlays are mapped and which
are not, given some simple co-operation from the overlay manager in the
inferior. If you enable automatic overlay debugging with the
<code>overlay auto</code> command (see <a href="Overlay-Commands.html#Overlay-Commands">Overlay Commands</a>), <span class="sc">gdb</span>
looks in the inferior's memory for certain variables describing the
current state of the overlays.
<p>Here are the variables your overlay manager must define to support
<span class="sc">gdb</span>'s automatic overlay debugging:
<dl>
<dt><code>_ovly_table</code>:<dd>This variable must be an array of the following structures:
<pre class="smallexample"> struct
{
/* The overlay's mapped address. */
unsigned long vma;
/* The size of the overlay, in bytes. */
unsigned long size;
/* The overlay's load address. */
unsigned long lma;
/* Non-zero if the overlay is currently mapped;
zero otherwise. */
unsigned long mapped;
}
</pre>
<br><dt><code>_novlys</code>:<dd>This variable must be a four-byte signed integer, holding the total
number of elements in <code>_ovly_table</code>.
</dl>
<p>To decide whether a particular overlay is mapped or not, <span class="sc">gdb</span>
looks for an entry in <code>_ovly_table</code><!-- /@w --> whose <code>vma</code> and
<code>lma</code> members equal the VMA and LMA of the overlay's section in the
executable file. When <span class="sc">gdb</span> finds a matching entry, it consults
the entry's <code>mapped</code> member to determine whether the overlay is
currently mapped.
<p>In addition, your overlay manager may define a function called
<code>_ovly_debug_event</code>. If this function is defined, <span class="sc">gdb</span>
will silently set a breakpoint there. If the overlay manager then
calls this function whenever it has changed the overlay table, this
will enable <span class="sc">gdb</span> to accurately keep track of which overlays
are in program memory, and update any breakpoints that may be set
in overlays. This will allow breakpoints to work even if the
overlays are kept in ROM or other non-writable memory while they
are not being executed.
</body></html>