454 lines · plain
1## Check that the --debug-vars option works for simple register locations, when2## using DWARF4 debug info, with multiple functions in one section. Check that3## 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 parsing5## used by --debug-vars, but do add extra lines or columns to the output, so we6## 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.o12 13# RUN: llvm-objdump %t.o -d --debug-vars | \14# RUN: FileCheck %s --check-prefix=RAW --strict-whitespace15 16## Check that passing the default value for --debug-vars-indent (52) makes no17## change to the output.18# RUN: llvm-objdump %t.o -d --debug-vars --debug-indent=52 | \19# RUN: FileCheck %s --check-prefix=RAW --strict-whitespace20 21# RUN: llvm-objdump %t.o -d --debug-vars --debug-indent=30 | \22# RUN: FileCheck %s --check-prefix=INDENT --strict-whitespace23 24# RUN: llvm-objdump %t.o -d --debug-vars --no-show-raw-insn | \25# RUN: FileCheck %s --check-prefix=NO-RAW --strict-whitespace26 27# RUN: llvm-objdump %t.o -d --debug-vars --no-show-raw-insn --line-numbers | \28# RUN: FileCheck %s --check-prefix=LINE-NUMS --strict-whitespace29 30# RUN: mkdir -p %t/a31# RUN: cp %p/Inputs/debug.c %t/a/debug.c32# RUN: sed -e "s,SRC_COMPDIR,%/t/a,g" %s > %t.s33# 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-whitespace36 37## An optional argument to the --debug-vars= option can be used to switch38## 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-whitespace41# RUN: llvm-objdump %t.o -d --debug-vars=ascii | \42# RUN: FileCheck %s --check-prefix=ASCII --strict-whitespace43# RUN: not llvm-objdump %t.o -d --debug-vars=bad_value 2>&1 | \44# RUN: FileCheck %s --check-prefix=ERROR45 46## Note that llvm-objdump emits tab characters in the disassembly, assuming an47## 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 = R082# NO-RAW-NEXT: ┃ ┠─ b = R183# NO-RAW-NEXT: ┃ ┃ ┠─ c = R284# NO-RAW-NEXT: ┃ ┃ ┃ ┌─ x = R085# NO-RAW-NEXT: 0: add r0, r1, r0 ┻ ┃ ┃ ╈86# NO-RAW-NEXT: ┌─ y = R087# 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 = R092# 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 = R098# LINE-NUMS-NEXT: ┃ ┠─ b = R199# LINE-NUMS-NEXT: ┃ ┃ ┠─ c = R2100# LINE-NUMS-NEXT: ┃ ┃ ┃ ┌─ x = R0101# LINE-NUMS-NEXT: 0: add r0, r1, r0 ┻ ┃ ┃ ╈102# LINE-NUMS-NEXT: ; SRC_COMPDIR{{[\\/]}}debug.c:3 ┌─ y = R0103# 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 = R0110# 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 = R0116# SOURCE-NEXT: ┃ ┠─ b = R1117# SOURCE-NEXT: ┃ ┃ ┠─ c = R2118# SOURCE-NEXT: ┃ ┃ ┃ ┌─ x = R0119# SOURCE-NEXT: 0: add r0, r1, r0 ┻ ┃ ┃ ╈120# SOURCE-NEXT: ; int y = x + c; ┌─ y = R0121# 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 = R0127# 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 .text149 .syntax unified150 .eabi_attribute 67, "2.09"151 .eabi_attribute 6, 10152 .eabi_attribute 7, 65153 .eabi_attribute 8, 1154 .eabi_attribute 9, 2155 .fpu neon156 .eabi_attribute 34, 0157 .eabi_attribute 17, 1158 .eabi_attribute 20, 1159 .eabi_attribute 21, 1160 .eabi_attribute 23, 3161 .eabi_attribute 24, 1162 .eabi_attribute 25, 1163 .eabi_attribute 38, 1164 .eabi_attribute 18, 4165 .eabi_attribute 26, 2166 .eabi_attribute 14, 0167 .file "debug.c"168 .globl foo169 .p2align 2170 .type foo,%function171 .code 32172foo:173.Lfunc_begin0:174 .file 1 "" "SRC_COMPDIR/debug.c"175 .loc 1 1 0176 .fnstart177 .cfi_sections .debug_frame178 .cfi_startproc179 .loc 1 2 13 prologue_end180 add r0, r1, r0181.Ltmp0:182 .loc 1 3 13183 add r0, r0, r2184.Ltmp1:185 .loc 1 4 3186 bx lr187.Ltmp2:188.Lfunc_end0:189 .size foo, .Lfunc_end0-foo190 .cfi_endproc191 .cantunwind192 .fnend193 194 .globl bar195 .p2align 2196 .type bar,%function197 .code 32198bar:199.Lfunc_begin1:200 .loc 1 7 0201 .fnstart202 .cfi_startproc203 .loc 1 8 4 prologue_end204 add r0, r0, #1205.Ltmp3:206 .loc 1 9 3207 bx lr208.Ltmp4:209.Lfunc_end1:210 .size bar, .Lfunc_end1-bar211 .cfi_endproc212 .cantunwind213 .fnend214 215 .section .debug_str,"MS",%progbits,1216.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,"",%progbits239.Ldebug_loc0:240 .long .Lfunc_begin0-.Lfunc_begin0241 .long .Ltmp0-.Lfunc_begin0242 .short 1243 .byte 80244 .long 0245 .long 0246.Ldebug_loc1:247 .long .Ltmp0-.Lfunc_begin0248 .long .Ltmp1-.Lfunc_begin0249 .short 1250 .byte 80251 .long 0252 .long 0253.Ldebug_loc2:254 .long .Ltmp1-.Lfunc_begin0255 .long .Lfunc_end0-.Lfunc_begin0256 .short 1257 .byte 80258 .long 0259 .long 0260 .section .debug_abbrev,"",%progbits261 .byte 1262 .byte 17263 .byte 1264 .byte 37265 .byte 14266 .byte 19267 .byte 5268 .byte 3269 .byte 14270 .byte 16271 .byte 23272 .byte 27273 .byte 14274 .byte 17275 .byte 1276 .byte 18277 .byte 6278 .byte 0279 .byte 0280 .byte 2281 .byte 46282 .byte 1283 .byte 17284 .byte 1285 .byte 18286 .byte 6287 .byte 64288 .byte 24289 .ascii "\227B"290 .byte 25291 .byte 3292 .byte 14293 .byte 58294 .byte 11295 .byte 59296 .byte 11297 .byte 39298 .byte 25299 .byte 73300 .byte 19301 .byte 63302 .byte 25303 .byte 0304 .byte 0305 .byte 3306 .byte 5307 .byte 0308 .byte 2309 .byte 23310 .byte 3311 .byte 14312 .byte 58313 .byte 11314 .byte 59315 .byte 11316 .byte 73317 .byte 19318 .byte 0319 .byte 0320 .byte 4321 .byte 5322 .byte 0323 .byte 2324 .byte 24325 .byte 3326 .byte 14327 .byte 58328 .byte 11329 .byte 59330 .byte 11331 .byte 73332 .byte 19333 .byte 0334 .byte 0335 .byte 5336 .byte 52337 .byte 0338 .byte 2339 .byte 23340 .byte 3341 .byte 14342 .byte 58343 .byte 11344 .byte 59345 .byte 11346 .byte 73347 .byte 19348 .byte 0349 .byte 0350 .byte 6351 .byte 36352 .byte 0353 .byte 3354 .byte 14355 .byte 62356 .byte 11357 .byte 11358 .byte 11359 .byte 0360 .byte 0361 .byte 0362 .section .debug_info,"",%progbits363.Lcu_begin0:364 .long .Ldebug_info_end0-.Ldebug_info_start0365.Ldebug_info_start0:366 .short 4367 .long .debug_abbrev368 .byte 4369 .byte 1370 .long .Linfo_string0371 .short 12372 .long .Linfo_string1373 .long .Lline_table_start0374 .long .Linfo_string2375 .long .Lfunc_begin0376 .long .Lfunc_end1-.Lfunc_begin0377 .byte 2378 .long .Lfunc_begin0379 .long .Lfunc_end0-.Lfunc_begin0380 .byte 1381 .byte 91382 383 .long .Linfo_string3384 .byte 1385 .byte 1386 387 .long 166388 389 .byte 3390 .long .Ldebug_loc0391 .long .Linfo_string6392 .byte 1393 .byte 1394 .long 166395 .byte 4396 .byte 1397 .byte 81398 .long .Linfo_string7399 .byte 1400 .byte 1401 .long 166402 .byte 4403 .byte 1404 .byte 82405 .long .Linfo_string8406 .byte 1407 .byte 1408 .long 166409 .byte 5410 .long .Ldebug_loc1411 .long .Linfo_string9412 .byte 1413 .byte 2414 .long 166415 .byte 5416 .long .Ldebug_loc2417 .long .Linfo_string10418 .byte 1419 .byte 3420 .long 166421 .byte 0422 .byte 2423 .long .Lfunc_begin1424 .long .Lfunc_end1-.Lfunc_begin1425 .byte 1426 .byte 91427 428 .long .Linfo_string5429 .byte 1430 .byte 7431 432 .long 166433 434 .byte 4435 .byte 1436 .byte 80437 .long .Linfo_string6438 .byte 1439 .byte 7440 .long 166441 .byte 0442 .byte 6443 .long .Linfo_string4444 .byte 5445 .byte 4446 .byte 0447.Ldebug_info_end0:448 .ident "clang version 10.0.0 (git@github.com:llvm/llvm-project.git e73f78acd34360f7450b81167d9dc858ccddc262)"449 .section ".note.GNU-stack","",%progbits450 .addrsig451 .eabi_attribute 30, 1452 .section .debug_line,"",%progbits453.Lline_table_start0:454