1# This test checks the support for writing macro sections and their index (v5).
2
3# RUN: llvm-mc -triple x86_64-unknown-linux --filetype=obj --split-dwarf-file=%t.dwo -dwarf-version=5 %s -o %t.o
4# RUN: llvm-dwp %t.dwo -o %t.dwp 2>&1
5# RUN: llvm-dwarfdump -debug-macro -debug-cu-index %t.dwp | FileCheck %s
6
7# CHECK-DAG: .debug_macro.dwo contents:
8# CHECK: macro header: version = 0x0005, flags = 0x00, format = DWARF32
9# CHECK-NEXT: DW_MACRO_start_file - lineno: 0 filenum: 0
10# CHECK-NEXT: DW_MACRO_define_strx - lineno: 1 macro: x 5
11# CHECK-NEXT: DW_MACRO_end_file
12
13# CHECK-DAG: .debug_cu_index contents:
14# CHECK-NEXT: version = 5, units = 1, slots = 2
15# CHECK: Index Signature          INFO                     ABBREV                   STR_OFFSETS              MACRO
16# CHECK:     1 0x0000000000000000 [0x00000000, 0x00000019) [0x00000000, 0x00000008) [0x00000000, 0x0000000c) [0x00000000, 0x0000000b)
17
18    .section	.debug_info.dwo,"e",@progbits
19    .long	.Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit
20.Ldebug_info_dwo_start0:
21    .short	5                               # DWARF version number
22    .byte	5                               # DWARF Unit Type (DW_UT_split_compile)
23    .byte	8                               # Address Size (in bytes)
24    .long	0                               # Offset Into Abbrev. Section
25    .quad	0
26    .byte	1                               # Abbrev [1] 0x14:0x5 DW_TAG_compile_unit
27    .long	0                               # DW_AT_macros
28.Ldebug_info_dwo_end0:
29    .section	.debug_macro.dwo,"e",@progbits
30    .short	5                               # Macro information version
31    .byte	0                               # Flags: 32 bit
32    .byte	3                               # DW_MACRO_start_file
33    .byte	0                               # Line Number
34    .byte	0                               # File Number
35    .byte	11                              # DW_MACRO_define_strx
36    .byte	1                               # Line Number
37    .byte	0                               # Macro String
38    .byte	4                               # DW_MACRO_end_file
39    .byte	0                               # End Of Macro List Mark
40    .section	.debug_abbrev.dwo,"e",@progbits
41    .byte	1                               # Abbreviation Code
42    .byte	17                              # DW_TAG_compile_unit
43    .byte	0                               # DW_CHILDREN_no
44    .byte	121                             # DW_AT_macros
45    .byte	23                              # DW_FORM_sec_offset
46    .byte	0                               # EOM(1)
47    .byte	0                               # EOM(2)
48    .byte	0                               # EOM(3)
49    .section	.debug_str.dwo,"eMS",@progbits,1
50    .asciz	"x 5"                           # string offset=0
51    .section	.debug_str_offsets.dwo,"e",@progbits
52    .long	8                            # Length of String Offsets Set
53    .short	5
54    .short	0
55  .long	0
56