[InstCombine] Signed saturation patterns
[llvm-complete.git] / test / DebugInfo / X86 / dwarfdump-str-offsets-macho.s
blob10a810a350d19f9c47ee121fbf8b76e89b1a68a5
1 # RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o %t.o
2 # RUN: llvm-dwarfdump -v %t.o | FileCheck --check-prefix=COMMON %s
4 # Test object to verify dwarfdump handles v5 string offset tables in Mach-O.
5 # This is similar to dwarfdump-str-offsets.s with 2 CUs and 1 TU, but no
6 # split sections.
8 .section __DWARF,__debug_str,regular,debug
9 Linfo_string:
10 .asciz "Handmade DWARF producer"
11 str_CU1:
12 .asciz "Compile_Unit_1"
13 str_CU1_dir:
14 .asciz "/home/test/CU1"
15 str_CU2:
16 .asciz "Compile_Unit_2"
17 str_CU2_dir:
18 .asciz "/home/test/CU2"
19 str_TU:
20 .asciz "Type_Unit"
21 str_TU_type:
22 .asciz "MyStruct"
23 str_Subprogram:
24 .asciz "MyFunc"
25 str_Variable1:
26 .asciz "MyVar1"
27 str_Variable2:
28 .asciz "MyVar2"
29 str_Variable3:
30 .asciz "MyVar3"
32 .section __DWARF,__debug_str_offs,regular,debug
33 Ldebug_str_offsets:
34 .long Ldebug_str_offsets_segment0_end-Ldebug_str_offsets_base0+4
35 .short 5 # DWARF version
36 .short 0 # Padding
37 Ldebug_str_offsets_base0:
38 .long str_producer
39 .long str_CU1
40 .long str_CU1_dir
41 .long str_Subprogram
42 .long str_Variable1
43 .long str_Variable2
44 .long str_Variable3
45 Ldebug_str_offsets_segment0_end:
46 # A 4-byte gap.
47 .long 0
48 # CU2's contribution (DWARF64 format)
49 .long 0xffffffff
50 .quad Ldebug_str_offsets_segment1_end-Ldebug_str_offsets_base1+4
51 .short 5 # DWARF version
52 .short 0 # Padding
53 Ldebug_str_offsets_base1:
54 .quad str_producer
55 .quad str_CU2
56 .quad str_CU2_dir
57 Ldebug_str_offsets_segment1_end:
58 # The TU's contribution
59 .long Ldebug_str_offsets_segment2_end-Ldebug_str_offsets_base2+4
60 .short 5 # DWARF version
61 .short 0 # Padding
62 Ldebug_str_offsets_base2:
63 .long str_TU
64 .long str_TU_type
65 Ldebug_str_offsets_segment2_end:
67 .section __DWARF,__debug_abbrev,regular,debug
68 Lsection_abbrev:
69 .byte 0x01 # Abbrev code
70 .byte 0x11 # DW_TAG_compile_unit
71 .byte 0x01 # DW_CHILDREN_yes
72 .byte 0x25 # DW_AT_producer
73 .byte 0x1a # DW_FORM_strx
74 .byte 0x03 # DW_AT_name
75 .byte 0x1a # DW_FORM_strx
76 .byte 0x72 # DW_AT_str_offsets_base
77 .byte 0x17 # DW_FORM_sec_offset
78 .byte 0x1b # DW_AT_comp_dir
79 .byte 0x1a # DW_FORM_strx
80 .byte 0x00 # EOM(1)
81 .byte 0x00 # EOM(2)
82 .byte 0x02 # Abbrev code
83 .byte 0x41 # DW_TAG_type_unit
84 .byte 0x01 # DW_CHILDREN_yes
85 .byte 0x03 # DW_AT_name
86 .byte 0x1a # DW_FORM_strx
87 .byte 0x72 # DW_AT_str_offsets_base
88 .byte 0x17 # DW_FORM_sec_offset
89 .byte 0x00 # EOM(1)
90 .byte 0x00 # EOM(2)
91 .byte 0x03 # Abbrev code
92 .byte 0x13 # DW_TAG_structure_type
93 .byte 0x00 # DW_CHILDREN_no (no members)
94 .byte 0x03 # DW_AT_name
95 .byte 0x1a # DW_FORM_strx
96 .byte 0x00 # EOM(1)
97 .byte 0x00 # EOM(2)
98 .byte 0x04 # Abbrev code
99 .byte 0x2e # DW_TAG_subprogram
100 .byte 0x01 # DW_CHILDREN_yes
101 .byte 0x03 # DW_AT_name
102 .byte 0x25 # DW_FORM_strx1
103 .byte 0x00 # EOM(1)
104 .byte 0x00 # EOM(2)
105 .byte 0x05 # Abbrev code
106 .byte 0x34 # DW_TAG_variable
107 .byte 0x00 # DW_CHILDREN_no
108 .byte 0x03 # DW_AT_name
109 .byte 0x26 # DW_FORM_strx2
110 .byte 0x00 # EOM(1)
111 .byte 0x00 # EOM(2)
112 .byte 0x06 # Abbrev code
113 .byte 0x34 # DW_TAG_variable
114 .byte 0x00 # DW_CHILDREN_no
115 .byte 0x03 # DW_AT_name
116 .byte 0x27 # DW_FORM_strx3
117 .byte 0x00 # EOM(1)
118 .byte 0x00 # EOM(2)
119 .byte 0x07 # Abbrev code
120 .byte 0x34 # DW_TAG_variable
121 .byte 0x00 # DW_CHILDREN_no
122 .byte 0x03 # DW_AT_name
123 .byte 0x28 # DW_FORM_strx4
124 .byte 0x00 # EOM(1)
125 .byte 0x00 # EOM(2)
126 .byte 0x00 # EOM(3)
128 .section __DWARF,__debug_info,regular,debug
129 Lsection_info:
130 # DWARF v5 CU header.
131 .long CU1_5_end-CU1_5_version # Length of Unit
132 CU1_5_version:
133 .short 5 # DWARF version number
134 .byte 1 # DWARF Unit Type
135 .byte 8 # Address Size (in bytes)
136 .long 0 # Offset Into Abbrev. Section
137 # The compile-unit DIE, which has a DW_AT_producer, DW_AT_name,
138 # DW_AT_str_offsets and DW_AT_compdir.
139 .byte 1 # Abbreviation code
140 .byte 0 # The index of the producer string
141 .byte 1 # The index of the CU name string
142 .long Ldebug_str_offsets_base0-Ldebug_str_offsets
143 .byte 2 # The index of the comp dir string
144 # A subprogram DIE with DW_AT_name, using DW_FORM_strx1.
145 .byte 4 # Abbreviation code
146 .byte 3 # Subprogram name string (DW_FORM_strx1)
147 # A variable DIE with DW_AT_name, using DW_FORM_strx2.
148 .byte 5 # Abbreviation code
149 .short 0x0004 # Subprogram name string (DW_FORM_strx2)
150 # A variable DIE with DW_AT_name, using DW_FORM_strx3.
151 .byte 6 # Abbreviation code
152 .byte 5 # Subprogram name string (DW_FORM_strx3)
153 .short 0 # Subprogram name string (DW_FORM_strx3)
154 # A variable DIE with DW_AT_name, using DW_FORM_strx4.
155 .byte 7 # Abbreviation code
156 .quad 0x00000006 # Subprogram name string (DW_FORM_strx4)
157 .byte 0 # NULL
158 .byte 0 # NULL
159 .byte 0 # NULL
160 CU1_5_end:
162 # DWARF v5 CU header
163 .long 0xffffffff
164 .quad CU2_5_end-CU2_5_version # Length of Unit
165 CU2_5_version:
166 .short 5 # DWARF version number
167 .byte 1 # DWARF Unit Type
168 .byte 8 # Address Size (in bytes)
169 .quad 0 # Offset Into Abbrev. Section
170 # The compile-unit DIE, which has a DW_AT_producer, DW_AT_name,
171 # DW_AT_str_offsets and DW_AT_compdir.
172 .byte 1 # Abbreviation code
173 .byte 0 # The index of the producer string
174 .byte 1 # The index of the CU name string
175 .quad Ldebug_str_offsets_base1-Ldebug_str_offsets
176 .byte 2 # The index of the comp dir string
177 .byte 0 # NULL
178 CU2_5_end:
180 .section __DWARF,__debug_types,regular,debug
181 # DWARF v5 Type unit header.
182 TU_5_start:
183 .long TU_5_end-TU_5_version # Length of Unit
184 TU_5_version:
185 .short 5 # DWARF version number
186 .byte 2 # DWARF Unit Type
187 .byte 8 # Address Size (in bytes)
188 .long 0 # Offset Into Abbrev. Section
189 .quad 0x0011223344556677 # Type Signature
190 .long TU_5_type-TU_5_start # Type offset
191 # The type-unit DIE, which has a name.
192 .byte 2 # Abbreviation code
193 .byte 0 # Index of the unit type name string
194 .long Ldebug_str_offsets_base2-Ldebug_str_offsets # offset into the str_offsets section
195 # The type DIE, which has a name.
196 TU_5_type:
197 .byte 3 # Abbreviation code
198 .byte 1 # Index of the type name string
199 .byte 0 # NULL
200 .byte 0 # NULL
201 TU_5_end:
204 .subsections_via_symbols
206 # We are using a hand-constructed object file and are interest in the correct
207 # diplay of the DW_str_offsetsbase attribute and the correct display of strings.
209 # Abbreviation for DW_AT_str_offsets_base
210 # COMMON: .debug_abbrev contents:
211 # COMMON-NOT: contents:
212 # COMMON: DW_TAG_compile_unit
213 # COMMON-NOT: DW_TAG
214 # COMMON: DW_AT_str_offsets_base DW_FORM_sec_offset
216 # Verify that strings are displayed correctly as indexed strings
217 # COMMON: .debug_info contents:
218 # COMMON-NOT: contents:
219 # COMMON: DW_TAG_compile_unit
220 # COMMON-NEXT: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Handmade DWARF producer")
221 # COMMON-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "Compile_Unit_1")
222 # COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
223 # COMMON-NEXT: DW_AT_comp_dir [DW_FORM_strx] (indexed (00000002) string = "/home/test/CU1")
224 # COMMON-NOT: NULL
225 # COMMON: DW_TAG_subprogram
226 # COMMON-NEXT: DW_AT_name [DW_FORM_strx1] (indexed (00000003) string = "MyFunc")
227 # COMMON-NOT: NULL
228 # COMMON: DW_TAG_variable
229 # COMMON-NEXT: DW_AT_name [DW_FORM_strx2] (indexed (00000004) string = "MyVar1")
230 # COMMON-NOT: NULL
231 # COMMON: DW_TAG_variable
232 # COMMON-NEXT: DW_AT_name [DW_FORM_strx3] (indexed (00000005) string = "MyVar2")
233 # COMMON-NOT: NULL
234 # COMMON: DW_TAG_variable
235 # COMMON-NEXT: DW_AT_name [DW_FORM_strx4] (indexed (00000006) string = "MyVar3")
237 # Second compile unit (b.cpp)
238 # COMMON: DW_TAG_compile_unit
239 # COMMON-NEXT: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Handmade DWARF producer")
240 # COMMON-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "Compile_Unit_2")
241 # COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000038)
242 # COMMON-NEXT: DW_AT_comp_dir [DW_FORM_strx] (indexed (00000002) string = "/home/test/CU2")
244 # The type unit
245 # COMMON: .debug_types contents:
246 # COMMON: DW_TAG_type_unit
247 # COMMON-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000000) string = "Type_Unit")
248 # COMMON-NEXT: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000058)
249 # COMMON: DW_TAG_structure_type
250 # COMMON-NEXT: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "MyStruct")
252 # The .debug_str_offsets section
253 # COMMON: .debug_str_offsets contents:
254 # COMMON-NEXT: 0x00000000: Contribution size = 32, Format = DWARF32, Version = 5
255 # COMMON-NEXT: 0x00000008: 00000000 "Handmade DWARF producer"
256 # COMMON-NEXT: 0x0000000c: 00000018 "Compile_Unit_1"
257 # COMMON-NEXT: 0x00000010: 00000027 "/home/test/CU1"
258 # COMMON-NEXT: 0x00000014: 00000067 "MyFunc"
259 # COMMON-NEXT: 0x00000018: 0000006e "MyVar1"
260 # COMMON-NEXT: 0x0000001c: 00000075 "MyVar2"
261 # COMMON-NEXT: 0x00000020: 0000007c "MyVar3"
262 # COMMON-NEXT: 0x00000024: Gap, length = 4
263 # COMMON-NEXT: 0x00000028: Contribution size = 28, Format = DWARF64, Version = 5
264 # COMMON-NEXT: 0x00000038: 00000000 "Handmade DWARF producer"
265 # COMMON-NEXT: 0x00000040: 00000036 "Compile_Unit_2"
266 # COMMON-NEXT: 0x00000048: 00000045 "/home/test/CU2"
267 # COMMON-NEXT: 0x00000050: Contribution size = 12, Format = DWARF32, Version = 5
268 # COMMON-NEXT: 0x00000058: 00000054 "Type_Unit"
269 # COMMON-NEXT: 0x0000005c: 0000005e "MyStruct"