106
Chapter 13. Debugging Programs That Use Overlays
(gdb) overlay list
Section .ov.foo.text, loaded at 0x100000 - 0x100034,
mapped at 0x1016 - 0x104a
(gdb) print foo
$6 = {int (int)} 0x1016
.
foo
/
When overlay debugging is enabled, gdb can find the correct address for functions and variables in
an overlay, whether or not the overlay is mapped. This allows most gdb commands, like
break
and
disassemble
, to work normally, even on unmapped code. However, gdb’s breakpoint support has
some limitations:
•
You can set breakpoints in functions in unmapped overlays, as long as gdb can write to the overlay
at its load address.
•
gdb can not set hardware or simulator-based breakpoints in unmapped overlays. However, if you
set a breakpoint at the end of your overlay manager (and tell gdb which overlays are now mapped,
if you are using manual overlay management), gdb will re-set its breakpoints properly.
13.3. Automatic Overlay Debugging
gdb 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
overlay auto
command (refer to Section 13.2
Overlay Commands
), gdb looks in the inferior’s
memory for certain variables describing the current state of the overlays.
Here are the variables your overlay manager must define to support gdb’s automatic overlay debug-
ging:
_ovly_table
:
This variable must be an array of the following structures:
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;
}
_novlys
:
This variable must be a four-byte signed integer, holding the total number of elements in
_ovly_table
.
To decide whether a particular overlay is mapped or not, gdb looks for an entry in
_ovly_table
whose
vma
and
lma
members equal the VMA and LMA of the overlay’s section in the executable file.
When gdb finds a matching entry, it consults the entry’s
mapped
member to determine whether the
overlay is currently mapped.
Summary of Contents for ENTERPRISE LINUX 4 - DEVELOPER TOOLS GUIDE
Page 1: ...Red Hat Enterprise Linux 4 Debugging with gdb ...
Page 12: ...2 Chapter 1 Debugging with gdb ...
Page 28: ...18 Chapter 4 Getting In and Out of gdb ...
Page 34: ...24 Chapter 5 gdb Commands ...
Page 44: ...34 Chapter 6 Running Programs Under gdb ...
Page 68: ...58 Chapter 8 Examining the Stack ...
Page 98: ...88 Chapter 10 Examining Data ...
Page 112: ...102 Chapter 12 Tracepoints ...
Page 118: ...108 Chapter 13 Debugging Programs That Use Overlays ...
Page 138: ...128 Chapter 14 Using gdb with Different Languages ...
Page 144: ...134 Chapter 15 Examining the Symbol Table ...
Page 170: ...160 Chapter 19 Debugging remote programs ...
Page 198: ...188 Chapter 21 Controlling gdb ...
Page 204: ...194 Chapter 22 Canned Sequences of Commands ...
Page 206: ...196 Chapter 23 Command Interpreters ...
Page 216: ...206 Chapter 25 Using gdb under gnu Emacs ...
Page 296: ...286 Chapter 27 gdb Annotations ...
Page 300: ...290 Chapter 28 Reporting Bugs in gdb ...
Page 322: ...312 Chapter 30 Using History Interactively ...
Page 362: ...352 Appendix D gdb Remote Serial Protocol ...
Page 380: ...370 Appendix F GNU GENERAL PUBLIC LICENSE ...
Page 386: ...376 Appendix G GNU Free Documentation License ...
Page 410: ......