[flang] Fix length handling in character kind implicit conversion (#74586)
[llvm-project.git] / lldb / test / Shell / SymbolFile / NativePDB / nested-blocks-same-address.s
blob0ab76dacdaded0dd8c70dcb77040c33d378bf11e
1 # clang-format off
2 # REQUIRES: lld, x86
4 # Test when nested S_BLOCK32 have same address range, ResolveSymbolContext should return the innnermost block.
5 # RUN: llvm-mc -triple=x86_64-windows-msvc --filetype=obj %s > %t.obj
6 # RUN: lld-link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe /base:0x140000000
7 # RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "image lookup -a 0x14000103c -v" -o "exit" | FileCheck %s
9 # This file is compiled from following source file:
10 # $ clang-cl /Z7 /GS- /c /O2 test.cpp /Fatest.s
11 # __attribute__((optnone)) bool func(const char* cp, volatile char p[]) {
12 # return false;
13 # }
15 # int main() {
16 # const char* const kMfDLLs[] = {"a"};
17 # asm("nop");
18 # for (const char* kMfDLL : kMfDLLs) {
19 # volatile char path[10] = {0};
20 # if (func(kMfDLL, path))
21 # break;
22 # }
23 # return 0;
24 # }
26 # CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001020-0x000000014000104d)
27 # CHECK-NEXT: FuncType: id = {{.*}}, byte-size = 0, compiler_type = "int (void)"
28 # CHECK-NEXT: Blocks: id = {{.*}}, range = [0x140001020-0x14000104d)
29 # CHECK-NEXT: id = {{.*}}, range = [0x140001025-0x140001046)
30 # CHECK-NEXT: id = {{.*}}, range = [0x140001025-0x140001046)
31 # CHECK-NEXT: id = {{.*}}, range = [0x140001025-0x140001046)
32 # CHECK-NEXT: LineEntry: [0x0000000140001035-0x0000000140001046): /tmp/test.cpp:10
33 # CHECK-NEXT: Variable: id = {{.*}}, name = "path", type = "volatile char[10]", valid ranges = <block>, location = [0x0000000140001025, 0x0000000140001046) -> DW_OP_breg7 RSP+40, decl =
34 # CHECK-NEXT: Variable: id = {{.*}}, name = "kMfDLL", type = "const char *", valid ranges = <block>, location = [0x000000014000103c, 0x0000000140001046) -> DW_OP_reg2 RCX, decl =
35 # CHECK-NEXT: Variable: id = {{.*}}, name = "__range1", type = "const char *const (&)[1]", valid ranges = <block>, location = <empty>, decl =
36 # CHECK-NEXT: Variable: id = {{.*}}, name = "__begin1", type = "const char *const *", valid ranges = <block>, location = <empty>, decl =
37 # CHECK-NEXT: Variable: id = {{.*}}, name = "__end1", type = "const char *const *", valid ranges = <block>, location = <empty>, decl =
38 # CHECK-NEXT: Variable: id = {{.*}}, name = "kMfDLLs", type = "const char *const[1]", valid ranges = <block>, location = [0x000000014000103c, 0x0000000140001046) -> DW_OP_reg2 RCX, decl =
41 .text
42 .def @feat.00;
43 .scl 3;
44 .type 0;
45 .endef
46 .globl @feat.00
47 .set @feat.00, 0
48 .intel_syntax noprefix
49 .file "test.cpp"
50 .def "?func@@YA_NPEBDQECD@Z";
51 .scl 2;
52 .type 32;
53 .endef
54 .section .text,"xr",one_only,"?func@@YA_NPEBDQECD@Z"
55 .globl "?func@@YA_NPEBDQECD@Z" # -- Begin function ?func@@YA_NPEBDQECD@Z
56 .p2align 4, 0x90
57 "?func@@YA_NPEBDQECD@Z": # @"?func@@YA_NPEBDQECD@Z"
58 .Lfunc_begin0:
59 .cv_func_id 0
60 .cv_file 1 "/tmp/test.cpp" "8CDAA03EE93954606427F9B409CE7638" 1
61 .cv_loc 0 1 1 0 # test.cpp:1:0
62 .seh_proc "?func@@YA_NPEBDQECD@Z"
63 # %bb.0: # %entry
64 sub rsp, 16
65 .seh_stackalloc 16
66 .seh_endprologue
67 mov qword ptr [rsp + 8], rdx
68 mov qword ptr [rsp], rcx
69 .Ltmp0:
70 .cv_loc 0 1 2 0 # test.cpp:2:0
71 xor eax, eax
72 and al, 1
73 movzx eax, al
74 add rsp, 16
75 ret
76 .Ltmp1:
77 .Lfunc_end0:
78 .seh_endproc
79 # -- End function
80 .def main;
81 .scl 2;
82 .type 32;
83 .endef
84 .section .text,"xr",one_only,main
85 .globl main # -- Begin function main
86 .p2align 4, 0x90
87 main: # @main
88 .Lfunc_begin1:
89 .cv_func_id 1
90 .cv_loc 1 1 5 0 # test.cpp:5:0
91 .seh_proc main
92 # %bb.0: # %entry
93 sub rsp, 56
94 .seh_stackalloc 56
95 .seh_endprologue
96 .Ltmp2:
97 .cv_loc 1 1 7 0 # test.cpp:7:0
98 #APP
99 nop
100 #NO_APP
101 .Ltmp3:
102 #DEBUG_VALUE: __range1 <- undef
103 #DEBUG_VALUE: __begin1 <- undef
104 #DEBUG_VALUE: __end1 <- [DW_OP_plus_uconst 8, DW_OP_stack_value] undef
105 .cv_loc 1 1 9 0 # test.cpp:9:0
106 mov word ptr [rsp + 48], 0
107 mov qword ptr [rsp + 40], 0
108 .cv_loc 1 1 10 0 # test.cpp:10:0
109 lea rcx, [rip + "??_C@_01MCMALHOG@a?$AA@"]
110 .Ltmp4:
111 #DEBUG_VALUE: main:kMfDLLs <- $rcx
112 #DEBUG_VALUE: kMfDLL <- $rcx
113 lea rdx, [rsp + 40]
114 call "?func@@YA_NPEBDQECD@Z"
115 .Ltmp5:
116 #DEBUG_VALUE: __begin1 <- [DW_OP_LLVM_arg 0, DW_OP_LLVM_arg 1, DW_OP_constu 8, DW_OP_mul, DW_OP_plus, DW_OP_stack_value] undef, undef
117 .cv_loc 1 1 14 0 # test.cpp:14:0
118 xor eax, eax
119 add rsp, 56
121 .Ltmp6:
122 .Lfunc_end1:
123 .seh_endproc
124 # -- End function
125 .section .rdata,"dr",discard,"??_C@_01MCMALHOG@a?$AA@"
126 .globl "??_C@_01MCMALHOG@a?$AA@" # @"??_C@_01MCMALHOG@a?$AA@"
127 "??_C@_01MCMALHOG@a?$AA@":
128 .asciz "a"
130 .section .debug$S,"dr"
131 .p2align 2, 0x0
132 .long 4 # Debug section magic
133 .long 241
134 .long .Ltmp8-.Ltmp7 # Subsection size
135 .Ltmp7:
136 .short .Ltmp12-.Ltmp11 # Record length
137 .Ltmp11:
138 .short 4412 # Record kind: S_COMPILE3
139 .long 1 # Flags and language
140 .short 208 # CPUType
141 .short 16 # Frontend version
142 .short 0
143 .short 0
144 .short 0
145 .short 16000 # Backend version
146 .short 0
147 .short 0
148 .short 0
149 .asciz "clang version 16.0.0" # Null-terminated compiler version string
150 .p2align 2, 0x0
151 .Ltmp12:
152 .Ltmp8:
153 .p2align 2, 0x0
154 .section .debug$S,"dr",associative,"?func@@YA_NPEBDQECD@Z"
155 .p2align 2, 0x0
156 .long 4 # Debug section magic
157 .long 241 # Symbol subsection for func
158 .Ltmp14:
159 .p2align 2, 0x0
160 .cv_linetable 0, "?func@@YA_NPEBDQECD@Z", .Lfunc_end0
161 .section .debug$S,"dr",associative,main
162 .p2align 2, 0x0
163 .long 4 # Debug section magic
164 .long 241 # Symbol subsection for main
165 .long .Ltmp24-.Ltmp23 # Subsection size
166 .Ltmp23:
167 .short .Ltmp26-.Ltmp25 # Record length
168 .Ltmp25:
169 .short 4423 # Record kind: S_GPROC32_ID
170 .long 0 # PtrParent
171 .long 0 # PtrEnd
172 .long 0 # PtrNext
173 .long .Lfunc_end1-main # Code size
174 .long 0 # Offset after prologue
175 .long 0 # Offset before epilogue
176 .long 4105 # Function type index
177 .secrel32 main # Function section relative address
178 .secidx main # Function section index
179 .byte 0 # Flags
180 .asciz "main" # Function name
181 .p2align 2, 0x0
182 .Ltmp26:
183 .short .Ltmp28-.Ltmp27 # Record length
184 .Ltmp27:
185 .short 4114 # Record kind: S_FRAMEPROC
186 .long 56 # FrameSize
187 .long 0 # Padding
188 .long 0 # Offset of padding
189 .long 0 # Bytes of callee saved registers
190 .long 0 # Exception handler offset
191 .short 0 # Exception handler section
192 .long 1130504 # Flags (defines frame register)
193 .p2align 2, 0x0
194 .Ltmp28:
195 .short .Ltmp30-.Ltmp29 # Record length
196 .Ltmp29:
197 .short 4414 # Record kind: S_LOCAL
198 .long 4107 # TypeIndex
199 .short 0 # Flags
200 .asciz "kMfDLLs"
201 .p2align 2, 0x0
202 .Ltmp30:
203 .cv_def_range .Ltmp4 .Ltmp5, reg, 330
204 .short .Ltmp32-.Ltmp31 # Record length
205 .Ltmp31:
206 .short 4355 # Record kind: S_BLOCK32
207 .long 0 # PtrParent
208 .long 0 # PtrEnd
209 .long .Ltmp5-.Ltmp3 # Code size
210 .secrel32 .Ltmp3 # Function section relative address
211 .secidx .Lfunc_begin1 # Function section index
212 .byte 0 # Lexical block name
213 .p2align 2, 0x0
214 .Ltmp32:
215 .short .Ltmp34-.Ltmp33 # Record length
216 .Ltmp33:
217 .short 4414 # Record kind: S_LOCAL
218 .long 4108 # TypeIndex
219 .short 256 # Flags
220 .asciz "__range1"
221 .p2align 2, 0x0
222 .Ltmp34:
223 .short .Ltmp36-.Ltmp35 # Record length
224 .Ltmp35:
225 .short 4414 # Record kind: S_LOCAL
226 .long 4109 # TypeIndex
227 .short 256 # Flags
228 .asciz "__begin1"
229 .p2align 2, 0x0
230 .Ltmp36:
231 .short .Ltmp38-.Ltmp37 # Record length
232 .Ltmp37:
233 .short 4414 # Record kind: S_LOCAL
234 .long 4109 # TypeIndex
235 .short 256 # Flags
236 .asciz "__end1"
237 .p2align 2, 0x0
238 .Ltmp38:
239 .short .Ltmp40-.Ltmp39 # Record length
240 .Ltmp39:
241 .short 4355 # Record kind: S_BLOCK32
242 .long 0 # PtrParent
243 .long 0 # PtrEnd
244 .long .Ltmp5-.Ltmp3 # Code size
245 .secrel32 .Ltmp3 # Function section relative address
246 .secidx .Lfunc_begin1 # Function section index
247 .byte 0 # Lexical block name
248 .p2align 2, 0x0
249 .Ltmp40:
250 .short .Ltmp42-.Ltmp41 # Record length
251 .Ltmp41:
252 .short 4414 # Record kind: S_LOCAL
253 .long 4097 # TypeIndex
254 .short 0 # Flags
255 .asciz "kMfDLL"
256 .p2align 2, 0x0
257 .Ltmp42:
258 .cv_def_range .Ltmp4 .Ltmp5, reg, 330
259 .short .Ltmp44-.Ltmp43 # Record length
260 .Ltmp43:
261 .short 4355 # Record kind: S_BLOCK32
262 .long 0 # PtrParent
263 .long 0 # PtrEnd
264 .long .Ltmp5-.Ltmp3 # Code size
265 .secrel32 .Ltmp3 # Function section relative address
266 .secidx .Lfunc_begin1 # Function section index
267 .byte 0 # Lexical block name
268 .p2align 2, 0x0
269 .Ltmp44:
270 .short .Ltmp46-.Ltmp45 # Record length
271 .Ltmp45:
272 .short 4414 # Record kind: S_LOCAL
273 .long 4110 # TypeIndex
274 .short 0 # Flags
275 .asciz "path"
276 .p2align 2, 0x0
277 .Ltmp46:
278 .cv_def_range .Ltmp3 .Ltmp5, frame_ptr_rel, 40
279 .short 2 # Record length
280 .short 6 # Record kind: S_END
281 .short 2 # Record length
282 .short 6 # Record kind: S_END
283 .short 2 # Record length
284 .short 6 # Record kind: S_END
285 .short 2 # Record length
286 .short 4431 # Record kind: S_PROC_ID_END
287 .Ltmp24:
288 .p2align 2, 0x0
289 .cv_linetable 1, main, .Lfunc_end1
290 .section .debug$S,"dr"
291 .cv_filechecksums # File index to string table offset subsection
292 .cv_stringtable # String table
293 .Ltmp50:
294 .Ltmp48:
295 .p2align 2, 0x0
296 .section .debug$T,"dr"
297 .p2align 2, 0x0
298 .long 4 # Debug section magic
299 # Modifier (0x1000)
300 .short 0xa # Record length
301 .short 0x1001 # Record kind: LF_MODIFIER
302 .long 0x70 # ModifiedType: char
303 .short 0x1 # Modifiers ( Const (0x1) )
304 .byte 242
305 .byte 241
306 # Pointer (0x1001)
307 .short 0xa # Record length
308 .short 0x1002 # Record kind: LF_POINTER
309 .long 0x1000 # PointeeType: const char
310 .long 0x1000c # Attrs: [ Type: Near64, Mode: Pointer, SizeOf: 8 ]
311 # Modifier (0x1002)
312 .short 0xa # Record length
313 .short 0x1001 # Record kind: LF_MODIFIER
314 .long 0x70 # ModifiedType: char
315 .short 0x2 # Modifiers ( Volatile (0x2) )
316 .byte 242
317 .byte 241
318 # Pointer (0x1003)
319 .short 0xa # Record length
320 .short 0x1002 # Record kind: LF_POINTER
321 .long 0x1002 # PointeeType: volatile char
322 .long 0x1000c # Attrs: [ Type: Near64, Mode: Pointer, SizeOf: 8 ]
323 # ArgList (0x1004)
324 .short 0xe # Record length
325 .short 0x1201 # Record kind: LF_ARGLIST
326 .long 0x2 # NumArgs
327 .long 0x1001 # Argument: const char*
328 .long 0x1003 # Argument: volatile char*
329 # Procedure (0x1005)
330 .short 0xe # Record length
331 .short 0x1008 # Record kind: LF_PROCEDURE
332 .long 0x30 # ReturnType: bool
333 .byte 0x0 # CallingConvention: NearC
334 .byte 0x0 # FunctionOptions
335 .short 0x2 # NumParameters
336 .long 0x1004 # ArgListType: (const char*, volatile char*)
337 # FuncId (0x1006)
338 .short 0x12 # Record length
339 .short 0x1601 # Record kind: LF_FUNC_ID
340 .long 0x0 # ParentScope
341 .long 0x1005 # FunctionType: bool (const char*, volatile char*)
342 .asciz "func" # Name
343 .byte 243
344 .byte 242
345 .byte 241
346 # ArgList (0x1007)
347 .short 0x6 # Record length
348 .short 0x1201 # Record kind: LF_ARGLIST
349 .long 0x0 # NumArgs
350 # Procedure (0x1008)
351 .short 0xe # Record length
352 .short 0x1008 # Record kind: LF_PROCEDURE
353 .long 0x74 # ReturnType: int
354 .byte 0x0 # CallingConvention: NearC
355 .byte 0x0 # FunctionOptions
356 .short 0x0 # NumParameters
357 .long 0x1007 # ArgListType: ()
358 # FuncId (0x1009)
359 .short 0x12 # Record length
360 .short 0x1601 # Record kind: LF_FUNC_ID
361 .long 0x0 # ParentScope
362 .long 0x1008 # FunctionType: int ()
363 .asciz "main" # Name
364 .byte 243
365 .byte 242
366 .byte 241
367 # Pointer (0x100A)
368 .short 0xa # Record length
369 .short 0x1002 # Record kind: LF_POINTER
370 .long 0x1000 # PointeeType: const char
371 .long 0x1040c # Attrs: [ Type: Near64, Mode: Pointer, SizeOf: 8, isConst ]
372 # Array (0x100B)
373 .short 0xe # Record length
374 .short 0x1503 # Record kind: LF_ARRAY
375 .long 0x100a # ElementType: const char* const
376 .long 0x23 # IndexType: unsigned __int64
377 .short 0x8 # SizeOf
378 .byte 0 # Name
379 .byte 241
380 # Pointer (0x100C)
381 .short 0xa # Record length
382 .short 0x1002 # Record kind: LF_POINTER
383 .long 0x100b # PointeeType
384 .long 0x1002c # Attrs: [ Type: Near64, Mode: LValueReference, SizeOf: 8 ]
385 # Pointer (0x100D)
386 .short 0xa # Record length
387 .short 0x1002 # Record kind: LF_POINTER
388 .long 0x100a # PointeeType: const char* const
389 .long 0x1000c # Attrs: [ Type: Near64, Mode: Pointer, SizeOf: 8 ]
390 # Array (0x100E)
391 .short 0xe # Record length
392 .short 0x1503 # Record kind: LF_ARRAY
393 .long 0x1002 # ElementType: volatile char
394 .long 0x23 # IndexType: unsigned __int64
395 .short 0xa # SizeOf
396 .byte 0 # Name
397 .byte 241