diff options
| author | Mark Wielaard <[email protected]> | 2018-05-13 00:05:10 +0200 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2018-05-19 12:37:24 +0200 |
| commit | a7bcf4322f5e23a638c3b5b6f3cf62855865cc4a (patch) | |
| tree | bce3f42915f51b67d1021af2d8e19a9738083d40 /src | |
| parent | 5e1a9f18aadf4804323ad470e33ddcd17650bc38 (diff) | |
libdw, readelf: Handle .debug_*.dwo section name variants.
The .debug_*.dwo section names are handled just like their none .dwo
variants. The section contents is the same as sections without the .dwo
name, but they are only found in split-dwarf files. This patch allows
opening and inspecting split-dwarf files. It doesn't yet connect the
split-dwarf with their skeleton (or the other way around). It also
doesn't yet handle any special split-dwarf attributes or tags.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/readelf.c | 32 |
2 files changed, 25 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 8a664dae..bf07a79c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2018-05-12 Mark Wielaard <[email protected]> + + * readelf.c (print_debug): Also recognize .dwo section name variants. + 2018-05-15 Dmitry V. Levin <[email protected]> * elflint.c (check_elf_header): Fix typo in error diagnostics. diff --git a/src/readelf.c b/src/readelf.c index 854d31c1..f34dd361 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -9127,17 +9127,27 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr) int n; for (n = 0; n < ndebug_sections; ++n) - if (strcmp (name, debug_sections[n].name) == 0 - || (name[0] == '.' && name[1] == 'z' - && debug_sections[n].name[1] == 'd' - && strcmp (&name[2], &debug_sections[n].name[1]) == 0) - ) - { - if ((print_debug_sections | implicit_debug_sections) - & debug_sections[n].bitmask) - debug_sections[n].fp (dwflmod, ebl, ehdr, scn, shdr, dbg); - break; - } + { + size_t dbglen = strlen (debug_sections[n].name); + size_t scnlen = strlen (name); + if ((strncmp (name, debug_sections[n].name, dbglen) == 0 + && (dbglen == scnlen + || (scnlen == dbglen + 4 + && strstr (name, ".dwo") == name + dbglen))) + || (name[0] == '.' && name[1] == 'z' + && debug_sections[n].name[1] == 'd' + && strncmp (&name[2], &debug_sections[n].name[1], + dbglen - 1) == 0 + && (scnlen == dbglen + 1 + || (scnlen == dbglen + 5 + && strstr (name, ".dwo") == name + dbglen + 1)))) + { + if ((print_debug_sections | implicit_debug_sections) + & debug_sections[n].bitmask) + debug_sections[n].fp (dwflmod, ebl, ehdr, scn, shdr, dbg); + break; + } + } } } |
