1## This checks that llvm-dwarfdump can parse and dump DWARF64 macro units.
2
3# RUN: llvm-mc -triple x86_64 -filetype=obj %s -o - \
4# RUN:   | llvm-dwarfdump -debug-macro - \
5# RUN:   | FileCheck %s
6
7# CHECK:      .debug_macro contents:
8
9# CHECK:      0x00000000:
10# CHECK-NEXT: macro header: version = 0x0005, flags = 0x03, format = DWARF64, debug_line_offset = 0x0000000000000000
11# CHECK-NEXT: DW_MACRO_start_file - lineno: 0 filenum: 0
12# CHECK-NEXT:   DW_MACRO_import - import offset: 0x00000000[[MACRO1OFF:[[:xdigit:]]{8}]]
13# CHECK-NEXT: DW_MACRO_end_file
14
15# CHECK:      0x[[MACRO1OFF]]:
16# CHECK-NEXT: macro header: version = 0x0005, flags = 0x01, format = DWARF64
17# CHECK-NEXT: DW_MACRO_define_strp - lineno: 1 macro: FOO 1
18# CHECK-NEXT: DW_MACRO_undef_strp - lineno: 9 macro: BAR
19# CHECK-NEXT: DW_MACRO_undef_strp - lineno: 15 macro: BAZ
20
21    .section .debug_macro, "", @progbits
22.LMacro0:
23    .short 5            # Version
24    .byte 3             # Flags: offset_size_flag | debug_line_offset_flag
25    .quad 0             # Debug Line Offset
26    .byte 3             # DW_MACRO_start_file
27    .uleb128 0          # Line
28    .uleb128 0          # File
29    .byte 7             # DW_MACRO_import
30    .quad .LMacro1
31    .byte 4             # DW_MACRO_end_file
32    .byte 0             # End macro unit
33.LMacro1:
34    .short 5            # Version
35    .byte 1             # Flags: offset_size_flag
36    .byte 5             # DW_MACRO_define_strp
37    .uleb128 1          # Line
38    .quad .LStr0        # "FOO 1"
39    .byte 6             # DW_MACRO_undef_strp
40    .uleb128 9          # Line
41    .quad .LStr1        # "BAR"
42    .byte 6             # DW_MACRO_undef_strp
43    .uleb128 15         # Line
44    .quad .LStr2        # "BAZ"
45    .byte 0             # End macro unit
46
47    .section .debug_str, "MS", @progbits, 1
48.LStr0:
49    .asciz "FOO 1"
50.LStr1:
51    .asciz "BAR"
52.LStr2:
53    .asciz "BAZ"
54