[DebugInfo] Report the format of type units [10/10]
authorIgor Kudrin <ikudrin@accesssoftek.com>
Tue, 2 Jun 2020 09:14:48 +0000 (16:14 +0700)
committerIgor Kudrin <ikudrin@accesssoftek.com>
Tue, 2 Jun 2020 10:55:31 +0000 (17:55 +0700)
Differential Revision: https://reviews.llvm.org/D80523

llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp
llvm/test/DebugInfo/X86/dwarfdump-header.s
llvm/test/DebugInfo/typeunit-header.test
llvm/test/tools/llvm-dwarfdump/X86/typeunit-v4-dwarf64.s
llvm/test/tools/llvm-dwarfdump/X86/typeunit-v5-dwarf64.s
llvm/test/tools/llvm-dwp/X86/simple.test
llvm/test/tools/llvm-dwp/X86/type_dedup.test

index c06c20b..c219f34 100644 (file)
@@ -32,6 +32,7 @@ void DWARFTypeUnit::dump(raw_ostream &OS, DIDumpOptions DumpOpts) {
 
   OS << format("0x%08" PRIx64, getOffset()) << ": Type Unit:"
      << " length = " << format("0x%0*" PRIx64, OffsetDumpWidth, getLength())
+     << ", format = " << dwarf::FormatString(getFormat())
      << ", version = " << format("0x%04x", getVersion());
   if (getVersion() >= 5)
     OS << ", unit_type = " << dwarf::UnitTypeString(getUnitType());
index 024b4bd..3d1c538 100644 (file)
@@ -181,7 +181,7 @@ TU_split_5_type:
         .byte 0 # NULL
 TU_split_5_end:
 
-# CHECK: 0x00000000: Type Unit: length = 0x00000020, version = 0x0005, unit_type = DW_UT_split_type, abbr_offset = 0x0000, addr_size = 0x08, name = 'V5_split_type_unit', type_signature = 0x8899aabbccddeeff, type_offset = 0x001d (next unit at 0x00000024)
+# CHECK: 0x00000000: Type Unit: length = 0x00000020, format = DWARF32, version = 0x0005, unit_type = DW_UT_split_type, abbr_offset = 0x0000, addr_size = 0x08, name = 'V5_split_type_unit', type_signature = 0x8899aabbccddeeff, type_offset = 0x001d (next unit at 0x00000024)
 # CHECK: 0x00000018: DW_TAG_type_unit
 
         .section .debug_types,"",@progbits
@@ -207,7 +207,7 @@ TU_4_type:
         .byte 0 # NULL
 TU_4_end:
 
-# CHECK: 0x00000000: Type Unit: length = 0x0000001f, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08, name = 'V4_type_unit', type_signature = 0x0011223344556677, type_offset = 0x001c (next unit at 0x00000023)
+# CHECK: 0x00000000: Type Unit: length = 0x0000001f, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08, name = 'V4_type_unit', type_signature = 0x0011223344556677, type_offset = 0x001c (next unit at 0x00000023)
 # CHECK: 0x00000017: DW_TAG_type_unit
 
         .section .debug_line,"",@progbits
index e73cc6c..f32cd41 100644 (file)
@@ -10,6 +10,6 @@ We make sure that llvm-dwarfdump is parsing the type unit header correctly
 and displays it. 
 
 CHECK: .debug_types contents:
-CHECK: 0x00000000: Type Unit: length = 0x00000019, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08, name = '', type_signature = 0x0011223344556677, type_offset = 0x0019 (next unit at 0x0000001d)
+CHECK: 0x00000000: Type Unit: length = 0x00000019, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08, name = '', type_signature = 0x0011223344556677, type_offset = 0x0019 (next unit at 0x0000001d)
 CHECK: 0x00000017: DW_TAG_type_unit [1] *
 CHECK: DW_AT_visibility [DW_FORM_data1] (DW_VIS_local)
index 6b9eff3..3077e6c 100644 (file)
@@ -26,6 +26,7 @@ TU_4_64_start:
         .long 0xffffffff            # DWARF64 mark
         .quad TU_4_64_end-TU_4_64_version  # Length of Unit
 # CHECK-SAME: length = 0x0000000000000021
+# CHECK-SAME: format = DWARF64
 TU_4_64_version:
         .short 4                    # DWARF version number
 # CHECK-SAME: version = 0x0004
index de07dd1..d0215ff 100644 (file)
@@ -26,6 +26,7 @@ TU_5_64_start:
         .long 0xffffffff            # DWARF64 mark
         .quad TU_5_64_end-TU_5_64_version  # Length of Unit
 # CHECK-SAME: length = 0x0000000000000022
+# CHECK-SAME: format = DWARF64
 TU_5_64_version:
         .short 5                    # DWARF version number
 # CHECK-SAME: version = 0x0005
index b74db32..9fb1b03 100644 (file)
@@ -55,13 +55,13 @@ CHECK:     DW_TAG_formal_parameter
 NOTYP-NOT: .debug_types.dwo contents:
 TYPES-LABEL: .debug_types.dwo contents:
 TYPES: [[FOOUOFF:0x[0-9a-f]*]]:
-TYPES-LABEL: Type Unit: length = 0x00000020, version = 0x0004, abbr_offset =
+TYPES-LABEL: Type Unit: length = 0x00000020, format = DWARF32, version = 0x0004, abbr_offset =
 TYPES:         0x[[AAOFF]], addr_size = 0x08, name = 'foo', type_signature = [[FOOSIG]], type_offset = 0x[[FOOOFF:.*]] (next unit at [[BARUOFF:.*]])
 TYPES:             DW_TAG_type_unit
 TYPES: [[FOOOFF]]:   DW_TAG_structure_type
 TYPES:                 DW_AT_name {{.*}} "foo"
 TYPES: [[BARUOFF]]:
-TYPES-LABEL: Type Unit: length = 0x00000020, version = 0x0004, abbr_offset =
+TYPES-LABEL: Type Unit: length = 0x00000020, format = DWARF32, version = 0x0004, abbr_offset =
 TYPES:         0x[[BAOFF]], addr_size = 0x08, name = 'bar', type_signature = [[BARSIG]], type_offset = 0x001e (next unit at [[XUOFF:.*]])
 TYPES:             DW_TAG_type_unit
 TYPES: 0x00000042:   DW_TAG_structure_type
index d7044d0..a59de66 100644 (file)
@@ -18,19 +18,19 @@ b.cpp:
 
 CHECK-LABEL: .debug_types.dwo contents:
 CHECK: [[COMMONUOFF:0x[0-9a-f]*]]:
-CHECK-LABEL: Type Unit: length = 0x00000020, version = 0x0004, abbr_offset =
+CHECK-LABEL: Type Unit: length = 0x00000020, format = DWARF32, version = 0x0004, abbr_offset =
 CHECK:         0x0000, addr_size = 0x08, name = 'common', type_signature = [[COMMONSIG:0x[0-9a-f]*]], type_offset = 0x[[COMMONOFF:.*]] (next unit at [[AUOFF:.*]])
 CHECK:                DW_TAG_type_unit
 CHECK: [[COMMONOFF]]:   DW_TAG_structure_type
 CHECK:                    DW_AT_name {{.*}} "common"
 CHECK: [[AUOFF]]:
-CHECK-LABEL: Type Unit: length = 0x00000020, version = 0x0004, abbr_offset =
+CHECK-LABEL: Type Unit: length = 0x00000020, format = DWARF32, version = 0x0004, abbr_offset =
 CHECK:         0x0000, addr_size = 0x08, name = 'adistinct', type_signature = [[ASIG:0x[0-9a-f]*]], type_offset = 0x[[AOFF:.*]] (next unit at [[BUOFF:.*]])
 CHECK:             DW_TAG_type_unit
 CHECK: 0x00000042:   DW_TAG_structure_type
 CHECK:                 DW_AT_name {{.*}} "adistinct"
 CHECK: [[BUOFF]]:
-CHECK-LABEL: Type Unit: length = 0x00000020, version = 0x0004, abbr_offset =
+CHECK-LABEL: Type Unit: length = 0x00000020, format = DWARF32, version = 0x0004, abbr_offset =
 CHECK:         0x{{.*}}, addr_size = 0x08, name = 'bdistinct', type_signature = [[BSIG:0x[0-9a-f]*]], type_offset = 0x[[BOFF:.*]] (next unit at [[XUOFF:.*]])
 CHECK:             DW_TAG_type_unit
 CHECK: 0x00000066:   DW_TAG_structure_type