dwarf_begin_elf tries to guess what type of Dwarf we have. When it
sees a .debug_dwp section it assumed it was TYPE_PLAIN instead of
TYPE_DWO and would try to find more "plain" .debug sections (ignoring
other .dwo sections). This would cause it to not detect any debug
sections in a .dwp file containing a .debug_dwp section.

        * libdw/dwarf_begin_elf.c (scn_dwarf_type): Recognize
        .debug_dwp or .zdebug_dwp sections.

Signed-off-by: Mark Wielaard <[email protected]>
---
 libdw/dwarf_begin_elf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c
index dd30f79b34a4..7b58ad2e2218 100644
--- a/libdw/dwarf_begin_elf.c
+++ b/libdw/dwarf_begin_elf.c
@@ -115,8 +115,10 @@ scn_dwarf_type (Dwarf *result, size_t shstrndx, Elf_Scn 
*scn)
        return TYPE_GNU_LTO;
       else if (strcmp (scnname, ".debug_cu_index") == 0
               || strcmp (scnname, ".debug_tu_index") == 0
+              || strcmp (scnname, ".debug_dwp") == 0
               || strcmp (scnname, ".zdebug_cu_index") == 0
-              || strcmp (scnname, ".zdebug_tu_index") == 0)
+              || strcmp (scnname, ".zdebug_tu_index") == 0
+              || strcmp (scnname, ".zdebug_dwp") == 0)
        return TYPE_DWO;
       else if (startswith (scnname, ".debug_") || startswith (scnname, 
".zdebug_"))
        {
-- 
2.53.0

Reply via email to