summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2018-05-29 09:44:38 +0200
committerMark Wielaard <[email protected]>2018-05-31 14:20:25 +0200
commitc7fc54a27c0eac667f0060f277606df8208f05d7 (patch)
treef4f815614409709425eb7aafdea062ffa051a7ae /src
parente9e64f6748499d458b951e0dcd46d6cc9d850886 (diff)
readelf: Fix regression with multiple files and implicit debug_info reading.
Commit 314e9d7d "readelf: Handle .debug_info first if any other debug section needs it" introduced a regression when handling multiple files. The implicit and explicit printing of debuginfo weren't reset and so the second file would not show (or scan) the .debug_info section when needed. Fix by resetting the implicit and explicit section printing flags. Add a testcase that prints the .debug_loc section for two files and check that the CUs are resolved. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/readelf.c10
2 files changed, 14 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b6f66bdd..e7ba6cb1 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2018-05-29 Mark Wielaard <[email protected]>
+
+ * readelf.c (print_debug): Record and reset section_info status in
+ implicit_debug_sections and print_debug_sections.
+
2018-05-28 Mark Wielaard <[email protected]>
* readelf.c (print_debug_units): Turn "Could not find split compile
diff --git a/src/readelf.c b/src/readelf.c
index bfa1d16d..390f2444 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -10894,7 +10894,9 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr)
we must make sure to handle it before handling any other debug
section. Various other sections depend on the CU DIEs being
scanned (silently) first. */
- if ((implicit_debug_sections & section_info) != 0)
+ bool implicit_info = (implicit_debug_sections & section_info) != 0;
+ bool explicit_info = (print_debug_sections & section_info) != 0;
+ if (implicit_info)
{
Elf_Scn *scn = NULL;
while ((scn = elf_nextscn (ebl->elf, scn)) != NULL)
@@ -11012,6 +11014,12 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr)
dwfl_end (skel_dwfl);
free (skel_name);
+ /* Turn implicit and/or explicit back on in case we go over another file. */
+ if (implicit_info)
+ implicit_debug_sections |= section_info;
+ if (explicit_info)
+ print_debug_sections |= section_info;
+
reset_listptr (&known_locsptr);
reset_listptr (&known_loclistsptr);
reset_listptr (&known_rangelistptr);