xref: /llvm-project/llvm/test/DebugInfo/X86/debug-macro-multi-cu-strx.s (revision ccbd7e8d463a1d40852c6acbbecd3ae1e2c38f4c)
1## This test checks that llvm-dwarfdump can dump debug_macro
2## section containing contributions from multiple CU's represented
3## using DW_MACRO_define_strx form.
4
5# RUN: llvm-mc -triple x86_64-unknown-linux -filetype=obj %s -o -| \
6# RUN:   llvm-dwarfdump -debug-macro - | FileCheck -strict-whitespace -match-full-lines %s
7
8#      CHECK:.debug_macro contents:
9# CHECK-NEXT:0x00000000:
10# CHECK-NEXT:macro header: version = 0x0005, flags = 0x02, format = DWARF32, debug_line_offset = 0x00000000
11# CHECK-NEXT:DW_MACRO_start_file - lineno: 0 filenum: 0
12# CHECK-NEXT:  DW_MACRO_define_strx - lineno: 1 macro: DWARF_VERSION 5
13# CHECK-NEXT:  DW_MACRO_define_strx - lineno: 2 macro: COMPILE_UNIT 1
14# CHECK-NEXT:  DW_MACRO_undef_strx - lineno: 3 macro: COMPILE_UNIT
15# CHECK-NEXT:DW_MACRO_end_file
16
17#      CHECK:0x00000015:
18# CHECK-NEXT:macro header: version = 0x0005, flags = 0x02, format = DWARF32, debug_line_offset = 0x00000000
19# CHECK-NEXT:DW_MACRO_start_file - lineno: 1 filenum: 3
20# CHECK-NEXT:  DW_MACRO_define_strx - lineno: 2 macro: COMPILE_UNIT 2
21# CHECK-NEXT:  DW_MACRO_undef_strx - lineno: 3 macro: COMPILE_UNIT
22# CHECK-NEXT:DW_MACRO_end_file
23
24       .section        .debug_abbrev,"",@progbits
25       .byte   1                       # Abbreviation Code
26       .byte   17                      # DW_TAG_compile_unit
27       .byte   0                       # DW_CHILDREN_no
28       .byte   114                     # DW_AT_str_offsets_base
29       .byte   23                      # DW_FORM_sec_offset
30       .byte   121                     # DW_AT_macros
31       .byte   23                      # DW_FORM_sec_offset
32       .byte   0                       # EOM(1)
33       .byte   0                       # EOM(2)
34       .byte   0                       # EOM(3)
35
36       .section        .debug_info,"",@progbits
37.Lcu_begin0:
38       .long   .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
39.Ldebug_info_start0:
40       .short  5                      # DWARF version number
41       .byte   1                       # DWARF Unit Type
42       .byte   8                       # Address Size (in bytes)
43       .long   .debug_abbrev           # Offset Into Abbrev. Section
44       .byte   1                       # Abbrev [1] 0xc:0x12 DW_TAG_compile_unit
45       .long   .Lstr_offsets_base0     # DW_AT_str_offsets_base
46       .long   .Lcu_macro_begin0       # DW_AT_macros
47.Ldebug_info_end0:
48.Lcu_begin1:
49       .long   .Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit
50.Ldebug_info_start1:
51       .short  5                      # DWARF version number
52       .byte   1                       # DWARF Unit Type
53       .byte   8                       # Address Size (in bytes)
54       .long   .debug_abbrev           # Offset Into Abbrev. Section
55       .byte   1                       # Abbrev [1] 0xc:0x12 DW_TAG_compile_unit
56       .long   .Lstr_offsets_base1     # DW_AT_str_offsets_base
57       .long   .Lcu_macro_begin1       # DW_AT_macros
58.Ldebug_info_end1:
59
60       .section        .debug_macro,"",@progbits
61.Lcu_macro_begin0:
62       .short  5                      # Macro information version
63       .byte   2                       # Flags: 32 bit, debug_line_offset present
64       .long   0                       # debug_line_offset
65       .byte   3                       # DW_MACRO_start_file
66       .byte   0                       # Line Number
67       .byte   0                       # File Number
68       .byte   11                      # DW_MACRO_define_strx
69       .byte   1                       # Line Number
70       .byte   0                       # Macro String
71       .byte   11                      # DW_MACRO_define_strx
72       .byte   2                       # Line Number
73       .byte   1                       # Macro String
74       .byte   12                      # DW_MACRO_undef_strx
75       .byte   3                       # Line Number
76       .byte   2                       # Macro String
77       .byte   4                       # DW_MACRO_end_file
78       .byte   0                       # End Of Macro List Mark
79.Lcu_macro_begin1:
80       .short  5                      # Macro information version
81       .byte   2                       # Flags: 32 bit, debug_line_offset present
82       .long   0                       # debug_line_offset
83       .byte   3                       # DW_MACRO_start_file
84       .byte   1                       # Line Number
85       .byte   3                       # File Number
86       .byte   11                      # DW_MACRO_define_strx
87       .byte   2                       # Line Number
88       .byte   0                       # Macro String
89       .byte   12                      # DW_MACRO_undef_strx
90       .byte   3                       # Line Number
91       .byte   1                       # Macro String
92       .byte   4                       # DW_MACRO_end_file
93
94       .section        .debug_str_offsets,"",@progbits
95       .long   16                      # Unit length
96       .short  5                       # Version
97       .short  0                       # Padding
98.Lstr_offsets_base0:
99       .long   .Linfo_string0
100       .long   .Linfo_string1
101       .long   .Linfo_string2
102       .long   12                      # Unit length
103       .short  5                       # Version
104       .short  0                       # Padding
105.Lstr_offsets_base1:
106       .long   .Linfo_string3
107       .long   .Linfo_string4
108
109       .section        .debug_str,"MS",@progbits,1
110.Linfo_string0:
111       .asciz  "DWARF_VERSION 5"
112.Linfo_string1:
113       .asciz  "COMPILE_UNIT 1"
114.Linfo_string2:
115       .asciz  "COMPILE_UNIT"
116.Linfo_string3:
117       .asciz  "COMPILE_UNIT 2"
118.Linfo_string4:
119       .asciz  "COMPILE_UNIT"
120