[PATCHv3,0/5] Better executable auto-loading when opening a core file

Message ID cover.1730205615.git.aburgess@redhat.com
Headers
Series Better executable auto-loading when opening a core file |

Message

Andrew Burgess Oct. 29, 2024, 2:08 p.m. UTC
  In v3:

  - Linaro CI highlighted some failures on ARM.  Turns out ARM's stack
    setup is different than the other architectures I've tested on.
    I've added some additional logic which should mean ARM is now
    handled OK.

In v2:

  - Fixed an incorrect use of gdb::function_view in patch #1 which was
    causing undefined behaviour, and crashes when GDB was built with
    optimisation.

  - Rebased and retested.

---

There's actually a couple of core file related improvements in this
series.

Patches #1 and #2 improve what information GDB can extract about the
execution context (executable name, inferior arguments, and
environment) when opening a core file.

Then patch #4 improves GDB's ability to auto-load the executable that
matches a core file (on GNU/Linux).

Patch #3 is a testsuite refactor to allow for patch #4.

And patch #5 replicates patch #4, but for FreeBSD.

Thanks,
Andrew

---

Andrew Burgess (5):
  gdb: add gdbarch method to get execution context from core file
  gdb: parse and set the inferior environment from core files
  gdb/testsuite: make some of the core file / build-id tests harder
  gdb: improve GDB's ability to auto-load the exec for a core file
  gdb/freebsd: port core file context parsing to FreeBSD

 gdb/arch-utils.c                              |  26 ++
 gdb/arch-utils.h                              |  89 +++++
 gdb/corefile.c                                |  10 +
 gdb/corelow.c                                 | 172 +++++++++-
 gdb/fbsd-tdep.c                               | 134 ++++++++
 gdb/gdbarch-gen.c                             |  22 ++
 gdb/gdbarch-gen.h                             |  15 +
 gdb/gdbarch.h                                 |   1 +
 gdb/gdbarch_components.py                     |  20 ++
 gdb/linux-tdep.c                              | 315 ++++++++++++++++++
 gdb/testsuite/gdb.base/coredump-filter.exp    |  17 +-
 gdb/testsuite/gdb.base/corefile-buildid.exp   | 252 ++++++--------
 .../gdb.base/corefile-exec-context.c          |  25 ++
 .../gdb.base/corefile-exec-context.exp        | 165 +++++++++
 gdb/testsuite/gdb.base/corefile-find-exec.c   |  25 ++
 gdb/testsuite/gdb.base/corefile-find-exec.exp | 252 ++++++++++++++
 gdb/testsuite/gdb.base/corefile.exp           |   9 +
 17 files changed, 1386 insertions(+), 163 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/corefile-exec-context.c
 create mode 100644 gdb/testsuite/gdb.base/corefile-exec-context.exp
 create mode 100644 gdb/testsuite/gdb.base/corefile-find-exec.c
 create mode 100644 gdb/testsuite/gdb.base/corefile-find-exec.exp


base-commit: a723c56efb07c4f8b3f6a3ed4b878a2f8f5572cc