[PATCH] D101255: [DebugInfo][llvm-dwarfdump] Fix dumping of unit header with DW_UT_partial type

Alok Kumar Sharma via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 25 22:08:34 PDT 2021


alok updated this revision to Diff 340433.
alok added a comment.

Updated to do minor correction in comment of test case.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101255/new/

https://reviews.llvm.org/D101255

Files:
  llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp
  llvm/test/DebugInfo/X86/dwarfdump-header.s


Index: llvm/test/DebugInfo/X86/dwarfdump-header.s
===================================================================
--- llvm/test/DebugInfo/X86/dwarfdump-header.s
+++ llvm/test/DebugInfo/X86/dwarfdump-header.s
@@ -59,6 +59,13 @@
         .byte 0x0e  # DW_FORM_strp
         .byte 0x00  # EOM(1)
         .byte 0x00  # EOM(2)
+        .byte 0x04  # Abbrev code
+        .byte 0x3c  # DW_TAG_partial_unit
+        .byte 0x00  # DW_CHILDREN_no
+        .byte 0x03  # DW_AT_name
+        .byte 0x0e  # DW_FORM_strp
+        .byte 0x00  # EOM(1)
+        .byte 0x00  # EOM(2)
         .byte 0x00  # EOM(3)
 
 # And a .dwo copy for the .dwo sections.
@@ -128,6 +135,22 @@
 # CHECK: 0x00000019: Compile Unit: length = 0x00000016, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000033)
 # CHECK: 0x00000025: DW_TAG_compile_unit
 
+# DWARF v5 CU header (Unit Type = DW_UT_partial).
+        .long  CU_5_partial_end-CU_5_partial_version  # Length of Unit
+CU_5_partial_version:
+        .short 5               # DWARF version number
+        .byte 3                # DWARF Unit Type
+        .byte 8                # Address Size (in bytes)
+        .long .debug_abbrev    # Offset Into Abbrev. Section
+# The partial-unit DIE, with DW_AT_name
+        .byte 4
+        .long str_CU_5
+        .byte 0 # NULL
+CU_5_partial_end:
+
+# CHECK: 0x00000033: Compile Unit: length = 0x0000000e, format = DWARF32, version = 0x0005, unit_type = DW_UT_partial, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000045)
+# CHECK: 0x0000003f: DW_TAG_partial_unit
+
         .section .debug_info.dwo,"e", at progbits
 # CHECK-LABEL: .debug_info.dwo
 
Index: llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp
@@ -26,7 +26,8 @@
   if (!getAbbreviations())
     OS << " (invalid)";
   OS << ", addr_size = " << format("0x%02x", getAddressByteSize());
-  if (getVersion() >= 5 && getUnitType() != dwarf::DW_UT_compile)
+  if (getVersion() >= 5 && (getUnitType() == dwarf::DW_UT_skeleton ||
+                            getUnitType() == dwarf::DW_UT_split_compile))
     OS << ", DWO_id = " << format("0x%016" PRIx64, *getDWOId());
   OS << " (next unit at " << format("0x%08" PRIx64, getNextUnitOffset())
      << ")\n";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101255.340433.patch
Type: text/x-patch
Size: 2436 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210426/bc2ffd48/attachment.bin>


More information about the llvm-commits mailing list