xref: /llvm-project/llvm/test/tools/llvm-dwarfdump/X86/typeunit-name.s (revision d840e5452315e69d44cfe44b766e633964681b6a)
1# Demonstrate that -name works with type units.
2# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
3# RUN: llvm-dwarfdump -name=V4_type_unit -name=V5_split_type_unit %t.o | FileCheck %s
4#
5# The names should appear twice, once for the unit and once for the type DIE,
6# because we give them the same name.
7# CHECK: V4_type_unit
8# CHECK: V4_type_unit
9# CHECK: V5_split_type_unit
10# CHECK: V5_split_type_unit
11
12        .section .debug_str,"MS",@progbits,1
13str_TU_4:
14        .asciz "V4_type_unit"
15
16        .section .debug_str.dwo,"MSe",@progbits,1
17dwo_TU_5:
18        .asciz "V5_split_type_unit"
19
20# Abbrev section for the normal type unit.
21        .section .debug_abbrev,"",@progbits
22        .byte 0x01  # Abbrev code
23        .byte 0x41  # DW_TAG_type_unit
24        .byte 0x01  # DW_CHILDREN_yes
25        .byte 0x03  # DW_AT_name
26        .byte 0x0e  # DW_FORM_strp
27        .byte 0x00  # EOM(1)
28        .byte 0x00  # EOM(2)
29        .byte 0x02  # Abbrev code
30        .byte 0x13  # DW_TAG_structure_type
31        .byte 0x00  # DW_CHILDREN_no (no members)
32        .byte 0x03  # DW_AT_name
33        .byte 0x0e  # DW_FORM_strp
34        .byte 0x00  # EOM(1)
35        .byte 0x00  # EOM(2)
36        .byte 0x00  # EOM(3)
37
38# And a .dwo copy for the .dwo section.
39        .section .debug_abbrev.dwo,"e",@progbits
40        .byte 0x01  # Abbrev code
41        .byte 0x41  # DW_TAG_type_unit
42        .byte 0x01  # DW_CHILDREN_yes
43        .byte 0x03  # DW_AT_name
44        .byte 0x0e  # DW_FORM_strp
45        .byte 0x00  # EOM(1)
46        .byte 0x00  # EOM(2)
47        .byte 0x02  # Abbrev code
48        .byte 0x13  # DW_TAG_structure_type
49        .byte 0x00  # DW_CHILDREN_no (no members)
50        .byte 0x03  # DW_AT_name
51        .byte 0x0e  # DW_FORM_strp
52        .byte 0x00  # EOM(1)
53        .byte 0x00  # EOM(2)
54        .byte 0x00  # EOM(3)
55
56        .section .debug_types,"",@progbits
57
58# DWARF v4 Type unit header. Normal/split are identical so we do only one.
59TU_4_start:
60        .long  TU_4_end-TU_4_version  # Length of Unit
61TU_4_version:
62        .short 4               # DWARF version number
63        .long .debug_abbrev    # Offset Into Abbrev. Section
64        .byte 8                # Address Size (in bytes)
65        .quad 0x0011223344556677 # Type Signature
66        .long TU_4_type-TU_4_start # Type offset
67# The type-unit DIE, which has a name.
68        .byte 1
69        .long str_TU_4
70# The type DIE, which has the same name.
71TU_4_type:
72        .byte 2
73        .long str_TU_4
74        .byte 0 # NULL
75        .byte 0 # NULL
76TU_4_end:
77
78        .section .debug_types.dwo,"e",@progbits
79# FIXME: DWARF v5 wants type units in .debug_info[.dwo] not .debug_types[.dwo].
80
81# DWARF v5 split type unit header.
82TU_split_5_start:
83        .long  TU_split_5_end-TU_split_5_version  # Length of Unit
84TU_split_5_version:
85        .short 5               # DWARF version number
86        .byte 6                # DWARF Unit Type
87        .byte 8                # Address Size (in bytes)
88        .long .debug_abbrev.dwo    # Offset Into Abbrev. Section
89        .quad 0x8899aabbccddeeff # Type Signature
90        .long TU_split_5_type-TU_split_5_start  # Type offset
91# The type-unit DIE, which has a name.
92        .byte 1
93        .long dwo_TU_5
94# The type DIE, which has the same name.
95TU_split_5_type:
96        .byte 2
97        .long dwo_TU_5
98        .byte 0 # NULL
99        .byte 0 # NULL
100TU_split_5_end:
101