aboutsummaryrefslogtreecommitdiff
path: root/gdb/extension-priv.h
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2024-07-31 15:54:52 +0100
committerAndrew Burgess <aburgess@redhat.com>2024-11-10 10:18:22 +0000
commitef1a41f20b7ea4799e09b37312dc051245435fd1 (patch)
tree22c04a38ed29a6dbc56bd67e0e3d51ddbe682cfd /gdb/extension-priv.h
parent629bcc68d799ff77a5f174e2f5300f9a26a83521 (diff)
downloadbinutils-ef1a41f20b7ea4799e09b37312dc051245435fd1.zip
binutils-ef1a41f20b7ea4799e09b37312dc051245435fd1.tar.gz
binutils-ef1a41f20b7ea4799e09b37312dc051245435fd1.tar.bz2
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>
Diffstat (limited to 'gdb/extension-priv.h')
-rw-r--r--gdb/extension-priv.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/gdb/extension-priv.h b/gdb/extension-priv.h
index 90810e4..a31283f 100644
--- a/gdb/extension-priv.h
+++ b/gdb/extension-priv.h
@@ -295,6 +295,19 @@ struct extension_language_ops
ext_lang_missing_file_result
(*handle_missing_debuginfo) (const struct extension_language_defn *,
struct objfile *objfile);
+
+ /* Give extension languages a chance to deal with missing objfiles.
+ PSPACE is the program space in which GDB is searching for a missing
+ objfile, and will not be NULL. BUILD_ID is the build-id of the
+ objfile we're looking for, and will not be NULL. FILENAME is the name
+ of the file we're looking for, and will not be NULL. See
+ ext_lang_find_objfile_from_buildid for some additional information
+ about the meaning of FILENAME. */
+ ext_lang_missing_file_result
+ (*find_objfile_from_buildid) (const struct extension_language_defn *,
+ program_space *pspace,
+ const struct bfd_build_id *build_id,
+ const char *filename);
};
/* State necessary to restore a signal handler to its previous value. */