Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




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 debugging:


This variable must be an array of the following structures:

  /* 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;


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.

In addition, your overlay manager may define a function called _ovly_debug_event. If this function is defined, gdb will silently set a breakpoint there. If the overlay manager then calls this function whenever it has changed the overlay table, this will enable gdb 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.

  Published under the terms of the GNU General Public License Design by Interspire