llvm.org GIT mirror llvm / 2e110c3
DebugInfo: Make pubnames header printing similar to unit header printing In a failed attempt to allow the gnu-public-names.ll test case to not hardcode the size of the unit that the pubnames section referred to I've at least managed to have unit headers and pubnames headers print out in a similar style. This failed to achieve the desired goal because the header in a unit specifies the length of the unit without the length element of the header whereas the length in the pubnames includes this element, so the numbers are off by 4 bytes. I don't know of any arithmetic powers in FileCheck so the test case can't simply say "CU_LENGTH + 4". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193872 91177308-0d34-0410-b5e6-96231b3b80d8 David Blaikie 5 years ago
4 changed file(s) with 8 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
3333 OS << "\n." << Name << " contents:\n";
3434 DataExtractor pubNames(Data, LittleEndian, 0);
3535 uint32_t offset = 0;
36 OS << "Length: " << pubNames.getU32(&offset) << "\n";
37 OS << "Version: " << pubNames.getU16(&offset) << "\n";
38 OS << "Offset in .debug_info: " << pubNames.getU32(&offset) << "\n";
39 OS << "Size: " << pubNames.getU32(&offset) << "\n";
36 OS << "length = " << format("0x%08x", pubNames.getU32(&offset));
37 OS << " version = " << format("0x%04x", pubNames.getU16(&offset));
38 OS << " unit_offset = " << format("0x%08x", pubNames.getU32(&offset));
39 OS << " unit_size = " << format("0x%08x", pubNames.getU32(&offset)) << '\n';
4040 if (GnuStyle)
4141 OS << "Offset Linkage Kind Name\n";
4242 else
103103 ; CHECK-NEXT: DW_AT_name {{.*}} "global_function"
104104
105105 ; CHECK-LABEL: .debug_gnu_pubnames contents:
106 ; CHECK-NEXT: Length: 231
107 ; CHECK-NEXT: Version: 2
108 ; CHECK-NEXT: Offset in .debug_info: 0
109 ; CHECK-NEXT: Size: 379
106 ; CHECK-NEXT: length = 0x000000e7 version = 0x0002 unit_offset = 0x00000000 unit_size = 0x0000017b
110107 ; CHECK-NEXT: Offset Linkage Kind Name
111108 ; CHECK-DAG: [[GLOBAL_FUNC]] EXTERNAL FUNCTION "global_function"
112109 ; CHECK-DAG: [[NS]] EXTERNAL TYPE "ns"
120117
121118
122119 ; CHECK-LABEL: debug_gnu_pubtypes contents:
123 ; CHECK-NEXT: Length:
124 ; CHECK-NEXT: Version:
125 ; CHECK-NEXT: Offset in .debug_info:
126 ; CHECK-NEXT: Size:
127 ; CHECK-NEXT: Offset Linkage Kind Name
120 ; CHECK: Offset Linkage Kind Name
128121 ; CHECK-DAG: [[C]] EXTERNAL TYPE "C"
129122 ; CHECK-DAG: [[D]] EXTERNAL TYPE "ns::D"
130123 ; CHECK-DAG: [[INT]] STATIC TYPE "int"
3636
3737 ; Skip the output to the header of the pubnames section.
3838 ; CHECK: debug_pubnames
39 ; CHECK: Version: 2
39 ; CHECK: version = 0x0002
4040
4141 ; Check for each name in the output.
4242 ; CHECK: global_namespace_variable
11 RUN: -debug-dump=pubnames | FileCheck %s
22
33 CHECK: .debug_pubnames contents:
4 CHECK: Length: 161
5 CHECK: Version: 2
6 CHECK: Offset in .debug_info: 0
7 CHECK: Size: 321
4 CHECK: length = 0x000000a1 version = 0x0002 unit_offset = 0x00000000 unit_size = 0x00000141
85
96 CHECK: Offset Name
107 CHECK: 0x00000098 "global_namespace_variable"