[PATCHv2,0/4] Python API to find missing objfiles

Message ID cover.1730020155.git.aburgess@redhat.com
Headers
Series Python API to find missing objfiles |

Message

Andrew Burgess Oct. 27, 2024, 9:10 a.m. UTC
  In v2:

  - Addressed Tom's feedback on patch #4.

  - Rebased onto current HEAD.

  - Retested.

---

This series provides a Python API which can be used to find missing
objfiles when opening a core file.  This is very similar in spirit to
the already existing code that provides a Python API for finding
missing debug information.

The first patch in this series cleans up the message that debuginfod
produces.  This is only relevant because the cleanup changes which
filenames are passed around, these same filenames are then passed into
the new Python API.

Patch #2 is a refactoring.

Patch #3 adds the new extension language API on the GDB core side.

Patch #4 adds the Python side of the same API.

For reference, see these commits for when the missing debug files
Python API was added:

  * 8f6c452b5a4 gdb: implement missing debug handler hook for Python
  * 661d98a3331 gdb: add an extension language hook for missing debug info

Thanks,
Andrew

---

Andrew Burgess (4):
  gdb: use mapped file information to improve debuginfod text
  gdb: rename ext_lang_missing_debuginfo_result
  gdb: add extension hook ext_lang_find_objfile_from_buildid
  gdb/python: implement Python find_exec_by_build_id hook

 gdb/NEWS                                      |  24 +
 gdb/build-id.c                                |  88 ++-
 gdb/build-id.h                                |   3 +-
 gdb/corelow.c                                 |  63 +-
 gdb/data-directory/Makefile.in                |   4 +-
 gdb/debuginfod-support.c                      |   4 +-
 gdb/doc/gdb.texinfo                           |   1 +
 gdb/doc/python.texi                           | 194 ++++++-
 gdb/extension-priv.h                          |  15 +-
 gdb/extension.c                               |  26 +-
 gdb/extension.h                               |  30 +-
 gdb/python/lib/gdb/__init__.py                | 110 +++-
 .../{missing_debug.py => missing_files.py}    | 135 +++--
 gdb/python/lib/gdb/missing_debug.py           | 161 +-----
 gdb/python/lib/gdb/missing_files.py           | 204 +++++++
 gdb/python/lib/gdb/missing_objfile.py         |  67 +++
 gdb/python/py-progspace.c                     |  26 +-
 gdb/python/python.c                           | 120 +++-
 gdb/solib.c                                   |   3 +-
 gdb/symfile-debug.c                           |   2 +-
 .../gdb.debuginfod/corefile-mapped-file.exp   |   2 +-
 .../gdb.debuginfod/solib-with-soname.exp      |   2 +-
 .../gdb.python/py-missing-objfile-lib.c       |  35 ++
 gdb/testsuite/gdb.python/py-missing-objfile.c |  49 ++
 .../gdb.python/py-missing-objfile.exp         | 544 ++++++++++++++++++
 .../gdb.python/py-missing-objfile.py          | 158 +++++
 26 files changed, 1787 insertions(+), 283 deletions(-)
 rename gdb/python/lib/gdb/command/{missing_debug.py => missing_files.py} (54%)
 create mode 100644 gdb/python/lib/gdb/missing_files.py
 create mode 100644 gdb/python/lib/gdb/missing_objfile.py
 create mode 100644 gdb/testsuite/gdb.python/py-missing-objfile-lib.c
 create mode 100644 gdb/testsuite/gdb.python/py-missing-objfile.c
 create mode 100644 gdb/testsuite/gdb.python/py-missing-objfile.exp
 create mode 100644 gdb/testsuite/gdb.python/py-missing-objfile.py


base-commit: a723c56efb07c4f8b3f6a3ed4b878a2f8f5572cc