754 lines · plain
1# clang-format off2# REQUIRES: lld, x863 4# RUN: llvm-mc -triple=x86_64-windows-msvc --filetype=obj %s > %t.obj5# RUN: lld-link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe /base:0x1400000006# RUN: %lldb -f %t.exe -s \7# RUN: %p/Inputs/local-variables-registers.lldbinit 2>&1 | FileCheck %s8 9# This file is compiled from following source file:10# clang-cl /Z7 /O1 /Falocal-variables-registers.s a.cpp11# struct S {12# int x;13# char y;14# };15#16# __attribute__((noinline)) S CreateS(int p1, char p2) {17# S s;18# s.x = p1 + 1;19# s.y = p2 + 2;20# ++s.x;21# ++s.y;22# return s;23# }24#25# int main(int argc, char** argv) {26# int local = argc * 2;27# S s = CreateS(local, 'a');28# return s.x + s.y;29# }30 31# FIXME: The following variable location have wrong register numbers due to32# https://github.com/llvm/llvm-project/issues/53575. Fix them after resolving33# the issue.34 35# CHECK: (lldb) image lookup -a 0x140001000 -v36# CHECK: LineEntry: [0x0000000140001000-0x0000000140001003): C:\src\test\a.cpp:1037# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001000-0x0000000140001011), name="struct S CreateS(int, char)", mangled="?CreateS@@YA?AUS@@HD@Z"38# CHECK-NEXT: Variable: id = {{.*}}, name = "p1", type = "int", valid ranges = <block>, location = [0x0000000140001000, 0x0000000140001003) -> DW_OP_reg26 XMM939# CHECK-NEXT: Variable: id = {{.*}}, name = "p2", type = "char", valid ranges = <block>, location = [0x0000000140001000, 0x0000000140001006) -> DW_OP_regx 0x3f40# CHECK-EMPTY:41# CHECK: (lldb) image lookup -a 0x140001003 -v42# CHECK: LineEntry: [0x0000000140001003-0x0000000140001006): C:\src\test\a.cpp:1143# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001000-0x0000000140001011), name="struct S CreateS(int, char)", mangled="?CreateS@@YA?AUS@@HD@Z"44# CHECK-NEXT: Variable: id = {{.*}}, name = "p2", type = "char", valid ranges = <block>, location = [0x0000000140001000, 0x0000000140001006) -> DW_OP_regx 0x3f45# CHECK-NEXT: Variable: id = {{.*}}, name = "s", type = "S", valid ranges = <block>, location = [0x0000000140001003, 0x0000000140001006) -> DW_OP_piece 0x4, DW_OP_regx 0x3f, DW_OP_piece 0x1, DW_OP_piece 0x346# CHECK-EMPTY:47# CHECK: (lldb) image lookup -a 0x140001006 -v48# CHECK: LineEntry: [0x0000000140001006-0x0000000140001011): C:\src\test\a.cpp:1249# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001000-0x0000000140001011), name="struct S CreateS(int, char)", mangled="?CreateS@@YA?AUS@@HD@Z"50# CHECK-NEXT: Variable: id = {{.*}}, name = "s", type = "S", valid ranges = <block>, location = [0x0000000140001006, 0x0000000140001011) -> DW_OP_reg26 XMM9, DW_OP_piece 0x4, DW_OP_regx 0x3f, DW_OP_piece 0x1, DW_OP_piece 0x351# CHECK-EMPTY:52# CHECK: (lldb) image lookup -a 0x140001011 -v53# CHECK: LineEntry: [0x0000000140001011-0x0000000140001015): C:\src\test\a.cpp:1554# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"55# CHECK-NEXT: Variable: id = {{.*}}, name = "argc", type = "int", valid ranges = <block>, location = [0x0000000140001011, 0x0000000140001017) -> DW_OP_reg26 XMM956# CHECK-NEXT: Variable: id = {{.*}}, name = "argv", type = "char **", valid ranges = <block>, location = [0x0000000140001011, 0x0000000140001019) -> DW_OP_reg3 RBX57# CHECK-EMPTY:58# CHECK: (lldb) image lookup -a 0x140001017 -v59# CHECK: LineEntry: [0x0000000140001017-0x000000014000101e): C:\src\test\a.cpp:1760# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"61# CHECK-NEXT: Variable: id = {{.*}}, name = "argv", type = "char **", valid ranges = <block>, location = [0x0000000140001011, 0x0000000140001019) -> DW_OP_reg3 RBX62# CHECK-NEXT: Variable: id = {{.*}}, name = "local", type = "int", valid ranges = <block>, location = [0x0000000140001017, 0x000000014000101e) -> DW_OP_reg26 XMM963# CHECK-EMPTY:64# CHECK: (lldb) image lookup -a 0x140001019 -v65# CHECK: LineEntry: [0x0000000140001017-0x000000014000101e): C:\src\test\a.cpp:1766# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"67# CHECK-NEXT: Variable: id = {{.*}}, name = "local", type = "int", valid ranges = <block>, location = [0x0000000140001017, 0x000000014000101e) -> DW_OP_reg26 XMM968# CHECK-EMPTY:69# CHECK: (lldb) image lookup -a 0x14000101e -v70# CHECK: LineEntry: [0x000000014000101e-0x0000000140001031): C:\src\test\a.cpp:1871# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"72# CHECK-NEXT: Variable: id = {{.*}}, name = "s", type = "S", valid ranges = <block>, location = [0x000000014000101e, 0x000000014000102c) -> DW_OP_reg24 XMM7, DW_OP_piece 0x4, DW_OP_piece 0x473# CHECK-EMPTY:74# CHECK: (lldb) image lookup -a 0x14000102c -v75# CHECK: LineEntry: [0x000000014000101e-0x0000000140001031): C:\src\test\a.cpp:1876# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"77 78 .text79 .def @feat.00;80 .scl 3;81 .type 0;82 .endef83 .globl @feat.0084.set @feat.00, 085 .intel_syntax noprefix86 .file "a.cpp"87 .def "?CreateS@@YA?AUS@@HD@Z";88 .scl 2;89 .type 32;90 .endef91 .section .text,"xr",one_only,"?CreateS@@YA?AUS@@HD@Z"92 .globl "?CreateS@@YA?AUS@@HD@Z" # -- Begin function ?CreateS@@YA?AUS@@HD@Z93"?CreateS@@YA?AUS@@HD@Z": # @"?CreateS@@YA?AUS@@HD@Z"94.Lfunc_begin0:95 .cv_func_id 096# %bb.0:97 #DEBUG_VALUE: CreateS:p2 <- $dl98 #DEBUG_VALUE: CreateS:p1 <- $ecx99 #DEBUG_VALUE: CreateS:s <- [DW_OP_plus_uconst 1, DW_OP_stack_value, DW_OP_LLVM_fragment 0 32] $ecx100 #DEBUG_VALUE: CreateS:s <- [DW_OP_plus_uconst 2, DW_OP_stack_value, DW_OP_LLVM_fragment 32 8] $dl101 .cv_file 1 "C:\\src\\test\\a.cpp" "446925B46C8C870B01708834F4813A31" 1102 .cv_loc 0 1 10 0 # a.cpp:10:0103 # kill: def $ecx killed $ecx def $rcx104 #DEBUG_VALUE: CreateS:s <- [DW_OP_plus_uconst 1, DW_OP_stack_value, DW_OP_LLVM_fragment 0 32] $ecx105 add ecx, 2106.Ltmp0:107 #DEBUG_VALUE: CreateS:p1 <- [DW_OP_LLVM_entry_value 1] $ecx108 #DEBUG_VALUE: CreateS:s <- [DW_OP_LLVM_fragment 0 32] $ecx109 .cv_loc 0 1 11 0 # a.cpp:11:0110 add dl, 3111.Ltmp1:112 #DEBUG_VALUE: CreateS:p2 <- [DW_OP_LLVM_entry_value 1] $dl113 #DEBUG_VALUE: CreateS:s <- [DW_OP_LLVM_fragment 32 8] $dl114 .cv_loc 0 1 12 0 # a.cpp:12:0115 movzx eax, dl116 shl rax, 32117 or rax, rcx118 ret119.Ltmp2:120.Lfunc_end0:121 # -- End function122 .def main;123 .scl 2;124 .type 32;125 .endef126 .section .text,"xr",one_only,main127 .globl main # -- Begin function main128main: # @main129.Lfunc_begin1:130 .cv_func_id 1131 .cv_loc 1 1 15 0 # a.cpp:15:0132.seh_proc main133# %bb.0:134 #DEBUG_VALUE: main:argv <- $rdx135 #DEBUG_VALUE: main:argc <- $ecx136 sub rsp, 40137 .seh_stackalloc 40138 .seh_endprologue139.Ltmp3:140 .cv_loc 1 1 16 0 # a.cpp:16:0141 add ecx, ecx142.Ltmp4:143 #DEBUG_VALUE: main:argc <- [DW_OP_LLVM_entry_value 1] $ecx144 #DEBUG_VALUE: main:local <- $ecx145 .cv_loc 1 1 17 0 # a.cpp:17:0146 mov dl, 97147.Ltmp5:148 #DEBUG_VALUE: main:argv <- [DW_OP_LLVM_entry_value 1] $rdx149 call "?CreateS@@YA?AUS@@HD@Z"150.Ltmp6:151 #DEBUG_VALUE: main:s <- [DW_OP_LLVM_fragment 0 32] $eax152 #DEBUG_VALUE: main:s <- [DW_OP_constu 40, DW_OP_shr, DW_OP_LLVM_convert 64 7, DW_OP_LLVM_convert 24 7, DW_OP_stack_value, DW_OP_LLVM_fragment 40 24] $rax153 #DEBUG_VALUE: main:s <- [DW_OP_constu 32, DW_OP_shr, DW_OP_LLVM_convert 64 7, DW_OP_LLVM_convert 8 7, DW_OP_stack_value, DW_OP_LLVM_fragment 32 8] $rax154 .cv_loc 1 1 18 0 # a.cpp:18:0155 mov rcx, rax156 shr rcx, 8157 sar ecx, 24158 add ecx, eax159 mov eax, ecx160.Ltmp7:161 add rsp, 40162 ret163# Manually created for testing purpose.164.L31:165 .cv_loc 1 1 1000 0 # a.cpp:1000:0166 ret167.L32:168 ret169.L33:170 ret171.L34:172 .cv_loc 1 1 1001 0 # a.cpp:1001:0173 ret174.L35:175 ret176.L36:177 ret178.L37:179 ret180.L38:181 ret182.L39:183 ret184.L3a:185 ret186.L3b:187 .cv_loc 1 1 1002 0 # a.cpp:1002:0188 ret189.L3c:190 ret191.L3d:192 ret193.L3e:194 ret195.L3f:196 ret197.L40:198 ret199.L41:200 ret201.L42:202 ret203.L43:204 ret205.L44:206 ret207.L45:208 .cv_loc 1 1 1003 0 # a.cpp:1003:0209 ret210.L46:211 ret212.L47:213 ret214.L48:215 ret216.L49:217 ret218.L4a:219 ret220.L4b:221 ret222.L4c:223 ret224.L4d:225 ret226.L4e:227 .cv_loc 1 1 1004 0 # a.cpp:1004:0228 ret229.L4f:230 ret231.L50:232.Ltmp8:233.Lfunc_end1:234 .seh_endproc235 # -- End function236 .section .drectve,"yn"237 .ascii " /DEFAULTLIB:libcmt.lib"238 .ascii " /DEFAULTLIB:oldnames.lib"239 .section .debug$S,"dr"240 .p2align 2241 .long 4 # Debug section magic242 .long 241243 .long .Ltmp10-.Ltmp9 # Subsection size244.Ltmp9:245 .short .Ltmp12-.Ltmp11 # Record length246.Ltmp11:247 .short 4412 # Record kind: S_COMPILE3248 .long 1 # Flags and language249 .short 208 # CPUType250 .short 13 # Frontend version251 .short 0252 .short 0253 .short 0254 .short 13000 # Backend version255 .short 0256 .short 0257 .short 0258 .asciz "clang version 13.0.0" # Null-terminated compiler version string259 .p2align 2260.Ltmp12:261.Ltmp10:262 .p2align 2263 .section .debug$S,"dr",associative,"?CreateS@@YA?AUS@@HD@Z"264 .p2align 2265 .long 4 # Debug section magic266 .long 241 # Symbol subsection for CreateS267 .long .Ltmp14-.Ltmp13 # Subsection size268.Ltmp13:269 .short .Ltmp16-.Ltmp15 # Record length270.Ltmp15:271 .short 4423 # Record kind: S_GPROC32_ID272 .long 0 # PtrParent273 .long 0 # PtrEnd274 .long 0 # PtrNext275 .long .Lfunc_end0-"?CreateS@@YA?AUS@@HD@Z" # Code size276 .long 0 # Offset after prologue277 .long 0 # Offset before epilogue278 .long 4103 # Function type index279 .secrel32 "?CreateS@@YA?AUS@@HD@Z" # Function section relative address280 .secidx "?CreateS@@YA?AUS@@HD@Z" # Function section index281 .byte 0 # Flags282 .asciz "CreateS" # Function name283 .p2align 2284.Ltmp16:285 .short .Ltmp18-.Ltmp17 # Record length286.Ltmp17:287 .short 4114 # Record kind: S_FRAMEPROC288 .long 0 # FrameSize289 .long 0 # Padding290 .long 0 # Offset of padding291 .long 0 # Bytes of callee saved registers292 .long 0 # Exception handler offset293 .short 0 # Exception handler section294 .long 0 # Flags (defines frame register)295 .p2align 2296.Ltmp18:297 .short .Ltmp20-.Ltmp19 # Record length298.Ltmp19:299 .short 4414 # Record kind: S_LOCAL300 .long 116 # TypeIndex301 .short 1 # Flags302 .asciz "p1"303 .p2align 2304.Ltmp20:305 .cv_def_range .Lfunc_begin0 .Ltmp0, reg, 18306 .short .Ltmp22-.Ltmp21 # Record length307.Ltmp21:308 .short 4414 # Record kind: S_LOCAL309 .long 112 # TypeIndex310 .short 1 # Flags311 .asciz "p2"312 .p2align 2313.Ltmp22:314 .cv_def_range .Lfunc_begin0 .Ltmp1, reg, 3315 .short .Ltmp24-.Ltmp23 # Record length316.Ltmp23:317 .short 4414 # Record kind: S_LOCAL318 .long 4100 # TypeIndex319 .short 0 # Flags320 .asciz "s"321 .p2align 2322.Ltmp24:323 # The following .cv_def_range order is inverted on purpose for testing.324 .cv_def_range .Ltmp0 .Lfunc_end0, subfield_reg, 3, 4325 .cv_def_range .Ltmp1 .Lfunc_end0, subfield_reg,18, 0326 .short 2 # Record length327 .short 4431 # Record kind: S_PROC_ID_END328.Ltmp14:329 .p2align 2330 .cv_linetable 0, "?CreateS@@YA?AUS@@HD@Z", .Lfunc_end0331 .section .debug$S,"dr",associative,main332 .p2align 2333 .long 4 # Debug section magic334 .long 241 # Symbol subsection for main335 .long .Ltmp26-.Ltmp25 # Subsection size336.Ltmp25:337 .short .Ltmp28-.Ltmp27 # Record length338.Ltmp27:339 .short 4423 # Record kind: S_GPROC32_ID340 .long 0 # PtrParent341 .long 0 # PtrEnd342 .long 0 # PtrNext343 .long .Lfunc_end1-main # Code size344 .long 0 # Offset after prologue345 .long 0 # Offset before epilogue346 .long 4107 # Function type index347 .secrel32 main # Function section relative address348 .secidx main # Function section index349 .byte 0 # Flags350 .asciz "main" # Function name351 .p2align 2352.Ltmp28:353 .short .Ltmp30-.Ltmp29 # Record length354.Ltmp29:355 .short 4114 # Record kind: S_FRAMEPROC356 .long 40 # FrameSize357 .long 0 # Padding358 .long 0 # Offset of padding359 .long 0 # Bytes of callee saved registers360 .long 0 # Exception handler offset361 .short 0 # Exception handler section362 .long 81920 # Flags (defines frame register)363 .p2align 2364.Ltmp30:365 .short .Ltmp32-.Ltmp31 # Record length366.Ltmp31:367 .short 4414 # Record kind: S_LOCAL368 .long 116 # TypeIndex369 .short 1 # Flags370 .asciz "argc"371 .p2align 2372.Ltmp32:373 .cv_def_range .Lfunc_begin1 .Ltmp4, reg, 18374 .short .Ltmp34-.Ltmp33 # Record length375.Ltmp33:376 .short 4414 # Record kind: S_LOCAL377 .long 4104 # TypeIndex378 .short 1 # Flags379 .asciz "argv"380 .p2align 2381.Ltmp34:382 .cv_def_range .Lfunc_begin1 .Ltmp5, reg, 331383 .short .Ltmp36-.Ltmp35 # Record length384.Ltmp35:385 .short 4414 # Record kind: S_LOCAL386 .long 116 # TypeIndex387 .short 0 # Flags388 .asciz "local"389 .p2align 2390.Ltmp36:391 .cv_def_range .Ltmp4 .Ltmp6, reg, 18392 .short .Ltmp38-.Ltmp37 # Record length393.Ltmp37:394 .short 4414 # Record kind: S_LOCAL395 .long 4100 # TypeIndex396 .short 0 # Flags397 .asciz "s"398 .p2align 2399.Ltmp38:400 .cv_def_range .Ltmp6 .Ltmp7, subfield_reg, 17, 0401 .short .Ltmp101-.Ltmp100402# Manually created debug info for testing purpose.403# 1. Test non-overlapped ranges.404.Ltmp100:405 .short 4414 # Record kind: S_LOCAL406 .long 4109 # TypeIndex407 .short 0 # Flags408 .asciz "non_overlapped_ranges"409 .p2align 2410.Ltmp101:411 .cv_def_range .L31 .L32, reg, 331412 .cv_def_range .L32 .L33, reg, 330413 .cv_def_range .L33 .L34, reg, 336414 .short .Ltmp103-.Ltmp102415# CHECK: (lldb) image lookup -a 0x140001031 -v416# CHECK: LineEntry: [0x0000000140001031-0x0000000140001034): C:\src\test\a.cpp:1000417# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"418# CHECK-NEXT: Variable: id = {{.*}}, name = "non_overlapped_ranges", type = "S1", valid ranges = <block>, location = [0x0000000140001031, 0x0000000140001032) -> DW_OP_reg3 RBX419# CHECK-EMPTY:420# CHECK: (lldb) image lookup -a 0x140001032 -v421# CHECK: LineEntry: [0x0000000140001031-0x0000000140001034): C:\src\test\a.cpp:1000422# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"423# CHECK-NEXT: Variable: id = {{.*}}, name = "non_overlapped_ranges", type = "S1", valid ranges = <block>, location = [0x0000000140001032, 0x0000000140001033) -> DW_OP_reg2 RCX424# CHECK-EMPTY:425# CHECK: (lldb) image lookup -a 0x140001033 -v426# CHECK: LineEntry: [0x0000000140001031-0x0000000140001034): C:\src\test\a.cpp:1000427# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"428# CHECK-NEXT: Variable: id = {{.*}}, name = "non_overlapped_ranges", type = "S1", valid ranges = <block>, location = [0x0000000140001033, 0x0000000140001034) -> DW_OP_reg8 R8429# CHECK-EMPTY:430 431# 2. Test overlapped subfield ranges at different offsets.432.Ltmp102:433 .short 4414 # Record kind: S_LOCAL434 .long 4109 # TypeIndex435 .short 0 # Flags436 .asciz "overlapped_subfield_ranges"437 .p2align 2438.Ltmp103:439 .cv_def_range .L34 .L36, subfield_reg, 3, 0440 .cv_def_range .L35 .L37, subfield_reg, 17, 4441 .cv_def_range .L37 .L39, subfield_reg, 18, 4442 .short .Ltmp105-.Ltmp104443# CHECK: (lldb) image lookup -a 0x140001034 -v444# CHECK: LineEntry: [0x0000000140001034-0x000000014000103b): C:\src\test\a.cpp:1001445# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"446# CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_subfield_ranges", type = "S1", valid ranges = <block>, location = [0x0000000140001034, 0x0000000140001035) -> DW_OP_regx 0x3f, DW_OP_piece 0x1, DW_OP_piece 0x7447# CHECK-EMPTY:448# CHECK: (lldb) image lookup -a 0x140001035 -v449# CHECK: LineEntry: [0x0000000140001034-0x000000014000103b): C:\src\test\a.cpp:1001450# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"451# CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_subfield_ranges", type = "S1", valid ranges = <block>, location = [0x0000000140001035, 0x0000000140001036) -> DW_OP_regx 0x3f, DW_OP_piece 0x1, DW_OP_piece 0x3, DW_OP_reg24 XMM7, DW_OP_piece 0x4452# CHECK-EMPTY:453# CHECK: (lldb) image lookup -a 0x140001036 -v454# CHECK: LineEntry: [0x0000000140001034-0x000000014000103b): C:\src\test\a.cpp:1001455# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"456# CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_subfield_ranges", type = "S1", valid ranges = <block>, location = [0x0000000140001036, 0x0000000140001037) -> DW_OP_piece 0x4, DW_OP_reg24 XMM7, DW_OP_piece 0x4457# CHECK-EMPTY:458# CHECK: (lldb) image lookup -a 0x140001037 -v459# CHECK: LineEntry: [0x0000000140001034-0x000000014000103b): C:\src\test\a.cpp:1001460# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"461# CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_subfield_ranges", type = "S1", valid ranges = <block>, location = [0x0000000140001037, 0x0000000140001039) -> DW_OP_piece 0x4, DW_OP_reg26 XMM9, DW_OP_piece 0x4462# CHECK-EMPTY:463 464# 3. Test overlapped ranges for the whole value.465.Ltmp104:466 .short 4414 # Record kind: S_LOCAL467 .long 4109 # TypeIndex468 .short 0 # Flags469 .asciz "overlapped_ranges_2"470 .p2align 2471.Ltmp105:472 .cv_def_range .L3b .L3d, reg, 331473 .cv_def_range .L3c .L3e, reg, 330474 .cv_def_range .L3f .L44, reg, 339475 .cv_def_range .L41 .L43, reg, 328476 .short .Ltmp107-.Ltmp106477# CHECK: (lldb) image lookup -a 0x14000103b -v478# CHECK: LineEntry: [0x000000014000103b-0x0000000140001045): C:\src\test\a.cpp:1002479# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"480# CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_2", type = "S1", valid ranges = <block>, location = [0x000000014000103b, 0x000000014000103c) -> DW_OP_reg3 RBX481# CHECK-EMPTY:482# CHECK: (lldb) image lookup -a 0x14000103d -v483# CHECK: LineEntry: [0x000000014000103b-0x0000000140001045): C:\src\test\a.cpp:1002484# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"485# CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_2", type = "S1", valid ranges = <block>, location = [0x000000014000103c, 0x000000014000103e) -> DW_OP_reg2 RCX486# CHECK-EMPTY:487# CHECK: (lldb) image lookup -a 0x14000103f -v488# CHECK: LineEntry: [0x000000014000103b-0x0000000140001045): C:\src\test\a.cpp:1002489# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"490# CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_2", type = "S1", valid ranges = <block>, location = [0x000000014000103f, 0x0000000140001041) -> DW_OP_reg11 R11491# CHECK-EMPTY:492# CHECK: (lldb) image lookup -a 0x140001041 -v493# CHECK: LineEntry: [0x000000014000103b-0x0000000140001045): C:\src\test\a.cpp:1002494# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"495# CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_2", type = "S1", valid ranges = <block>, location = [0x0000000140001041, 0x0000000140001043) -> DW_OP_reg0 RAX496# CHECK-EMPTY:497# CHECK: (lldb) image lookup -a 0x140001043 -v498# CHECK: LineEntry: [0x000000014000103b-0x0000000140001045): C:\src\test\a.cpp:1002499# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"500# CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_2", type = "S1", valid ranges = <block>, location = [0x0000000140001043, 0x0000000140001044) -> DW_OP_reg11 R11501# CHECK-EMPTY:502 503# 4. Test overlapped ranges for both subfield and whole value.504.Ltmp106:505 .short 4414 # Record kind: S_LOCAL506 .long 4109 # TypeIndex507 .short 0 # Flags508 .asciz "overlapped_ranges_3"509 .p2align 2510.Ltmp107:511 # The following two lines result:512 # [.L45, .L46) -> value at offset 0 is at reg 3.513 # [.L46, .L49) -> value at offset 0 is at reg 3 and value at offset 4 is at reg 17.514 # [.L49, .L4a) -> value at offset 4 is at reg 17.515 .cv_def_range .L46 .L4a, subfield_reg, 17, 4516 .cv_def_range .L45 .L49, subfield_reg, 3, 0517 # The following overwrites range [.L47, .L48) and [.L49 .L4a) because whole518 # value location is preferred over composited value locations.519 .cv_def_range .L47 .L48, reg, 331520 .cv_def_range .L49 .L4a, reg, 328521 # For the same reason, reg 330 wins in following example.522 .cv_def_range .L4b .L4e, reg, 330523 .cv_def_range .L4b .L4d, subfield_reg, 17, 4524 .cv_def_range .L4c .L4e, subfield_reg, 3, 0525 .short .Ltmp109-.Ltmp108526# CHECK: (lldb) image lookup -a 0x140001045 -v527# CHECK: LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003528# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"529# CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_3", type = "S1", valid ranges = <block>, location = [0x0000000140001045, 0x0000000140001046) -> DW_OP_regx 0x3f, DW_OP_piece 0x1, DW_OP_piece 0x7530# CHECK-EMPTY:531# CHECK: (lldb) image lookup -a 0x140001046 -v532# CHECK: LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003533# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"534# CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_3", type = "S1", valid ranges = <block>, location = [0x0000000140001046, 0x0000000140001047) -> DW_OP_regx 0x3f, DW_OP_piece 0x1, DW_OP_piece 0x3, DW_OP_reg24 XMM7, DW_OP_piece 0x4535# CHECK-EMPTY:536# CHECK: (lldb) image lookup -a 0x140001047 -v537# CHECK: LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003538# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"539# CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_3", type = "S1", valid ranges = <block>, location = [0x0000000140001047, 0x0000000140001048) -> DW_OP_reg3 RBX540# CHECK-EMPTY:541# CHECK: (lldb) image lookup -a 0x140001048 -v542# CHECK: LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003543# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"544# CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_3", type = "S1", valid ranges = <block>, location = [0x0000000140001048, 0x0000000140001049) -> DW_OP_regx 0x3f, DW_OP_piece 0x1, DW_OP_piece 0x3, DW_OP_reg24 XMM7, DW_OP_piece 0x4545# CHECK-EMPTY:546# CHECK: (lldb) image lookup -a 0x140001049 -v547# CHECK: LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003548# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"549# CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_3", type = "S1", valid ranges = <block>, location = [0x0000000140001049, 0x000000014000104a) -> DW_OP_reg0 RAX550# CHECK-EMPTY:551# CHECK: (lldb) image lookup -a 0x14000104a -v552# CHECK: LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003553# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"554# CHECK-EMPTY:555# CHECK: (lldb) image lookup -a 0x14000104b -v556# CHECK: LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003557# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"558# CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_3", type = "S1", valid ranges = <block>, location = [0x000000014000104b, 0x000000014000104e) -> DW_OP_reg2 RCX559# CHECK-EMPTY:560# CHECK: (lldb) image lookup -a 0x14000104c -v561# CHECK: LineEntry: [0x0000000140001045-0x000000014000104e): C:\src\test\a.cpp:1003562# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"563# CHECK-NEXT: Variable: id = {{.*}}, name = "overlapped_ranges_3", type = "S1", valid ranges = <block>, location = [0x000000014000104b, 0x000000014000104e) -> DW_OP_reg2 RCX564# CHECK-EMPTY:565 566# 5. Simple type with subfield.567.Ltmp108:568 .short 4414 # Record kind: S_LOCAL569 .long 19 # TypeIndex570 .short 0 # Flags571 .asciz "simple_type1"572 .p2align 2573.Ltmp109:574 .cv_def_range .L4e .L4f, subfield_reg, 17, 4575 .cv_def_range .L4e .L50, subfield_reg, 18, 0576 .short 2577 .short 4431 # Record kind: S_PROC_ID_END578# CHECK: (lldb) image lookup -a 0x14000104e -v579# CHECK: LineEntry: [0x000000014000104e-0x0000000140001050): C:\src\test\a.cpp:1004580# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"581# CHECK-NEXT: Variable: id = {{.*}}, name = "simple_type1", type = "long long", valid ranges = <block>, location = [0x000000014000104e, 0x000000014000104f) -> DW_OP_reg26 XMM9, DW_OP_piece 0x4, DW_OP_reg24 XMM7, DW_OP_piece 0x4582# CHECK-EMPTY:583# CHECK: (lldb) image lookup -a 0x14000104f -v584# CHECK: LineEntry: [0x000000014000104e-0x0000000140001050): C:\src\test\a.cpp:1004585# CHECK-NEXT: Symbol: id = {{.*}}, range = [0x0000000140001011-0x0000000140001050), name="main"586# CHECK-NEXT: Variable: id = {{.*}}, name = "simple_type1", type = "long long", valid ranges = <block>, location = [0x000000014000104f, 0x0000000140001050) -> DW_OP_reg26 XMM9, DW_OP_piece 0x4, DW_OP_piece 0x4587# CHECK-EMPTY:588 589.Ltmp26:590 .p2align 2591 .cv_linetable 1, main, .Lfunc_end1592 .section .debug$S,"dr"593 .long 241594 .long .Ltmp40-.Ltmp39 # Subsection size595.Ltmp39:596 .short .Ltmp42-.Ltmp41 # Record length597.Ltmp41:598 .short 4360 # Record kind: S_UDT599 .long 4100 # Type600 .asciz "S"601 .p2align 2602.Ltmp42:603.Ltmp40:604 .p2align 2605 .cv_filechecksums # File index to string table offset subsection606 .cv_stringtable # String table607 .long 241608 .long .Ltmp44-.Ltmp43 # Subsection size609.Ltmp43:610 .short .Ltmp46-.Ltmp45 # Record length611.Ltmp45:612 .short 4428 # Record kind: S_BUILDINFO613 .long 4110 # LF_BUILDINFO index614 .p2align 2615.Ltmp46:616.Ltmp44:617 .p2align 2618 .section .debug$T,"dr"619 .p2align 2620 .long 4 # Debug section magic621 # Struct (0x1000)622 .short 0x1e # Record length623 .short 0x1505 # Record kind: LF_STRUCTURE624 .short 0x0 # MemberCount625 .short 0x280 # Properties ( ForwardReference (0x80) | HasUniqueName (0x200) )626 .long 0x0 # FieldList627 .long 0x0 # DerivedFrom628 .long 0x0 # VShape629 .short 0x0 # SizeOf630 .asciz "S" # Name631 .asciz ".?AUS@@" # LinkageName632 # ArgList (0x1001)633 .short 0xe # Record length634 .short 0x1201 # Record kind: LF_ARGLIST635 .long 0x2 # NumArgs636 .long 0x74 # Argument: int637 .long 0x70 # Argument: char638 # Procedure (0x1002)639 .short 0xe # Record length640 .short 0x1008 # Record kind: LF_PROCEDURE641 .long 0x1000 # ReturnType: S642 .byte 0x0 # CallingConvention: NearC643 .byte 0x0 # FunctionOptions644 .short 0x2 # NumParameters645 .long 0x1001 # ArgListType: (int, char)646 # FieldList (0x1003)647 .short 0x1a # Record length648 .short 0x1203 # Record kind: LF_FIELDLIST649 .short 0x150d # Member kind: DataMember ( LF_MEMBER )650 .short 0x3 # Attrs: Public651 .long 0x74 # Type: int652 .short 0x0 # FieldOffset653 .asciz "x" # Name654 .short 0x150d # Member kind: DataMember ( LF_MEMBER )655 .short 0x3 # Attrs: Public656 .long 0x70 # Type: char657 .short 0x4 # FieldOffset658 .asciz "y" # Name659 # Struct (0x1004)660 .short 0x1e # Record length661 .short 0x1505 # Record kind: LF_STRUCTURE662 .short 0x2 # MemberCount663 .short 0x200 # Properties ( HasUniqueName (0x200) )664 .long 0x1003 # FieldList: <field list>665 .long 0x0 # DerivedFrom666 .long 0x0 # VShape667 .short 0x8 # SizeOf668 .asciz "S" # Name669 .asciz ".?AUS@@" # LinkageName670 # StringId (0x1005)671 .short 0x1a # Record length672 .short 0x1605 # Record kind: LF_STRING_ID673 .long 0x0 # Id674 .asciz "C:\\src\\test\\a.cpp" # StringData675 .byte 242676 .byte 241677 # UdtSourceLine (0x1006)678 .short 0xe # Record length679 .short 0x1606 # Record kind: LF_UDT_SRC_LINE680 .long 0x1004 # UDT: S681 .long 0x1005 # SourceFile: C:\src\test\a.cpp682 .long 0x1 # LineNumber683 # FuncId (0x1007)684 .short 0x12 # Record length685 .short 0x1601 # Record kind: LF_FUNC_ID686 .long 0x0 # ParentScope687 .long 0x1002 # FunctionType: S (int, char)688 .asciz "CreateS" # Name689 # Pointer (0x1008)690 .short 0xa # Record length691 .short 0x1002 # Record kind: LF_POINTER692 .long 0x670 # PointeeType: char*693 .long 0x1000c # Attrs: [ Type: Near64, Mode: Pointer, SizeOf: 8 ]694 # ArgList (0x1009)695 .short 0xe # Record length696 .short 0x1201 # Record kind: LF_ARGLIST697 .long 0x2 # NumArgs698 .long 0x74 # Argument: int699 .long 0x1008 # Argument: char**700 # Procedure (0x100A)701 .short 0xe # Record length702 .short 0x1008 # Record kind: LF_PROCEDURE703 .long 0x74 # ReturnType: int704 .byte 0x0 # CallingConvention: NearC705 .byte 0x0 # FunctionOptions706 .short 0x2 # NumParameters707 .long 0x1009 # ArgListType: (int, char**)708 # FuncId (0x100B)709 .short 0x12 # Record length710 .short 0x1601 # Record kind: LF_FUNC_ID711 .long 0x0 # ParentScope712 .long 0x100a # FunctionType: int (int, char**)713 .asciz "main" # Name714 .byte 243715 .byte 242716 .byte 241717 # Manually created debug info for testing purpose, FieldList (0x100C) and Struct (0x100D)718 # FieldList (0x100C)719 .short 0x1a # Record length720 .short 0x1203 # Record kind: LF_FIELDLIST721 .short 0x150d # Member kind: DataMember ( LF_MEMBER )722 .short 0x3 # Attrs: Public723 .long 0x70 # Type: char724 .short 0x0 # FieldOffset725 .asciz "c" # Name726 .short 0x150d # Member kind: DataMember ( LF_MEMBER )727 .short 0x3 # Attrs: Public728 .long 0x74 # Type: int729 .short 0x4 # FieldOffset730 .asciz "i" # Name731 # Struct (0x100D)732 .short 0x20 # Record length733 .short 0x1505 # Record kind: LF_STRUCTURE734 .short 0x2 # MemberCount735 .short 0x200 # Properties ( HasUniqueName (0x200) )736 .long 0x100c # FieldList: <field list>737 .long 0x0 # DerivedFrom738 .long 0x0 # VShape739 .short 0x8 # SizeOf740 .asciz "S1" # Name741 .asciz ".?AUS1@@" # LinkageName742 # BuildInfo (0x100E)743 .short 0x1a # Record length744 .short 0x1603 # Record kind: LF_BUILDINFO745 .short 0x1 # NumArgs746 .long 0x0 # Argument747 .long 0x0 # Argument748 .long 0x0 # Argument749 .long 0x0 # Argument750 .long 0x0 # Argument751 .byte 242752 .byte 241753 .addrsig754