]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: add extension hook ext_lang_find_objfile_from_buildid
authorAndrew Burgess <aburgess@redhat.com>
Wed, 31 Jul 2024 14:54:52 +0000 (15:54 +0100)
committerAndrew Burgess <aburgess@redhat.com>
Sun, 10 Nov 2024 10:18:22 +0000 (10:18 +0000)
commitef1a41f20b7ea4799e09b37312dc051245435fd1
tree22c04a38ed29a6dbc56bd67e0e3d51ddbe682cfd
parent629bcc68d799ff77a5f174e2f5300f9a26a83521
gdb: add extension hook ext_lang_find_objfile_from_buildid

Add a new ext_lang_find_objfile_from_buildid function which is called
from find_objfile_by_build_id and gives extension languages a chance
to find missing objfiles.

This commit adds the ext_lang_find_objfile_from_buildid function and
the extension_language_ops::find_objfile_from_buildid() hook, but does
not implement the hook for any extension languages, that will come in
the next commit.

This commit does rewrite find_objfile_by_build_id (build-id.c) to call
the new hook though.  The basic steps of find_objfile_by_build_id are
now this:

  1. Try to find the missing objfile using the build-id by looking in
  the debug-file-directory's .build-id/ sub-directory.  If we find the
  file then we're done.

  2. Ask debuginfod to download the missing file for us.  If we
  download the file successfully then we're done.

  3. Ask the extension language hook to find the file for us.  If the
  extension language asks us to try again then we repeat step (1) only
  and if we still don't have the file, we move to step (4).  If the
  extension language told us where the file is then we use that file
  and we're done.

  4. We didn't find the file.  Carry on without it.

Only step (3) is new in this logic, everything else was already done.

There are no tests added here as we can't currently write an extension
language callback.  The next commit will add the tests.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/build-id.c
gdb/build-id.h
gdb/corelow.c
gdb/extension-priv.h
gdb/extension.c
gdb/extension.h
gdb/solib.c