xref: /llvm-project/llvm/test/tools/llvm-objdump/ELF/AArch64/disassemble-print-comments.s (revision 75cdab6dc2453a508157a9c383b93373a93078d6)
1## Check that 'llvm-objdump --no-print-imm-hex -d' prints comments generated by the disassembler.
2
3# RUN: llvm-mc -filetype=obj -triple=aarch64 -mattr=+sve %s -o %t
4# RUN: llvm-objdump --no-print-imm-hex -d --mattr=+sve --no-show-raw-insn %t | FileCheck %s
5
6# CHECK:      0000000000000000 <foo>:
7# CHECK-NEXT:        0:   add x0, x2, #2, lsl #12    // =8192
8# CHECK-NEXT:        4:   add z31.d, z31.d, #65280   // =0xff00
9
10## Check that comments and locations of variables can be printed together.
11# RUN: llvm-objdump --no-print-imm-hex -d --mattr=+sve --debug-vars --no-show-raw-insn %t | \
12# RUN:   FileCheck %s --check-prefix=DBGVARS
13
14# DBGVARS:      0000000000000000 <foo>:
15# DBGVARS-NEXT:                                                     ┠─ bar = W1
16# DBGVARS-NEXT:        0:   add x0, x2, #2, lsl #12    // =8192     ┃
17# DBGVARS-NEXT:        4:   add z31.d, z31.d, #65280   // =0xff00   ┻
18
19    .text
20foo:
21    add x0, x2, 8192
22    add z31.d, z31.d, #65280
23.LFooEnd:
24
25    .section .debug_abbrev,"",@progbits
26    .uleb128 1                      // Abbreviation Code
27    .uleb128 0x11                   // DW_TAG_compile_unit
28    .byte 1                         // DW_CHILDREN_yes
29    .byte 0                         // EOM(1)
30    .byte 0                         // EOM(2)
31    .uleb128 2                      // Abbreviation Code
32    .uleb128 0x2e                   // DW_TAG_subprogram
33    .byte 1                         // DW_CHILDREN_yes
34    .uleb128 0x11                   // DW_AT_low_pc
35    .uleb128 0x01                   // DW_FORM_addr
36    .uleb128 0x12                   // DW_AT_high_pc
37    .uleb128 0x06                   // DW_FORM_data4
38    .byte 0                         // EOM(1)
39    .byte 0                         // EOM(2)
40    .uleb128 3                      // Abbreviation Code
41    .uleb128 0x34                   // DW_TAG_variable
42    .byte 0                         // DW_CHILDREN_no
43    .uleb128 0x02                   // DW_AT_location
44    .uleb128 0x18                   // DW_FORM_exprloc
45    .uleb128 0x03                   // DW_AT_name
46    .uleb128 0x08                   // DW_FORM_string
47    .byte 0                         // EOM(1)
48    .byte 0                         // EOM(2)
49    .byte 0                         // EOM(3)
50
51    .section .debug_info,"",@progbits
52    .long .LCuEnd-.LCuBegin         // Length of Unit
53.LCuBegin:
54    .short 4                        // DWARF version number
55    .long .debug_abbrev             // Offset Into Abbrev. Section
56    .byte 8                         // Address Size
57    .uleb128 1                      // Abbrev [1] DW_TAG_compile_unit
58    .uleb128 2                      // Abbrev [2] DW_TAG_subprogram
59    .quad foo                       // DW_AT_low_pc
60    .long .LFooEnd-foo              // DW_AT_high_pc
61    .uleb128 3                      // Abbrev [3] DW_TAG_variable
62    .byte .LLocEnd-.LLocBegin       // DW_AT_location
63.LLocBegin:
64    .byte 0x51                      // DW_OP_reg1
65.LLocEnd:
66    .asciz "bar"                    // DW_FORM_string
67    .byte 0                         // End Of Children Mark
68    .byte 0                         // End Of Children Mark
69.LCuEnd:
70