1## Check that the --debug-vars option works for simple register locations, when 2## using DWARF4 debug info, with multiple functions in one section. Check that 3## the live-range lines are rendered correctly when using the --no-show-raw-insn, 4## --line-numbers and --source options. These do not affect the DWARF parsing 5## used by --debug-vars, but do add extra lines or columns to the output, so we 6## test to make sure the live ranges are still displayed correctly. 7 8## Generated with this compile command, with the source code in Inputs/debug.c: 9## clang --target=arm--none-eabi -march=armv7-a -c debug.c -O1 -gdwarf-4 -S -o - 10 11# RUN: llvm-mc -triple armv8a--none-eabi < %s -filetype=obj -o %t.o 12 13# RUN: llvm-objdump %t.o -d --debug-vars | \ 14# RUN: FileCheck %s --check-prefix=RAW --strict-whitespace 15 16## Check that passing the default value for --debug-vars-indent (52) makes no 17## change to the output. 18# RUN: llvm-objdump %t.o -d --debug-vars --debug-vars-indent=52 | \ 19# RUN: FileCheck %s --check-prefix=RAW --strict-whitespace 20 21# RUN: llvm-objdump %t.o -d --debug-vars --debug-vars-indent=30 | \ 22# RUN: FileCheck %s --check-prefix=INDENT --strict-whitespace 23 24# RUN: llvm-objdump %t.o -d --debug-vars --no-show-raw-insn | \ 25# RUN: FileCheck %s --check-prefix=NO-RAW --strict-whitespace 26 27# RUN: llvm-objdump %t.o -d --debug-vars --no-show-raw-insn --line-numbers | \ 28# RUN: FileCheck %s --check-prefix=LINE-NUMS --strict-whitespace 29 30# RUN: mkdir -p %t/a 31# RUN: cp %p/Inputs/debug.c %t/a/debug.c 32# RUN: sed -e "s,SRC_COMPDIR,%/t/a,g" %s > %t.s 33# RUN: llvm-mc -triple armv8a--none-eabi < %t.s -filetype=obj | \ 34# RUN: llvm-objdump - -d --debug-vars --no-show-raw-insn --source | \ 35# RUN: FileCheck %s --check-prefix=SOURCE --strict-whitespace 36 37## An optional argument to the --debug-vars= option can be used to switch 38## between unicode and ascii output (with unicode being the default). 39# RUN: llvm-objdump %t.o -d --debug-vars=unicode | \ 40# RUN: FileCheck %s --check-prefix=RAW --strict-whitespace 41# RUN: llvm-objdump %t.o -d --debug-vars=ascii | \ 42# RUN: FileCheck %s --check-prefix=ASCII --strict-whitespace 43# RUN: not llvm-objdump %t.o -d --debug-vars=bad_value 2>&1 | \ 44# RUN: FileCheck %s --check-prefix=ERROR 45 46## Note that llvm-objdump emits tab characters in the disassembly, assuming an 47## 8-byte tab stop, so these might not look aligned in a text editor. 48 49# RAW: 00000000 <foo>: 50# RAW-NEXT: ┠─ a = R0 51# RAW-NEXT: ┃ ┠─ b = R1 52# RAW-NEXT: ┃ ┃ ┠─ c = R2 53# RAW-NEXT: ┃ ┃ ┃ ┌─ x = R0 54# RAW-NEXT: 0: e0810000 add r0, r1, r0 ┻ ┃ ┃ ╈ 55# RAW-NEXT: ┌─ y = R0 56# RAW-NEXT: 4: e0800002 add r0, r0, r2 ╈ ┃ ┃ ┻ 57# RAW-NEXT: 8: e12fff1e bx lr ┻ ┻ ┻ 58# RAW-EMPTY: 59# RAW-NEXT: 0000000c <bar>: 60# RAW-NEXT: ┠─ a = R0 61# RAW-NEXT: c: e2800001 add r0, r0, #1 ┃ 62# RAW-NEXT: 10: e12fff1e bx lr ┻ 63 64 65# INDENT: 00000000 <foo>: 66# INDENT-NEXT: ┠─ a = R0 67# INDENT-NEXT: ┃ ┠─ b = R1 68# INDENT-NEXT: ┃ ┃ ┠─ c = R2 69# INDENT-NEXT: ┃ ┃ ┃ ┌─ x = R0 70# INDENT-NEXT: 0: e0810000 add r0, r1, r0 ┻ ┃ ┃ ╈ 71# INDENT-NEXT: ┌─ y = R0 72# INDENT-NEXT: 4: e0800002 add r0, r0, r2 ╈ ┃ ┃ ┻ 73# INDENT-NEXT: 8: e12fff1e bx lr ┻ ┻ ┻ 74# INDENT-EMPTY: 75# INDENT-NEXT: 0000000c <bar>: 76# INDENT-NEXT: ┠─ a = R0 77# INDENT-NEXT: c: e2800001 add r0, r0, #1 ┃ 78# INDENT-NEXT: 10: e12fff1e bx lr ┻ 79 80# NO-RAW: 00000000 <foo>: 81# NO-RAW-NEXT: ┠─ a = R0 82# NO-RAW-NEXT: ┃ ┠─ b = R1 83# NO-RAW-NEXT: ┃ ┃ ┠─ c = R2 84# NO-RAW-NEXT: ┃ ┃ ┃ ┌─ x = R0 85# NO-RAW-NEXT: 0: add r0, r1, r0 ┻ ┃ ┃ ╈ 86# NO-RAW-NEXT: ┌─ y = R0 87# NO-RAW-NEXT: 4: add r0, r0, r2 ╈ ┃ ┃ ┻ 88# NO-RAW-NEXT: 8: bx lr ┻ ┻ ┻ 89# NO-RAW-EMPTY: 90# NO-RAW-NEXT: 0000000c <bar>: 91# NO-RAW-NEXT: ┠─ a = R0 92# NO-RAW-NEXT: c: add r0, r0, #1 ┃ 93# NO-RAW-NEXT: 10: bx lr ┻ 94 95# LINE-NUMS: 00000000 <foo>: 96# LINE-NUMS-NEXT: ; foo(): 97# LINE-NUMS-NEXT: ; SRC_COMPDIR{{[\\/]}}debug.c:2 ┠─ a = R0 98# LINE-NUMS-NEXT: ┃ ┠─ b = R1 99# LINE-NUMS-NEXT: ┃ ┃ ┠─ c = R2 100# LINE-NUMS-NEXT: ┃ ┃ ┃ ┌─ x = R0 101# LINE-NUMS-NEXT: 0: add r0, r1, r0 ┻ ┃ ┃ ╈ 102# LINE-NUMS-NEXT: ; SRC_COMPDIR{{[\\/]}}debug.c:3 ┌─ y = R0 103# LINE-NUMS-NEXT: 4: add r0, r0, r2 ╈ ┃ ┃ ┻ 104# LINE-NUMS-NEXT: ; SRC_COMPDIR{{[\\/]}}debug.c:4 ┃ ┃ ┃ 105# LINE-NUMS-NEXT: 8: bx lr ┻ ┻ ┻ 106# LINE-NUMS-EMPTY: 107# LINE-NUMS-NEXT: 0000000c <bar>: 108# LINE-NUMS-NEXT: ; bar(): 109# LINE-NUMS-NEXT: ; SRC_COMPDIR{{[\\/]}}debug.c:8 ┠─ a = R0 110# LINE-NUMS-NEXT: c: add r0, r0, #1 ┃ 111# LINE-NUMS-NEXT: ; SRC_COMPDIR{{[\\/]}}debug.c:9 ┃ 112# LINE-NUMS-NEXT: 10: bx lr ┻ 113 114# SOURCE: 00000000 <foo>: 115# SOURCE-NEXT: ; int x = a + b; ┠─ a = R0 116# SOURCE-NEXT: ┃ ┠─ b = R1 117# SOURCE-NEXT: ┃ ┃ ┠─ c = R2 118# SOURCE-NEXT: ┃ ┃ ┃ ┌─ x = R0 119# SOURCE-NEXT: 0: add r0, r1, r0 ┻ ┃ ┃ ╈ 120# SOURCE-NEXT: ; int y = x + c; ┌─ y = R0 121# SOURCE-NEXT: 4: add r0, r0, r2 ╈ ┃ ┃ ┻ 122# SOURCE-NEXT: ; return y; ┃ ┃ ┃ 123# SOURCE-NEXT: 8: bx lr ┻ ┻ ┻ 124# SOURCE-EMPTY: 125# SOURCE-NEXT: 0000000c <bar>: 126# SOURCE-NEXT: ; a++; ┠─ a = R0 127# SOURCE-NEXT: c: add r0, r0, #1 ┃ 128# SOURCE-NEXT: ; return a; ┃ 129# SOURCE-NEXT: 10: bx lr ┻ 130 131# ASCII: 00000000 <foo>: 132# ASCII-NEXT: |- a = R0 133# ASCII-NEXT: | |- b = R1 134# ASCII-NEXT: | | |- c = R2 135# ASCII-NEXT: | | | /- x = R0 136# ASCII-NEXT: 0: e0810000 add r0, r1, r0 v | | ^ 137# ASCII-NEXT: /- y = R0 138# ASCII-NEXT: 4: e0800002 add r0, r0, r2 ^ | | v 139# ASCII-NEXT: 8: e12fff1e bx lr v v v 140# ASCII-EMPTY: 141# ASCII-NEXT: 0000000c <bar>: 142# ASCII-NEXT: |- a = R0 143# ASCII-NEXT: c: e2800001 add r0, r0, #1 | 144# ASCII-NEXT: 10: e12fff1e bx lr v 145 146# ERROR: error: 'bad_value' is not a valid value for '--debug-vars=' 147 148 .text 149 .syntax unified 150 .eabi_attribute 67, "2.09" 151 .eabi_attribute 6, 10 152 .eabi_attribute 7, 65 153 .eabi_attribute 8, 1 154 .eabi_attribute 9, 2 155 .fpu neon 156 .eabi_attribute 34, 0 157 .eabi_attribute 17, 1 158 .eabi_attribute 20, 1 159 .eabi_attribute 21, 1 160 .eabi_attribute 23, 3 161 .eabi_attribute 24, 1 162 .eabi_attribute 25, 1 163 .eabi_attribute 38, 1 164 .eabi_attribute 18, 4 165 .eabi_attribute 26, 2 166 .eabi_attribute 14, 0 167 .file "debug.c" 168 .globl foo 169 .p2align 2 170 .type foo,%function 171 .code 32 172foo: 173.Lfunc_begin0: 174 .file 1 "" "SRC_COMPDIR/debug.c" 175 .loc 1 1 0 176 .fnstart 177 .cfi_sections .debug_frame 178 .cfi_startproc 179 .loc 1 2 13 prologue_end 180 add r0, r1, r0 181.Ltmp0: 182 .loc 1 3 13 183 add r0, r0, r2 184.Ltmp1: 185 .loc 1 4 3 186 bx lr 187.Ltmp2: 188.Lfunc_end0: 189 .size foo, .Lfunc_end0-foo 190 .cfi_endproc 191 .cantunwind 192 .fnend 193 194 .globl bar 195 .p2align 2 196 .type bar,%function 197 .code 32 198bar: 199.Lfunc_begin1: 200 .loc 1 7 0 201 .fnstart 202 .cfi_startproc 203 .loc 1 8 4 prologue_end 204 add r0, r0, #1 205.Ltmp3: 206 .loc 1 9 3 207 bx lr 208.Ltmp4: 209.Lfunc_end1: 210 .size bar, .Lfunc_end1-bar 211 .cfi_endproc 212 .cantunwind 213 .fnend 214 215 .section .debug_str,"MS",%progbits,1 216.Linfo_string0: 217 .asciz "clang version 10.0.0 (git@github.com:llvm/llvm-project.git e73f78acd34360f7450b81167d9dc858ccddc262)" 218.Linfo_string1: 219 .asciz "SRC_COMPDIR/debug.c" 220.Linfo_string2: 221 .asciz "" 222.Linfo_string3: 223 .asciz "foo" 224.Linfo_string4: 225 .asciz "int" 226.Linfo_string5: 227 .asciz "bar" 228.Linfo_string6: 229 .asciz "a" 230.Linfo_string7: 231 .asciz "b" 232.Linfo_string8: 233 .asciz "c" 234.Linfo_string9: 235 .asciz "x" 236.Linfo_string10: 237 .asciz "y" 238 .section .debug_loc,"",%progbits 239.Ldebug_loc0: 240 .long .Lfunc_begin0-.Lfunc_begin0 241 .long .Ltmp0-.Lfunc_begin0 242 .short 1 243 .byte 80 244 .long 0 245 .long 0 246.Ldebug_loc1: 247 .long .Ltmp0-.Lfunc_begin0 248 .long .Ltmp1-.Lfunc_begin0 249 .short 1 250 .byte 80 251 .long 0 252 .long 0 253.Ldebug_loc2: 254 .long .Ltmp1-.Lfunc_begin0 255 .long .Lfunc_end0-.Lfunc_begin0 256 .short 1 257 .byte 80 258 .long 0 259 .long 0 260 .section .debug_abbrev,"",%progbits 261 .byte 1 262 .byte 17 263 .byte 1 264 .byte 37 265 .byte 14 266 .byte 19 267 .byte 5 268 .byte 3 269 .byte 14 270 .byte 16 271 .byte 23 272 .byte 27 273 .byte 14 274 .byte 17 275 .byte 1 276 .byte 18 277 .byte 6 278 .byte 0 279 .byte 0 280 .byte 2 281 .byte 46 282 .byte 1 283 .byte 17 284 .byte 1 285 .byte 18 286 .byte 6 287 .byte 64 288 .byte 24 289 .ascii "\227B" 290 .byte 25 291 .byte 3 292 .byte 14 293 .byte 58 294 .byte 11 295 .byte 59 296 .byte 11 297 .byte 39 298 .byte 25 299 .byte 73 300 .byte 19 301 .byte 63 302 .byte 25 303 .byte 0 304 .byte 0 305 .byte 3 306 .byte 5 307 .byte 0 308 .byte 2 309 .byte 23 310 .byte 3 311 .byte 14 312 .byte 58 313 .byte 11 314 .byte 59 315 .byte 11 316 .byte 73 317 .byte 19 318 .byte 0 319 .byte 0 320 .byte 4 321 .byte 5 322 .byte 0 323 .byte 2 324 .byte 24 325 .byte 3 326 .byte 14 327 .byte 58 328 .byte 11 329 .byte 59 330 .byte 11 331 .byte 73 332 .byte 19 333 .byte 0 334 .byte 0 335 .byte 5 336 .byte 52 337 .byte 0 338 .byte 2 339 .byte 23 340 .byte 3 341 .byte 14 342 .byte 58 343 .byte 11 344 .byte 59 345 .byte 11 346 .byte 73 347 .byte 19 348 .byte 0 349 .byte 0 350 .byte 6 351 .byte 36 352 .byte 0 353 .byte 3 354 .byte 14 355 .byte 62 356 .byte 11 357 .byte 11 358 .byte 11 359 .byte 0 360 .byte 0 361 .byte 0 362 .section .debug_info,"",%progbits 363.Lcu_begin0: 364 .long .Ldebug_info_end0-.Ldebug_info_start0 365.Ldebug_info_start0: 366 .short 4 367 .long .debug_abbrev 368 .byte 4 369 .byte 1 370 .long .Linfo_string0 371 .short 12 372 .long .Linfo_string1 373 .long .Lline_table_start0 374 .long .Linfo_string2 375 .long .Lfunc_begin0 376 .long .Lfunc_end1-.Lfunc_begin0 377 .byte 2 378 .long .Lfunc_begin0 379 .long .Lfunc_end0-.Lfunc_begin0 380 .byte 1 381 .byte 91 382 383 .long .Linfo_string3 384 .byte 1 385 .byte 1 386 387 .long 166 388 389 .byte 3 390 .long .Ldebug_loc0 391 .long .Linfo_string6 392 .byte 1 393 .byte 1 394 .long 166 395 .byte 4 396 .byte 1 397 .byte 81 398 .long .Linfo_string7 399 .byte 1 400 .byte 1 401 .long 166 402 .byte 4 403 .byte 1 404 .byte 82 405 .long .Linfo_string8 406 .byte 1 407 .byte 1 408 .long 166 409 .byte 5 410 .long .Ldebug_loc1 411 .long .Linfo_string9 412 .byte 1 413 .byte 2 414 .long 166 415 .byte 5 416 .long .Ldebug_loc2 417 .long .Linfo_string10 418 .byte 1 419 .byte 3 420 .long 166 421 .byte 0 422 .byte 2 423 .long .Lfunc_begin1 424 .long .Lfunc_end1-.Lfunc_begin1 425 .byte 1 426 .byte 91 427 428 .long .Linfo_string5 429 .byte 1 430 .byte 7 431 432 .long 166 433 434 .byte 4 435 .byte 1 436 .byte 80 437 .long .Linfo_string6 438 .byte 1 439 .byte 7 440 .long 166 441 .byte 0 442 .byte 6 443 .long .Linfo_string4 444 .byte 5 445 .byte 4 446 .byte 0 447.Ldebug_info_end0: 448 .ident "clang version 10.0.0 (git@github.com:llvm/llvm-project.git e73f78acd34360f7450b81167d9dc858ccddc262)" 449 .section ".note.GNU-stack","",%progbits 450 .addrsig 451 .eabi_attribute 30, 1 452 .section .debug_line,"",%progbits 453.Lline_table_start0: 454