xref: /llvm-project/llvm/test/DebugInfo/X86/debug-macro-multi-cu-strx.s (revision ccbd7e8d463a1d40852c6acbbecd3ae1e2c38f4c)
193aee9caSSourabh Singh Tomar## This test checks that llvm-dwarfdump can dump debug_macro
293aee9caSSourabh Singh Tomar## section containing contributions from multiple CU's represented
393aee9caSSourabh Singh Tomar## using DW_MACRO_define_strx form.
493aee9caSSourabh Singh Tomar
593aee9caSSourabh Singh Tomar# RUN: llvm-mc -triple x86_64-unknown-linux -filetype=obj %s -o -| \
693aee9caSSourabh Singh Tomar# RUN:   llvm-dwarfdump -debug-macro - | FileCheck -strict-whitespace -match-full-lines %s
793aee9caSSourabh Singh Tomar
893aee9caSSourabh Singh Tomar#      CHECK:.debug_macro contents:
993aee9caSSourabh Singh Tomar# CHECK-NEXT:0x00000000:
10*ccbd7e8dSIgor Kudrin# CHECK-NEXT:macro header: version = 0x0005, flags = 0x02, format = DWARF32, debug_line_offset = 0x00000000
1193aee9caSSourabh Singh Tomar# CHECK-NEXT:DW_MACRO_start_file - lineno: 0 filenum: 0
1293aee9caSSourabh Singh Tomar# CHECK-NEXT:  DW_MACRO_define_strx - lineno: 1 macro: DWARF_VERSION 5
1393aee9caSSourabh Singh Tomar# CHECK-NEXT:  DW_MACRO_define_strx - lineno: 2 macro: COMPILE_UNIT 1
1493aee9caSSourabh Singh Tomar# CHECK-NEXT:  DW_MACRO_undef_strx - lineno: 3 macro: COMPILE_UNIT
1593aee9caSSourabh Singh Tomar# CHECK-NEXT:DW_MACRO_end_file
1693aee9caSSourabh Singh Tomar
1793aee9caSSourabh Singh Tomar#      CHECK:0x00000015:
18*ccbd7e8dSIgor Kudrin# CHECK-NEXT:macro header: version = 0x0005, flags = 0x02, format = DWARF32, debug_line_offset = 0x00000000
1993aee9caSSourabh Singh Tomar# CHECK-NEXT:DW_MACRO_start_file - lineno: 1 filenum: 3
2093aee9caSSourabh Singh Tomar# CHECK-NEXT:  DW_MACRO_define_strx - lineno: 2 macro: COMPILE_UNIT 2
2193aee9caSSourabh Singh Tomar# CHECK-NEXT:  DW_MACRO_undef_strx - lineno: 3 macro: COMPILE_UNIT
2293aee9caSSourabh Singh Tomar# CHECK-NEXT:DW_MACRO_end_file
2393aee9caSSourabh Singh Tomar
2493aee9caSSourabh Singh Tomar       .section        .debug_abbrev,"",@progbits
2593aee9caSSourabh Singh Tomar       .byte   1                       # Abbreviation Code
2693aee9caSSourabh Singh Tomar       .byte   17                      # DW_TAG_compile_unit
2793aee9caSSourabh Singh Tomar       .byte   0                       # DW_CHILDREN_no
2893aee9caSSourabh Singh Tomar       .byte   114                     # DW_AT_str_offsets_base
2993aee9caSSourabh Singh Tomar       .byte   23                      # DW_FORM_sec_offset
3093aee9caSSourabh Singh Tomar       .byte   121                     # DW_AT_macros
3193aee9caSSourabh Singh Tomar       .byte   23                      # DW_FORM_sec_offset
3293aee9caSSourabh Singh Tomar       .byte   0                       # EOM(1)
3393aee9caSSourabh Singh Tomar       .byte   0                       # EOM(2)
3493aee9caSSourabh Singh Tomar       .byte   0                       # EOM(3)
3593aee9caSSourabh Singh Tomar
3693aee9caSSourabh Singh Tomar       .section        .debug_info,"",@progbits
3793aee9caSSourabh Singh Tomar.Lcu_begin0:
3893aee9caSSourabh Singh Tomar       .long   .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
3993aee9caSSourabh Singh Tomar.Ldebug_info_start0:
4093aee9caSSourabh Singh Tomar       .short  5                      # DWARF version number
4193aee9caSSourabh Singh Tomar       .byte   1                       # DWARF Unit Type
4293aee9caSSourabh Singh Tomar       .byte   8                       # Address Size (in bytes)
4393aee9caSSourabh Singh Tomar       .long   .debug_abbrev           # Offset Into Abbrev. Section
4493aee9caSSourabh Singh Tomar       .byte   1                       # Abbrev [1] 0xc:0x12 DW_TAG_compile_unit
4593aee9caSSourabh Singh Tomar       .long   .Lstr_offsets_base0     # DW_AT_str_offsets_base
4693aee9caSSourabh Singh Tomar       .long   .Lcu_macro_begin0       # DW_AT_macros
4793aee9caSSourabh Singh Tomar.Ldebug_info_end0:
4893aee9caSSourabh Singh Tomar.Lcu_begin1:
4993aee9caSSourabh Singh Tomar       .long   .Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit
5093aee9caSSourabh Singh Tomar.Ldebug_info_start1:
5193aee9caSSourabh Singh Tomar       .short  5                      # DWARF version number
5293aee9caSSourabh Singh Tomar       .byte   1                       # DWARF Unit Type
5393aee9caSSourabh Singh Tomar       .byte   8                       # Address Size (in bytes)
5493aee9caSSourabh Singh Tomar       .long   .debug_abbrev           # Offset Into Abbrev. Section
5593aee9caSSourabh Singh Tomar       .byte   1                       # Abbrev [1] 0xc:0x12 DW_TAG_compile_unit
5693aee9caSSourabh Singh Tomar       .long   .Lstr_offsets_base1     # DW_AT_str_offsets_base
5793aee9caSSourabh Singh Tomar       .long   .Lcu_macro_begin1       # DW_AT_macros
5893aee9caSSourabh Singh Tomar.Ldebug_info_end1:
5993aee9caSSourabh Singh Tomar
6093aee9caSSourabh Singh Tomar       .section        .debug_macro,"",@progbits
6193aee9caSSourabh Singh Tomar.Lcu_macro_begin0:
6293aee9caSSourabh Singh Tomar       .short  5                      # Macro information version
6393aee9caSSourabh Singh Tomar       .byte   2                       # Flags: 32 bit, debug_line_offset present
6493aee9caSSourabh Singh Tomar       .long   0                       # debug_line_offset
6593aee9caSSourabh Singh Tomar       .byte   3                       # DW_MACRO_start_file
6693aee9caSSourabh Singh Tomar       .byte   0                       # Line Number
6793aee9caSSourabh Singh Tomar       .byte   0                       # File Number
6893aee9caSSourabh Singh Tomar       .byte   11                      # DW_MACRO_define_strx
6993aee9caSSourabh Singh Tomar       .byte   1                       # Line Number
7093aee9caSSourabh Singh Tomar       .byte   0                       # Macro String
7193aee9caSSourabh Singh Tomar       .byte   11                      # DW_MACRO_define_strx
7293aee9caSSourabh Singh Tomar       .byte   2                       # Line Number
7393aee9caSSourabh Singh Tomar       .byte   1                       # Macro String
7493aee9caSSourabh Singh Tomar       .byte   12                      # DW_MACRO_undef_strx
7593aee9caSSourabh Singh Tomar       .byte   3                       # Line Number
7693aee9caSSourabh Singh Tomar       .byte   2                       # Macro String
7793aee9caSSourabh Singh Tomar       .byte   4                       # DW_MACRO_end_file
7893aee9caSSourabh Singh Tomar       .byte   0                       # End Of Macro List Mark
7993aee9caSSourabh Singh Tomar.Lcu_macro_begin1:
8093aee9caSSourabh Singh Tomar       .short  5                      # Macro information version
8193aee9caSSourabh Singh Tomar       .byte   2                       # Flags: 32 bit, debug_line_offset present
8293aee9caSSourabh Singh Tomar       .long   0                       # debug_line_offset
8393aee9caSSourabh Singh Tomar       .byte   3                       # DW_MACRO_start_file
8493aee9caSSourabh Singh Tomar       .byte   1                       # Line Number
8593aee9caSSourabh Singh Tomar       .byte   3                       # File Number
8693aee9caSSourabh Singh Tomar       .byte   11                      # DW_MACRO_define_strx
8793aee9caSSourabh Singh Tomar       .byte   2                       # Line Number
8893aee9caSSourabh Singh Tomar       .byte   0                       # Macro String
8993aee9caSSourabh Singh Tomar       .byte   12                      # DW_MACRO_undef_strx
9093aee9caSSourabh Singh Tomar       .byte   3                       # Line Number
9193aee9caSSourabh Singh Tomar       .byte   1                       # Macro String
9293aee9caSSourabh Singh Tomar       .byte   4                       # DW_MACRO_end_file
9393aee9caSSourabh Singh Tomar
9493aee9caSSourabh Singh Tomar       .section        .debug_str_offsets,"",@progbits
9593aee9caSSourabh Singh Tomar       .long   16                      # Unit length
9693aee9caSSourabh Singh Tomar       .short  5                       # Version
9793aee9caSSourabh Singh Tomar       .short  0                       # Padding
9893aee9caSSourabh Singh Tomar.Lstr_offsets_base0:
9993aee9caSSourabh Singh Tomar       .long   .Linfo_string0
10093aee9caSSourabh Singh Tomar       .long   .Linfo_string1
10193aee9caSSourabh Singh Tomar       .long   .Linfo_string2
10293aee9caSSourabh Singh Tomar       .long   12                      # Unit length
10393aee9caSSourabh Singh Tomar       .short  5                       # Version
10493aee9caSSourabh Singh Tomar       .short  0                       # Padding
10593aee9caSSourabh Singh Tomar.Lstr_offsets_base1:
10693aee9caSSourabh Singh Tomar       .long   .Linfo_string3
10793aee9caSSourabh Singh Tomar       .long   .Linfo_string4
10893aee9caSSourabh Singh Tomar
10993aee9caSSourabh Singh Tomar       .section        .debug_str,"MS",@progbits,1
11093aee9caSSourabh Singh Tomar.Linfo_string0:
11193aee9caSSourabh Singh Tomar       .asciz  "DWARF_VERSION 5"
11293aee9caSSourabh Singh Tomar.Linfo_string1:
11393aee9caSSourabh Singh Tomar       .asciz  "COMPILE_UNIT 1"
11493aee9caSSourabh Singh Tomar.Linfo_string2:
11593aee9caSSourabh Singh Tomar       .asciz  "COMPILE_UNIT"
11693aee9caSSourabh Singh Tomar.Linfo_string3:
11793aee9caSSourabh Singh Tomar       .asciz  "COMPILE_UNIT 2"
11893aee9caSSourabh Singh Tomar.Linfo_string4:
11993aee9caSSourabh Singh Tomar       .asciz  "COMPILE_UNIT"
120