File: dwarf5-dwarf4-combination-macho.test

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (236 lines) | stat: -rw-r--r-- 12,008 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
; This test checks to ensure that if a DWARF v5 and DWARF v4 object file is used to
; generate a dsym, dsymutil correctly outputs the debug information, by keeping
; the DWARF v5 and DWARF v4 debug info distinct, and that all the section headers
; have the correct format.

; 1.o was produced with the source file:

; a.cpp
; __attribute__((section("1,__text_foo"))) void foo() {}
;
; int foo2(int a) {
;     return a+5;
; }
; int main () {
;     return 1;
; }

; clang -g -c -O1 a.cpp -Xclang -gdwarf-5 -o 1.o

; 2.o was produced with the following source file:

; b.cpp
; __attribute__((section("1,__text_foo2"))) void foo2() {}
;
; int bar(int x) {
;     int y = x + 2;
;     return y;
; }

; clang -g -c -O1 b.cpp -gdwarf-4 -o 2.o

RUN: rm -rf %t.dir && mkdir -p %t.dir
RUN: dsymutil -y %p/dummy-debug-map-amr64.map -oso-prepend-path=%p/../Inputs/DWARF5-DWARF4-combination -o %t.dir/dwarf5-dwarf4-combination-macho.dSYM
RUN: llvm-dwarfdump %t.dir/dwarf5-dwarf4-combination-macho.dSYM -a --verbose | FileCheck %s --check-prefixes=CHECK,WITH-PARENTS

RUN: rm -rf %t.dir && mkdir -p %t.dir
RUN: dsymutil --no-odr --linker parallel -y %p/dummy-debug-map-amr64.map \
RUN:   -oso-prepend-path=%p/../Inputs/DWARF5-DWARF4-combination \
RUN:   -o %t.dir/dwarf5-dwarf4-combination-macho.dSYM
RUN: llvm-dwarfdump %t.dir/dwarf5-dwarf4-combination-macho.dSYM \
RUN:   -a --verbose | FileCheck %s --check-prefixes=CHECK,NO-PARENTS

### Uncomment following when llvm-dwarfdump will dump address ranges
### correctly for severall compile units case.
COM: rm -rf %t.dir && mkdir -p %t.dir
COM: dsymutil --linker parallel -y %p/dummy-debug-map-amr64.map \
COM:   -oso-prepend-path=%p/../Inputs/DWARF5-DWARF4-combination \
COM:   -o %t.dir/dwarf5-dwarf4-combination-macho.dSYM
COM: llvm-dwarfdump %t.dir/dwarf5-dwarf4-combination-macho.dSYM \
COM:   -a --verbose | FileCheck %s --check-prefixes=CHECK,CHECK-LLVM


CHECK:.debug_abbrev contents:
CHECK-NEXT: Abbrev table for offset: 0x00000000

CHECK: .debug_info contents:
CHECK-LLVM: Compile Unit: length = 0x0000001f,  format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = {{.*}}, addr_size = 0x08
CHECK-LLVM: DW_TAG_compile_unit
CHECK-LLVM: DW_TAG_base_type

CHECK: Compile Unit: length = 0x0000004a, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = {{.*}}, addr_size = 0x08
CHECK: DW_AT_producer [DW_FORM_strx]     (indexed (00000000) string = "Apple clang version 14.0.3 (clang-1403.0.22.14.1)")
CHECK: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "a.cpp")
CHECK: DW_AT_LLVM_sysroot [DW_FORM_strx] (indexed (00000002) string = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
CHECK: DW_AT_APPLE_sdk [DW_FORM_strx]    (indexed (00000003) string = "MacOSX.sdk")
CHECK: DW_AT_str_offsets_base [DW_FORM_sec_offset]       (0x00000008)
CHECK: DW_AT_comp_dir [DW_FORM_strx]     (indexed (00000004) string = "/Users/shubham/Development/test109275485")
CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[RANGELIST_OFFSET:[0-9a-f]+]]
CHECK-NEXT:                  [0x[[RANGELIST_OFFSET_START:[0-9a-f]+]], 0x[[RANGELIST_OFFSET_END:[0-9a-f]+]]))
CHECK-NEXT: DW_AT_addr_base [DW_FORM_sec_offset]      (0x00000008)
CHECK:   DW_TAG_subprogram
CHECK-NEXT:  DW_AT_low_pc [DW_FORM_addrx]     (indexed (00000000) address = 0x[[#%.16x,LOCLIST_LOWPC:]])
CHECK: DW_AT_linkage_name [DW_FORM_strx]       (indexed (00000005) string = "_Z4foo2i")
CHECK: DW_AT_name [DW_FORM_strx]       (indexed (00000006) string = "foo2")
CHECK:     DW_TAG_formal_parameter
CHECK-NEXT:                   DW_AT_location [DW_FORM_sec_offset]   (0x[[LOCLIST_OFFSET:[0-9a-f]+]]:
CHECK-NEXT:                      [0x[[#%.16x,LOCLIST_PAIR_START:]], 0x[[#%.16x,LOCLIST_PAIR_END:]]): [[LOCLIST_EXPR:.*]]
CHECK-NEXT:                      [0x[[#%.16x,LOCLIST_PAIR_START2:]], 0x[[#%.16x,LOCLIST_PAIR_END2:]]): [[LOCLIST_EXPR2:.*]])
CHECK: DW_AT_name [DW_FORM_strx]     (indexed (00000007) string = "a")

CHECK: Compile Unit: length = 0x00000072, format = DWARF32, version = 0x0004, abbr_offset = {{.*}}, addr_size = 0x08
CHECK: DW_AT_producer [DW_FORM_strp]     ( .debug_str[0x00000001] = "Apple clang version 14.0.3 (clang-1403.0.22.14.1)")
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000e0] = "b.cpp")
CHECK: DW_AT_LLVM_sysroot [DW_FORM_strp] ( .debug_str[0x00000039] = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
CHECK: DW_AT_APPLE_sdk [DW_FORM_strp]    ( .debug_str[0x00000098] = "MacOSX.sdk")
CHECK-NOT: DW_AT_str_offsets_base
CHECK: DW_AT_comp_dir [DW_FORM_strp]     ( .debug_str[0x000000a3] = "/Users/shubham/Development/test109275485")
CHECK:              DW_AT_low_pc [DW_FORM_addr]       (0x[[#%.16x,RANGE_LOWPC:]])
CHECK-NEXT:              DW_AT_ranges [DW_FORM_sec_offset] (0x00000000
CHECK-NEXT:                 [0x[[#%.16x,RANGE_START:]], 0x[[#%.16x,RANGE_END:]]))
CHECK:   DW_TAG_subprogram
CHECK-NEXT:                DW_AT_low_pc [DW_FORM_addr]     (0x[[#%.16x,LOC_LOWPC:]])
CHECK: DW_AT_linkage_name [DW_FORM_strp]       ( .debug_str[0x000000e6] = "_Z3bari")
CHECK: DW_AT_name [DW_FORM_strp]       ( .debug_str[0x000000ee] = "bar")
CHECK:     DW_TAG_formal_parameter
CHECK-NEXT:                  DW_AT_location [DW_FORM_sec_offset]   (0x[[LOC_OFFSET:[0-9a-f]+]]:
CHECK-NEXT:                     [0x[[#%.16x,LOC_PAIR_START:]], 0x[[#%.16x,LOC_PAIR_END:]]): [[LOC_EXPR:.*]]
CHECK-NEXT:                     [0x[[#%.16x,LOC_PAIR_START2:]], 0x[[#%.16x,LOC_PAIR_END2:]]): [[LOC_EXPR2:.*]])
CHECK: DW_AT_name [DW_FORM_strp]     ( .debug_str[0x000000f2] = "x")

CHECK: .debug_loc contents:
CHECK-NEXT: 0x[[LOC_OFFSET]]:
CHECK-NEXT:            (0x[[#sub(LOC_PAIR_START,LOC_LOWPC)]], 0x[[#sub(LOC_PAIR_END,LOC_LOWPC)]]): [[LOC_EXPR:.*]]
CHECK-NEXT:            (0x[[#sub(LOC_PAIR_START2,LOC_LOWPC)]], 0x[[#sub(LOC_PAIR_END2,LOC_LOWPC)]]): [[LOC_EXPR2:.*]]

CHECK: .debug_loclists contents:
CHECK-NEXT: 0x00000000: locations list header: length = 0x00000018, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
CHECK-NEXT: 0x[[LOCLIST_OFFSET]]:
CHECK-NEXT:            DW_LLE_base_addressx   (0x0000000000000000)
CHECK-NEXT:            DW_LLE_offset_pair     (0x[[#sub(LOCLIST_PAIR_START,LOCLIST_LOWPC)]], 0x[[#sub(LOCLIST_PAIR_END,LOCLIST_LOWPC)]])
CHECK-NEXT:            DW_LLE_offset_pair     (0x[[#sub(LOCLIST_PAIR_START2,LOCLIST_LOWPC)]], 0x[[#sub(LOCLIST_PAIR_END2,LOCLIST_LOWPC)]])
CHECK-NEXT:            DW_LLE_end_of_list     ()

CHECK: .debug_line contents:
CHECK-NEXT: debug_line[0x00000000]
CHECK-NEXT: Line table prologue:
CHECK-NEXT:     total_length: 0x0000005a
CHECK-NEXT:           format: DWARF32
CHECK-NEXT:          version: 5
CHECK-NEXT:     address_size: 8
CHECK-NEXT:  seg_select_size: 0
CHECK-NEXT:  prologue_length: 0x00000037
CHECK-NEXT:  min_inst_length: 1
CHECK-NEXT: max_ops_per_inst: 1
CHECK-NEXT:  default_is_stmt: 1
CHECK-NEXT:        line_base: -5
CHECK-NEXT:       line_range: 14
CHECK-NEXT:      opcode_base: 13
CHECK-NEXT: standard_opcode_lengths[DW_LNS_copy] = 0
CHECK-NEXT: standard_opcode_lengths[DW_LNS_advance_pc] = 1
CHECK-NEXT: standard_opcode_lengths[DW_LNS_advance_line] = 1
CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_file] = 1
CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_column] = 1
CHECK-NEXT: standard_opcode_lengths[DW_LNS_negate_stmt] = 0
CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_basic_block] = 0
CHECK-NEXT: standard_opcode_lengths[DW_LNS_const_add_pc] = 0
CHECK-NEXT: standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1
CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_prologue_end] = 0
CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0
CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_isa] = 1
CHECK-NEXT: include_directories[  0] =  .debug_line_str[0x00000000] = "/Users/shubham/Development/test109275485"
CHECK-NEXT: file_names[  0]:
CHECK-NEXT:            name:  .debug_line_str[0x00000029] = "a.cpp"
CHECK-NEXT:       dir_index: 0

CHECK: debug_line[0x0000005e]
CHECK-NEXT: Line table prologue:
CHECK-NEXT:     total_length: 0x0000003b
CHECK-NEXT:           format: DWARF32
CHECK-NEXT:          version: 4
CHECK-NEXT:  prologue_length: 0x0000001d
CHECK-NEXT:  min_inst_length: 1
CHECK-NEXT: max_ops_per_inst: 1
CHECK-NEXT:  default_is_stmt: 1
CHECK-NEXT:        line_base: -5
CHECK-NEXT:       line_range: 14
CHECK-NEXT:      opcode_base: 13
CHECK-NEXT: standard_opcode_lengths[DW_LNS_copy] = 0
CHECK-NEXT: standard_opcode_lengths[DW_LNS_advance_pc] = 1
CHECK-NEXT: standard_opcode_lengths[DW_LNS_advance_line] = 1
CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_file] = 1
CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_column] = 1
CHECK-NEXT: standard_opcode_lengths[DW_LNS_negate_stmt] = 0
CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_basic_block] = 0
CHECK-NEXT: standard_opcode_lengths[DW_LNS_const_add_pc] = 0
CHECK-NEXT: standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1
CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_prologue_end] = 0
CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0
CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_isa] = 1
CHECK-NEXT: file_names[  1]:
CHECK-NEXT:            name: "b.cpp"
CHECK-NEXT:       dir_index: 0
CHECK-NEXT:        mod_time: 0x00000000
CHECK-NEXT:          length: 0x00000000

CHECK: .debug_str contents:
CHECK-NEXT: 0x00000000: ""
CHECK-NEXT: 0x00000001: "Apple clang version 14.0.3 (clang-1403.0.22.14.1)"
CHECK-NEXT: 0x00000033: "a.cpp"
CHECK-NEXT: 0x00000039: "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
CHECK-NEXT: 0x00000098: "MacOSX.sdk"
CHECK-NEXT: 0x000000a3: "/Users/shubham/Development/test109275485"
CHECK-NEXT: 0x000000cc: "_Z4foo2i"
CHECK-NEXT: 0x000000d5: "foo2"
CHECK-NEXT: 0x000000da: "a"
CHECK-NEXT: 0x000000dc: "int"
CHECK-NEXT: 0x000000e0: "b.cpp"
CHECK-NEXT: 0x000000e6: "_Z3bari"
CHECK-NEXT: 0x000000ee: "bar"
CHECK-NEXT: 0x000000f2: "x"
CHECK-NEXT: 0x000000f4: "y"

CHECK: .debug_line_str contents:
CHECK-NEXT: 0x00000000: "/Users/shubham/Development/test109275485"
CHECK-NEXT: 0x00000029: "a.cpp"

CHECK: .debug_ranges contents:
CHECK-NEXT: 00000000 [[#sub(RANGE_START,RANGE_LOWPC)]] [[#sub(RANGE_END,RANGE_LOWPC)]]

CHECK: .debug_rnglists contents:
CHECK-NEXT: 0x00000000: range list header: length = 0x0000000e, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
CHECK-NEXT: ranges:
CHECK-NEXT: [[RANGELIST_OFFSET]]: [DW_RLE_base_addressx]:  0x0000000000000000
CHECK-NEXT: 0x0000000e: [DW_RLE_offset_pair  ]: {{.*}}[0x[[RANGELIST_OFFSET_START]], 0x[[RANGELIST_OFFSET_END]])
CHECK-NEXT: 0x00000011: [DW_RLE_end_of_list  ]

CHECK: .debug_str_offsets contents:
CHECK-NEXT: 0x00000000: Contribution size = 40, Format = DWARF32, Version = 5
CHECK-NEXT: 0x00000008: 00000001 "Apple clang version 14.0.3 (clang-1403.0.22.14.1)"
CHECK-NEXT: 0x0000000c: 00000033 "a.cpp"
CHECK-NEXT: 0x00000010: 00000039 "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
CHECK-NEXT: 0x00000014: 00000098 "MacOSX.sdk"
CHECK-NEXT: 0x00000018: 000000a3 "/Users/shubham/Development/test109275485"
CHECK-NEXT: 0x0000001c: 000000cc "_Z4foo2i"
CHECK-NEXT: 0x00000020: 000000d5 "foo2"
CHECK-NEXT: 0x00000024: 000000da "a"
CHECK-NEXT: 0x00000028: 000000dc "int"

CHECK: .debug_names contents:
CHECK-NEXT: Name Index @ 0x0 {
CHECK-NEXT:   Header {
; FIXME: when the parallel dwarf linker is able to generate DW_IDX_parent,
; these headers should be the same.
WITH-PARENTS-NEXT: Length: 0xC8
NO-PARENTS-NEXT:   Length: 0xC4
CHECK-NEXT:     Format: DWARF32
CHECK-NEXT:     Version: 5
CHECK-NEXT:     CU count: 2
CHECK-NEXT:     Local TU count: 0
CHECK-NEXT:     Foreign TU count: 0
CHECK-NEXT:     Bucket count: 5
CHECK-NEXT:     Name count: 5
WITH-PARENTS-NEXT:     Abbreviations table size: 0x17
NO-PARENTS-NEXT:       Abbreviations table size: 0x13
CHECK-NEXT:     Augmentation: 'LLVM0700'
CHECK-NEXT:   }