1RUN: dsymutil -no-output -verbose -oso-prepend-path=%p %p/Inputs/basic.macho.x86_64 | FileCheck %s
2RUN: dsymutil -no-output -verbose -oso-prepend-path=%p %p/Inputs/basic-lto.macho.x86_64 | FileCheck %s --check-prefix=CHECK-LTO
3RUN: dsymutil -no-output -verbose -oso-prepend-path=%p %p/Inputs/basic-archive.macho.x86_64 | FileCheck %s --check-prefix=CHECK-ARCHIVE
4RUN: dsymutil -no-output -verbose -oso-prepend-path=%p %p/Inputs/basic.macho.x86_64 %p/Inputs/basic-lto.macho.x86_64 %p/Inputs/basic-archive.macho.x86_64 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-LTO --check-prefix=CHECK-ARCHIVE
5
6This test check the basic Dwarf linking process through the debug dumps.
7
8================================= Simple link ================================
9CHECK: DEBUG MAP OBJECT: {{.*}}basic1.macho.x86_64.o
10CHECK: Input compilation unit:
11CHECK-NEXT: TAG_compile_unit
12CHECK-NOT: TAG
13CHECK: AT_name {{.*}}basic1.c
14
15CHECK: DEBUG MAP OBJECT: {{.*}}basic2.macho.x86_64.o
16CHECK: Input compilation unit:
17CHECK-NEXT: TAG_compile_unit
18CHECK-NOT: TAG
19CHECK: AT_name {{.*}}basic2.c
20
21CHECK: DEBUG MAP OBJECT: {{.*}}basic3.macho.x86_64.o
22CHECK: Input compilation unit:
23CHECK-NEXT: TAG_compile_unit
24CHECK-NOT: TAG
25CHECK: AT_name {{.*}}basic3.c
26
27CHECK-NOT: Found valid debug map entry
28CHECK: Found valid debug map entry: _main 	0000000000000000 => 0000000100000ea0
29CHECK-NEXT: DW_TAG_subprogram
30CHECK-NEXT:   DW_AT_name{{.*}}"main"
31
32CHECK: Found valid debug map entry: _private_int 	0000000000000560 => 0000000100001008
33CHECK-NEXT: DW_TAG_variable
34CHECK-NEXT:   DW_AT_name {{.*}}"private_int"
35CHECK-NOT: Found valid debug map entry
36CHECK: Found valid debug map entry: _baz 	0000000000000310 => 0000000100001000
37CHECK-NEXT: DW_TAG_variable
38CHECK-NEXT:   DW_AT_name {{.*}}"baz"
39CHECK-NOT: Found valid debug map entry
40CHECK: Found valid debug map entry: _foo 	0000000000000020 => 0000000100000ed0
41CHECK-NEXT: DW_TAG_subprogram
42CHECK-NEXT:   DW_AT_name {{.*}}"foo"
43CHECK-NOT: Found valid debug map entry
44CHECK: Found valid debug map entry: _inc 	0000000000000070 => 0000000100000f20
45CHECK-NEXT: DW_TAG_subprogram
46CHECK-NEXT:   DW_AT_name {{.*}}"inc"
47
48CHECK-NOT: Found valid debug map entry
49CHECK: Found valid debug map entry: _val 	ffffffffffffffff => 0000000100001004
50CHECK-NEXT: DW_TAG_variable
51CHECK-NEXT:   DW_AT_name {{.*}}"val"
52CHECK-NOT: Found valid debug map entry
53CHECK: Found valid debug map entry: _bar 	0000000000000020 => 0000000100000f40
54CHECK-NEXT: DW_TAG_subprogram
55CHECK-NEXT:   DW_AT_name {{.*}}"bar"
56CHECK-NOT: Found valid debug map entry
57CHECK: Found valid debug map entry: _inc 	0000000000000070 => 0000000100000f90
58CHECK-NEXT: DW_TAG_subprogram
59CHECK-NEXT:   DW_AT_name {{.*}}"inc")
60
61
62================================= LTO link ================================
63CHECK-LTO: DEBUG MAP OBJECT: {{.*}}basic-lto.macho.x86_64.o
64CHECK-LTO: Input compilation unit:
65CHECK-LTO-NEXT: TAG_compile_unit
66CHECK-LTO-NOT: TAG
67CHECK-LTO: AT_name {{.*}}basic1.c
68CHECK-LTO: Input compilation unit:
69CHECK-LTO-NEXT: TAG_compile_unit
70CHECK-LTO-NOT: TAG
71CHECK-LTO: AT_name {{.*}}basic2.c
72CHECK-LTO: Input compilation unit:
73CHECK-LTO-NEXT: TAG_compile_unit
74CHECK-LTO-NOT: TAG
75CHECK-LTO: AT_name {{.*}}basic3.c
76
77CHECK-LTO-NOT: Found valid debug map entry
78CHECK-LTO: Found valid debug map entry: _main 	0000000000000000 => 0000000100000f40
79CHECK-LTO-NEXT: DW_TAG_subprogram
80CHECK-LTO-NEXT:   DW_AT_name {{.*}}"main"
81CHECK-LTO-NOT: Found valid debug map entry
82CHECK-LTO: Found valid debug map entry: _private_int 	00000000000008e8 => 0000000100001008
83CHECK-LTO-NEXT: DW_TAG_variable
84CHECK-LTO-NEXT:   DW_AT_name {{.*}}"private_int"
85CHECK-LTO-NOT: Found valid debug map entry
86CHECK-LTO: Found valid debug map entry: _baz 	0000000000000658 => 0000000100001000
87CHECK-LTO-NEXT: DW_TAG_variable
88CHECK-LTO-NEXT:   DW_AT_name {{.*}} "baz"
89CHECK-LTO-NOT: Found valid debug map entry
90CHECK-LTO: Found valid debug map entry: _foo 	0000000000000010 => 0000000100000f50
91CHECK-LTO-NEXT: DW_TAG_subprogram
92CHECK-LTO-NEXT:   DW_AT_name {{.*}}"foo"
93CHECK-LTO-NOT: Found valid debug map entry
94CHECK-LTO: Found valid debug map entry: _val 	00000000000008ec => 0000000100001004
95CHECK-LTO-NEXT: DW_TAG_variable
96CHECK-LTO-NEXT:   DW_AT_name {{.*}}"val"
97CHECK-LTO-NOT: Found valid debug map entry
98CHECK-LTO: Found valid debug map entry: _bar 	0000000000000050 => 0000000100000f90
99CHECK-LTO-NEXT: DW_TAG_subprogram
100CHECK-LTO-NEXT:   DW_AT_name {{.*}}"bar"
101
102
103================================= Archive link ================================
104CHECK-ARCHIVE: DEBUG MAP OBJECT: {{.*}}basic1.macho.x86_64.o
105CHECK-ARCHIVE: Input compilation unit:
106CHECK-ARCHIVE-NEXT: TAG_compile_unit
107CHECK-ARCHIVE-NOT: TAG
108CHECK-ARCHIVE: AT_name {{.*}}basic1.c
109
110CHECK-ARCHIVE: DEBUG MAP OBJECT: {{.*}}libbasic.a(basic2.macho.x86_64.o)
111CHECK-ARCHIVE: Input compilation unit:
112CHECK-ARCHIVE-NEXT: TAG_compile_unit
113CHECK-ARCHIVE-NOT: TAG
114CHECK-ARCHIVE: AT_name {{.*}}basic2.c
115
116CHECK-ARCHIVE: DEBUG MAP OBJECT: {{.*}}libbasic.a(basic3.macho.x86_64.o)
117CHECK-ARCHIVE: Input compilation unit:
118CHECK-ARCHIVE-NEXT: TAG_compile_unit
119CHECK-ARCHIVE-NOT: TAG
120CHECK-ARCHIVE: AT_name {{.*}}basic3.c
121
122CHECK-ARCHIVE-NOT: Found valid debug map entry
123CHECK-ARCHIVE: Found valid debug map entry: _main 	0000000000000000 => 0000000100000ea0
124CHECK-ARCHIVE-NEXT: DW_TAG_subprogram
125CHECK-ARCHIVE-NEXT:   DW_AT_name{{.*}}"main"
126
127CHECK-ARCHIVE-NOT: Found valid debug map entry
128CHECK-ARCHIVE: Found valid debug map entry: _private_int 	0000000000000560 => 0000000100001004
129CHECK-ARCHIVE-NEXT: DW_TAG_variable
130CHECK-ARCHIVE-NEXT:   DW_AT_name {{.*}}"private_int"
131CHECK-ARCHIVE-NOT: Found valid debug map entry
132CHECK-ARCHIVE: Found valid debug map entry: _baz 	0000000000000310 => 0000000100001000
133CHECK-ARCHIVE-NEXT: DW_TAG_variable
134CHECK-ARCHIVE-NEXT:   DW_AT_name {{.*}}"baz"
135CHECK-ARCHIVE-NOT: Found valid debug map entry
136CHECK-ARCHIVE: Found valid debug map entry: _foo 	0000000000000020 => 0000000100000ed0
137CHECK-ARCHIVE-NEXT: DW_TAG_subprogram
138CHECK-ARCHIVE-NEXT:   DW_AT_name {{.*}}"foo"
139CHECK-ARCHIVE-NOT: Found valid debug map entry
140CHECK-ARCHIVE: Found valid debug map entry: _inc 	0000000000000070 => 0000000100000f20
141CHECK-ARCHIVE-NEXT: DW_TAG_subprogram
142CHECK-ARCHIVE-NEXT:   DW_AT_name {{.*}}"inc"
143
144CHECK-ARCHIVE-NOT: Found valid debug map entry
145CHECK-ARCHIVE: Found valid debug map entry: _val 	ffffffffffffffff => 0000000100001008
146CHECK-ARCHIVE-NEXT: DW_TAG_variable
147CHECK-ARCHIVE-NEXT:   DW_AT_name {{.*}}"val"
148CHECK-ARCHIVE-NOT: Found valid debug map entry
149CHECK-ARCHIVE: Found valid debug map entry: _bar 	0000000000000020 => 0000000100000f40
150CHECK-ARCHIVE-NEXT: DW_TAG_subprogram
151CHECK-ARCHIVE-NEXT:   DW_AT_name {{.*}}"bar"
152CHECK-ARCHIVE-NOT: Found valid debug map entry
153CHECK-ARCHIVE: Found valid debug map entry: _inc 	0000000000000070 => 0000000100000f90
154CHECK-ARCHIVE-NEXT: DW_TAG_subprogram
155CHECK-ARCHIVE-NEXT:   DW_AT_name {{.*}}"inc")
156