From 39f53acb410c3e303fb25ff823de57eb316515ca Mon Sep 17 00:00:00 2001 From: Aaron Merey Date: Wed, 2 Mar 2022 18:46:14 -0500 Subject: gdb: Add soname to build-id mapping for core files Since commit aa2d5a422 gdb has been able to read executable and shared library build-ids within core files. Expand this functionality so that each core file bfd maintains a map of soname to build-id for each shared library referenced in the core file. This feature may be used to verify that gdb has found the correct shared libraries for core files and to facilitate downloading shared libaries via debuginfod. --- gdb/solib.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'gdb/solib.h') diff --git a/gdb/solib.h b/gdb/solib.h index 2258b0b..cd6c8a8 100644 --- a/gdb/solib.h +++ b/gdb/solib.h @@ -118,6 +118,12 @@ extern CORE_ADDR gdb_bfd_lookup_symbol_from_symtab (bfd *abfd, extern int gdb_bfd_scan_elf_dyntag (const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr, CORE_ADDR *ptr_addr); +/* If FILENAME refers to an ELF shared object then attempt to return the + string referred to by its DT_SONAME tag. */ + +extern gdb::unique_xmalloc_ptr gdb_bfd_read_elf_soname + (const char *filename); + /* Enable or disable optional solib event breakpoints as appropriate. */ extern void update_solib_breakpoints (void); @@ -126,4 +132,18 @@ extern void update_solib_breakpoints (void); extern void handle_solib_event (void); +/* Associate SONAME with BUILD_ID in ABFD's registry so that it can be + retrieved with get_cbfd_soname_build_id. */ + +extern void set_cbfd_soname_build_id (gdb_bfd_ref_ptr abfd, + const char *soname, + const bfd_build_id *build_id); + +/* If SONAME had a build-id associated with it in ABFD's registry by a + previous call to set_cbfd_soname_build_id then return the build-id + as a NULL-terminated hex string. */ + +extern gdb::unique_xmalloc_ptr get_cbfd_soname_build_id + (gdb_bfd_ref_ptr abfd, const char *soname); + #endif /* SOLIB_H */ -- cgit v1.1