summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2014-05-01 14:48:27 +0200
committerMark Wielaard <[email protected]>2014-05-02 17:00:48 +0200
commitdf85bf99021119fcbb2ced66dd69f1cceafb180c (patch)
treea0ee033052e69b9b00e87ee31bf4962dac3cec17 /src
parentd81d32d2a4f92355e4c677b578147dfe819251b9 (diff)
libdwfl: Move dwz alt multi file searching to find_debuginfo callback.
Don't hard code the Dwarf dwz alt multi file search but allow the user to override it through the standard Dwfl_Callbacks. Also move ownership completely to the user of dwarf_setalt by removing free_alt from Dwarf and adding alt, fd and elf fields to Dwfl_Module. Add a relative .dwz file test case. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/readelf.c34
2 files changed, 29 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 429a7eea..341787d6 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2014-05-01 Mark Wielaard <[email protected]>
+
+ * readelf.c (find_no_debuginfo): Call dwfl_standard_find_debuginfo
+ if looking for alternate debug file.
+
2014-04-11 Mark Wielaard <[email protected]>
* Makefile.am (AM_CPPFLAGS): Add -I libdwelf.
diff --git a/src/readelf.c b/src/readelf.c
index 697a361b..45b19105 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -693,18 +693,32 @@ process_dwflmod (Dwfl_Module *dwflmod,
return DWARF_CB_OK;
}
-/* Stub libdwfl callback, only the ELF handle already open is ever used. */
+/* Stub libdwfl callback, only the ELF handle already open is ever used.
+ Only used for finding the alternate debug file if the Dwarf comes from
+ the main file. We are not interested in separate debuginfo. */
static int
-find_no_debuginfo (Dwfl_Module *mod __attribute__ ((unused)),
- void **userdata __attribute__ ((unused)),
- const char *modname __attribute__ ((unused)),
- Dwarf_Addr base __attribute__ ((unused)),
- const char *file_name __attribute__ ((unused)),
- const char *debuglink_file __attribute__ ((unused)),
- GElf_Word debuglink_crc __attribute__ ((unused)),
- char **debuginfo_file_name __attribute__ ((unused)))
+find_no_debuginfo (Dwfl_Module *mod,
+ void **userdata,
+ const char *modname,
+ Dwarf_Addr base,
+ const char *file_name,
+ const char *debuglink_file,
+ GElf_Word debuglink_crc,
+ char **debuginfo_file_name)
{
- return -1;
+ Dwarf_Addr dwbias;
+ dwfl_module_info (mod, NULL, NULL, NULL, &dwbias, NULL, NULL, NULL);
+
+ /* We are only interested if the Dwarf has been setup on the main
+ elf file but is only missing the alternate debug link. If dwbias
+ hasn't even been setup, this is searching for separate debuginfo
+ for the main elf. We don't care in that case. */
+ if (dwbias == (Dwarf_Addr) -1)
+ return -1;
+
+ return dwfl_standard_find_debuginfo (mod, userdata, modname, base,
+ file_name, debuglink_file,
+ debuglink_crc, debuginfo_file_name);
}
/* Process one input file. */