xref: /llvm-project/llvm/test/DebugInfo/X86/dwarfdump-str-offsets-v4-dwarf64-dwp.s (revision e94382ee37d9225d5e833ed35006c14deda2467b)
1## This tests dumping a .debug_str_offsets.dwo section in a DWP file when it is
2## referenced by units in different formats: one unit is DWARF32 and another
3## is DWARF64, thus the .debug_str_offsets.dwo section has contributions with
4## different sizes of offsets.
5## This also checks that attributes in the units which use the DW_FORM_strx form
6## are dumped correctly.
7
8# RUN: llvm-mc -triple x86_64 %s -filetype=obj -o - | \
9# RUN:   llvm-dwarfdump -v - | \
10# RUN:   FileCheck %s
11
12# CHECK:      .debug_info.dwo contents:
13# CHECK:      Compile Unit:
14# CHECK:      DW_TAG_compile_unit [1]
15# CHECK-NEXT:   DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "CU0 Producer")
16# CHECK-NEXT:   DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "CU0 Name")
17# CHECK:      Compile Unit:
18# CHECK:      DW_TAG_compile_unit [1]
19# CHECK-NEXT:   DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "CU1 Producer")
20# CHECK-NEXT:   DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "CU1 Name")
21
22# CHECK:      .debug_str.dwo contents:
23# CHECK-NEXT: 0x00000000: "CU0 Producer"
24# CHECK-NEXT: 0x0000000d: "CU0 Name"
25# CHECK-NEXT: 0x00000016: "CU1 Producer"
26# CHECK-NEXT: 0x00000023: "CU1 Name"
27
28# CHECK:      .debug_str_offsets.dwo contents:
29# CHECK-NEXT: 0x00000000: Contribution size = 8, Format = DWARF32, Version = 4
30# CHECK-NEXT: 0x00000000: 00000000 "CU0 Producer"
31# CHECK-NEXT: 0x00000004: 0000000d "CU0 Name"
32# CHECK-NEXT: 0x00000008: Contribution size = 16, Format = DWARF64, Version = 4
33# CHECK-NEXT: 0x00000008: 0000000000000016 "CU1 Producer"
34# CHECK-NEXT: 0x00000010: 0000000000000023 "CU1 Name"
35
36    .section .debug_str.dwo, "MSe", @progbits, 1
37.LStr0:
38    .asciz "CU0 Producer"
39.LStr1:
40    .asciz "CU0 Name"
41.LStr2:
42    .asciz "CU1 Producer"
43.LStr3:
44    .asciz "CU1 Name"
45
46    .section .debug_str_offsets.dwo, "e", @progbits
47## The contribution of CU0 (DWARF32)
48.LSO0:
49    .long .LStr0-.debug_str.dwo     # 0: "CU0 Producer"
50    .long .LStr1-.debug_str.dwo     # 1: "CU0 Name"
51.LSO0End:
52## The contribution of CU1 (DWARF64)
53.LSO1:
54    .quad .LStr2-.debug_str.dwo     # 0: "CU1 Producer"
55    .quad .LStr3-.debug_str.dwo     # 1: "CU1 Name"
56.LSO1End:
57
58    .section .debug_abbrev.dwo, "e", @progbits
59## For simplicity and to make the test shorter, both compilation units share
60## the same abbreviations table.
61.LAbbr:
62    .uleb128 0x01                   # Abbrev code
63    .uleb128 0x11                   # DW_TAG_compile_unit
64    .byte 0x00                      # DW_CHILDREN_no
65    .uleb128 0x25                   # DW_AT_producer
66    .uleb128 0x1a                   # DW_FORM_strx
67    .uleb128 0x03                   # DW_AT_name
68    .uleb128 0x1a                   # DW_FORM_strx
69    .uleb128 0x2131                 # DW_AT_GNU_dwo_id
70    .uleb128 0x07                   # DW_FORM_data8
71    .byte 0x00                      # EOM(1)
72    .byte 0x00                      # EOM(2)
73    .byte 0x00                      # EOM(3)
74.LAbbrEnd:
75
76    .section .debug_info.dwo, "e", @progbits
77## CU0 uses the 32-bit DWARF format.
78.LCU0:
79    .long .LCU0End-.LCU0Ver         # Length
80.LCU0Ver:
81    .short 4                        # Version
82    .long 0                         # Abbrev. offset
83    .byte 8                         # Address size
84    .uleb128 1                      # Abbrev [1] DW_TAG_compile_unit
85    .uleb128 0                      # DW_AT_producer ("CU0 Producer")
86    .uleb128 1                      # DW_AT_name ("CU0 Name")
87    .quad 0x1100001122222222        # DW_AT_GNU_dwo_id
88.LCU0End:
89## CU1 uses the 64-bit DWARF format.
90.LCU1:
91    .long 0xffffffff                # DWARF64 mark
92    .quad .LCU1End-.LCU1Ver           # Length
93.LCU1Ver:
94    .short 4                        # Version
95    .quad 0                         # Abbrev. offset
96    .byte 8                         # Address size
97    .uleb128 1                      # Abbrev [1] DW_TAG_compile_unit
98    .uleb128 0                      # DW_AT_producer ("CU1 Producer")
99    .uleb128 1                      # DW_AT_name ("CU1 Name")
100    .quad 0x1100001133333333        # DW_AT_GNU_dwo_id
101.LCU1End:
102
103    .section .debug_cu_index, "", @progbits
104## Header:
105    .long 2                         # Version
106    .long 3                         # Section count
107    .long 2                         # Unit count
108    .long 4                         # Slot count
109## Hash Table of Signatures:
110    .quad 0
111    .quad 0
112    .quad 0x1100001122222222        # DWO Id of CU0
113    .quad 0x1100001133333333        # DWO Id of CU1
114## Parallel Table of Indexes:
115    .long 0
116    .long 0
117    .long 1
118    .long 2
119## Table of Section Offsets:
120## Row 0:
121    .long 1                         # DW_SECT_INFO
122    .long 3                         # DW_SECT_ABBREV
123    .long 6                         # DW_SECT_STR_OFFSETS
124## Row 1, offsets of contributions of CU0:
125    .long .LCU0-.debug_info.dwo
126    .long .LAbbr-.debug_abbrev.dwo
127    .long .LSO0-.debug_str_offsets.dwo
128## Row 2, offsets of contributions of CU1:
129    .long .LCU1-.debug_info.dwo
130    .long .LAbbr-.debug_abbrev.dwo
131    .long .LSO1-.debug_str_offsets.dwo
132## Table of Section Sizes:
133## Row 1, sizes of contributions of CU0:
134    .long .LCU0End-.LCU0
135    .long .LAbbrEnd-.LAbbr
136    .long .LSO0End-.LSO0
137## Row 2, sizes of contributions of CU1:
138    .long .LCU1End-.LCU1
139    .long .LAbbrEnd-.LAbbr
140    .long .LSO1End-.LSO1
141