Skip to content

Commit 8e1f820

Browse files
committed
[dsymutil] Update DWARF 5 tests after 8119ab9
Update test affected by 8119ab9 and address Adrian's post commit review feedback.
1 parent f4f826b commit 8e1f820

File tree

3 files changed

+36
-37
lines changed

3 files changed

+36
-37
lines changed

llvm/test/tools/dsymutil/ARM/dwarf5-dwarf4-combination-macho.test

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
; This test checks to ensure that if a DWARF v5 and DWARF v4 object file is used to
22
; generate a dsym, dsymutil correctly outputs the debug information, by keeping
3-
; the DWARF v5 and DWARF v4 debug info distinct, and that all the section headers
3+
; the DWARF v5 and DWARF v4 debug info distinct, and that all the section headers
44
; have the correct format.
55

66
; 1.o was produced with the source file:
77

88
; a.cpp
99
; __attribute__((section("1,__text_foo"))) void foo() {}
10-
;
10+
;
1111
; int foo2(int a) {
1212
; return a+5;
1313
; }
@@ -21,7 +21,7 @@
2121

2222
; b.cpp
2323
; __attribute__((section("1,__text_foo2"))) void foo2() {}
24-
;
24+
;
2525
; int bar(int x) {
2626
; int y = x + 2;
2727
; return y;
@@ -39,19 +39,19 @@ CHECK:.debug_abbrev contents:
3939
CHECK-NEXT: Abbrev table for offset: 0x00000000
4040

4141
CHECK: .debug_info contents:
42-
CHECK-NEXT: 0x00000000: Compile Unit: length = 0x0000007d, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000081)
42+
CHECK: 0x00000000: Compile Unit: length = 0x00000064, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000068)
4343
CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[RANGELIST_OFFSET:[0-9a-f]+]]
4444
CHECK-NEXT: [0x[[RANGELIST_OFFSET_START:[0-9a-f]+]], 0x[[RANGELIST_OFFSET_END:[0-9a-f]+]]))
45-
CHECK: 0x00000050: DW_TAG_formal_parameter [3] (0x00000033)
46-
CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOCLIST_OFFSET:[0-9a-f]+]]:
45+
CHECK: DW_TAG_formal_parameter [3] (0x00000033)
46+
CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOCLIST_OFFSET:[0-9a-f]+]]:
4747
CHECK-NEXT: [0x[[LOCLIST_OFFSET_START:[0-9a-f]+]], 0x[[LOCLIST_OFFSET_END:[0-9a-f]+]]): [[LOCLIST_EXPR:.*]]
4848
CHECK-NEXT: [0x[[LOCLIST_OFFSET_START2:[0-9a-f]+]], 0x[[LOCLIST_OFFSET_END2:[0-9a-f]+]]): [[LOCLIST_EXPR2:.*]])
4949

50-
CHECK: 0x00000081: Compile Unit: length = 0x00000072, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x000000f7)
50+
CHECK: 0x00000068: Compile Unit: length = 0x00000072, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x000000de)
5151
CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000
5252
CHECK-NEXT: [0x00000000000200[[RANGE_OFFSET_START:[0-9a-f][0-9a-f]]], 0x00000000000200[[RANGE_OFFSET_END:[0-9a-f][0-9a-f]]]))
53-
CHECK:0x000000d0: DW_TAG_formal_parameter [3] (0x000000b3)
54-
CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOC_OFFSET:[0-9a-f]+]]:
53+
CHECK: DW_TAG_formal_parameter [3] (0x0000009a)
54+
CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOC_OFFSET:[0-9a-f]+]]:
5555
CHECK-NEXT: [0x00000000000200[[LOC_OFFSET_START:[0-9a-f][0-9a-f]]], 0x00000000000200[[LOC_OFFSET_END:[0-9a-f][0-9a-f]]]): [[LOC_EXPR:.*]]
5656
CHECK-NEXT: [0x00000000000200[[LOC_OFFSET_START2:[0-9a-f][0-9a-f]]], 0x00000000000200[[LOC_OFFSET_END2:[0-9a-f][0-9a-f]]]): [[LOC_EXPR2:.*]])
5757

@@ -62,7 +62,7 @@ CHECK-NEXT: (0x0000000000000004, 0x0000000000000008): [[LOC_EXPR2:.*]
6262

6363
CHECK: .debug_loclists contents:
6464
CHECK-NEXT: 0x00000000: locations list header: length = 0x00000024, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
65-
CHECK-NEXT: 0x[[LOCLIST_OFFSET]]:
65+
CHECK-NEXT: 0x[[LOCLIST_OFFSET]]:
6666
CHECK-NEXT: DW_LLE_start_length {{.*}}
6767
CHECK-NEXT: => [0x[[LOCLIST_OFFSET_START]], 0x[[LOCLIST_OFFSET_END]]): [[LOCLIST_EXPR]]
6868
CHECK-NEXT: DW_LLE_start_length {{.*}}
@@ -72,7 +72,7 @@ CHECK-NEXT: DW_LLE_end_of_list ()
7272
CHECK: .debug_line contents:
7373
CHECK-NEXT: debug_line[0x00000000]
7474
CHECK-NEXT: Line table prologue:
75-
CHECK-NEXT: total_length: 0x00000050
75+
CHECK-NEXT: total_length: 0x00000048
7676
CHECK-NEXT: format: DWARF32
7777
CHECK-NEXT: version: 5
7878
CHECK-NEXT: address_size: 8
@@ -101,7 +101,7 @@ CHECK-NEXT: file_names[ 0]:
101101
CHECK-NEXT: name: .debug_line_str[0x00000029] = "a.cpp"
102102
CHECK-NEXT: dir_index: 0
103103

104-
CHECK: debug_line[0x00000054]
104+
CHECK: debug_line[0x0000004c]
105105
CHECK-NEXT: Line table prologue:
106106
CHECK-NEXT: total_length: 0x0000003b
107107
CHECK-NEXT: format: DWARF32
@@ -148,14 +148,14 @@ CHECK-NEXT: [[RANGELIST_OFFSET]]: [DW_RLE_start_length]: {{.*}}[0x[[RANGELIST_OF
148148
CHECK: .debug_names contents:
149149
CHECK-NEXT: Name Index @ 0x0 {
150150
CHECK-NEXT: Header {
151-
CHECK-NEXT: Length: 0xD4
151+
CHECK-NEXT: Length: 0xBC
152152
CHECK-NEXT: Format: DWARF32
153153
CHECK-NEXT: Version: 5
154154
CHECK-NEXT: CU count: 2
155155
CHECK-NEXT: Local TU count: 0
156156
CHECK-NEXT: Foreign TU count: 0
157-
CHECK-NEXT: Bucket count: 6
158-
CHECK-NEXT: Name count: 6
157+
CHECK-NEXT: Bucket count: 5
158+
CHECK-NEXT: Name count: 5
159159
CHECK-NEXT: Abbreviations table size: 0x11
160160
CHECK-NEXT: Augmentation: 'LLVM0700'
161161
CHECK-NEXT: }

llvm/test/tools/dsymutil/ARM/dwarf5-macho.test

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
; a.cpp
88
; __attribute__((section("1,__text_foo"))) void foo() {}
9-
;
9+
;
1010
; int foo2(int a) {
1111
; return a+5;
1212
; }
@@ -25,17 +25,17 @@ CHECK:.debug_abbrev contents:
2525
CHECK-NEXT: Abbrev table for offset: 0x00000000
2626

2727
CHECK: .debug_info contents:
28-
CHECK-NEXT: 0x00000000: Compile Unit: length = 0x0000007d, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000081)
28+
CHECK-NEXT: 0x00000000: Compile Unit: length = 0x00000064, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000068)
2929
CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[RANGE_OFFSET:[0-9a-f]+]]
3030
CHECK-NEXT: [0x[[RANGE_OFFSET_START:[0-9a-f]+]], 0x[[RANGE_OFFSET_END:[0-9a-f]+]]))
3131
CHECK: 0x00000050: DW_TAG_formal_parameter [3] (0x00000033)
32-
CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOC_OFFSET:[0-9a-f]+]]:
32+
CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOC_OFFSET:[0-9a-f]+]]:
3333
CHECK-NEXT: [0x[[LOC_OFFSET_START:[0-9a-f]+]], 0x[[LOC_OFFSET_END:[0-9a-f]+]]): [[LOC_EXPR:.*]]
3434
CHECK-NEXT: [0x[[LOC_OFFSET_START2:[0-9a-f]+]], 0x[[LOC_OFFSET_END2:[0-9a-f]+]]): [[LOC_EXPR2:.*]])
3535

3636
CHECK: .debug_loclists contents:
3737
CHECK-NEXT: 0x00000000: locations list header: length = 0x00000024, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
38-
CHECK-NEXT: 0x[[LOC_OFFSET]]:
38+
CHECK-NEXT: 0x[[LOC_OFFSET]]:
3939
CHECK-NEXT: DW_LLE_start_length {{.*}}
4040
CHECK-NEXT: => [0x[[LOC_OFFSET_START]], 0x[[LOC_OFFSET_END]]): [[LOC_EXPR]]
4141
CHECK-NEXT: DW_LLE_start_length {{.*}}
@@ -45,7 +45,7 @@ CHECK-NEXT: DW_LLE_end_of_list ()
4545
CHECK: .debug_line contents:
4646
CHECK-NEXT: debug_line[0x00000000]
4747
CHECK-NEXT: Line table prologue:
48-
CHECK-NEXT: total_length: 0x00000050
48+
CHECK-NEXT: total_length: 0x00000048
4949
CHECK-NEXT: format: DWARF32
5050
CHECK-NEXT: version: 5
5151
CHECK-NEXT: address_size: 8
@@ -87,17 +87,16 @@ CHECK-NEXT: ranges:
8787
CHECK-NEXT: [[RANGE_OFFSET]]: [DW_RLE_start_length]: {{.*}}[0x[[RANGE_OFFSET_START]], 0x[[RANGE_OFFSET_END]])
8888

8989
CHECK: .debug_names contents:
90-
CHECK-NEXT: Name Index @ 0x0 {
91-
CHECK-NEXT: Header {
92-
CHECK-NEXT: Length: 0x94
93-
CHECK-NEXT: Format: DWARF32
94-
CHECK-NEXT: Version: 5
95-
CHECK-NEXT: CU count: 1
96-
CHECK-NEXT: Local TU count: 0
97-
CHECK-NEXT: Foreign TU count: 0
98-
CHECK-NEXT: Bucket count: 4
99-
CHECK-NEXT: Name count: 4
100-
CHECK-NEXT: Abbreviations table size: 0xD
101-
CHECK-NEXT: Augmentation: 'LLVM0700'
102-
CHECK-NEXT: }
103-
90+
CHECK-NEX:T Name Index @ 0x0 {
91+
CHECK-NEX:T Header {
92+
CHECK-NEX:T Length: 0x7C
93+
CHECK-NEX:T Format: DWARF32
94+
CHECK-NEX:T Version: 5
95+
CHECK-NEX:T CU count: 1
96+
CHECK-NEX:T Local TU count: 0
97+
CHECK-NEX:T Foreign TU count: 0
98+
CHECK-NEX:T Bucket count: 3
99+
CHECK-NEX:T Name count: 3
100+
CHECK-NEX:T Abbreviations table size: 0xD
101+
CHECK-NEX:T Augmentation: 'LLVM0700'
102+
CHECK-NEX:T }

llvm/tools/dsymutil/DwarfLinkerForBinary.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,10 +1083,10 @@ std::optional<int64_t> DwarfLinkerForBinary::AddressManager<
10831083
DIE.getDwarfUnit()->getAddrOffsetSectionBase()) {
10841084
// Addrx is a index into the debug_addr section, not an offset, so we need
10851085
// to multiply by byte size.
1086-
const uint64_t ByteSize = DIE.getDwarfUnit()->getAddressByteSize();
1086+
const uint64_t AddrSize = DIE.getDwarfUnit()->getAddressByteSize();
10871087
const uint64_t StartOffset =
1088-
*AddrOffsetSectionBase + (AddrValue->getRawUValue() * ByteSize);
1089-
const uint64_t EndOffset = StartOffset + ByteSize;
1088+
*AddrOffsetSectionBase + (AddrValue->getRawUValue() * AddrSize);
1089+
const uint64_t EndOffset = StartOffset + AddrSize;
10901090
return hasValidRelocationAt(ValidDebugAddrRelocs, StartOffset, EndOffset);
10911091
}
10921092

0 commit comments

Comments
 (0)