]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdw: Recognize .debug_dwp section in scn_dwarf_type as TYPE_DWO
authorMark Wielaard <mark@klomp.org>
Mon, 13 Apr 2026 21:30:45 +0000 (23:30 +0200)
committerMark Wielaard <mark@klomp.org>
Tue, 14 Apr 2026 00:07:01 +0000 (02:07 +0200)
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 <mark@klomp.org>
libdw/dwarf_begin_elf.c

index dd30f79b34a40e2c5a831fef768c86b9774c52f9..7b58ad2e221828d885e52b7a2beafe55b2d2fc2f 100644 (file)
@@ -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_"))
        {