[RFC PATCH 0/3] Support different overlay systems
Craig Blackmore
craig.blackmore@embecosm.com
Mon May 9 21:51:21 GMT 2022
This patch series lays the groundwork for supporting a wider range of
overlay systems by creating a base gdb_overlay_manager class from which
new overlay managers can be implemented. This work builds on a prototype
written by Andrew Burgess.
GDB's existing overlay support works by placing overlays in sections and
using the LMA as unmapped address and VMA as mapped address. This
restricts overlays to having a one-to-one mapping between a fixed pair
of unmapped and mapped addresses. The motivation for these changes is
to support overlay systems such as the RISC-V overlay system
https://github.com/riscv-software-src/riscv-overlay/blob/master/docs/overlay-hld.adoc
that can dynamically map an overlay to any address within the overlay
area rather than being limited to a link-time defined address. In the
case of RISC-V, the same overlay could also be mapped to multiple
addresses at once.
The existing GDB overlay support has been moved to the
default_overlay_manager class, which is a sub-class of
gdb_overlay_manager. There should be no functional change to the
original overlay support.
This patch series includes a gdb_py_overlay_manager class which is
extendable via python code such that an overlay system could be shipped
with a supporting python script that contains all the internal knowledge
of the system and implements a set of hooks needed by GDB to debug such
a system.
There are a few changes that I am working on that are not yet included
in this patch series:
GDB expects to be able to find symbol and line info whether it is
using an unmapped or mapped address. However, for the kind of overlay
system I want to support, mapped addresses are not associated with
the symbol and line info for the overlay, so GDB must use the unmapped
address to look up this information. The new function
overlay_address_for_sal will be used to tell GDB which address to use
for lookups.
Breakpoint handling. When a breakpoint is created for an overlay, add
a location for each address that the overlay is currently mapped to.
When the overlay event breakpoint is hit, delete locations at which
the overlay is no longer mapped and add newly mapped locations.
Now that we can support more overlay systems, this should be reflected
in the GDB documentation. The new python interface also needs
documenting.
I expect these changes to add to, rather than significantly modify, the
existing set of patches, so any feedback at this stage is welcome. I
will follow up and re-post with these additional changes later.
Craig Blackmore (3):
gdb: Move overlay support to new file
gdb: Add new overlay manager class
gdb: Add support for writing overlay managers in python
gdb/Makefile.in | 3 +
gdb/ax-gdb.c | 1 +
gdb/block.c | 1 +
gdb/blockframe.c | 1 +
gdb/breakpoint.c | 4 +
gdb/csky-tdep.c | 5 +-
gdb/elfread.c | 1 +
gdb/findvar.c | 2 +-
gdb/ft32-tdep.c | 4 +-
gdb/infcall.c | 1 +
gdb/infcmd.c | 1 +
gdb/infrun.c | 1 +
gdb/linespec.c | 1 +
gdb/m32r-tdep.c | 5 +-
gdb/moxie-tdep.c | 5 +-
gdb/objfiles.c | 1 +
gdb/overlay.c | 998 +++++++++++++++++++++++++++++++++++
gdb/overlay.h | 146 +++++
gdb/parse.c | 2 +-
gdb/printcmd.c | 3 +-
gdb/probe.c | 1 +
gdb/psymtab.c | 1 +
gdb/python/py-overlay.c | 409 ++++++++++++++
gdb/python/python-internal.h | 3 +
gdb/python/python.c | 4 +-
gdb/symfile.c | 714 +------------------------
gdb/symfile.h | 40 --
gdb/symtab.c | 1 +
gdb/target.c | 1 +
gdb/z80-tdep.c | 1 +
30 files changed, 1595 insertions(+), 766 deletions(-)
create mode 100644 gdb/overlay.c
create mode 100644 gdb/overlay.h
create mode 100644 gdb/python/py-overlay.c
--
2.17.1
More information about the Gdb-patches
mailing list