1 ## The test checks that llvm-dwp avoids an out of bound access when there is
2 ## an unknown section identifier in an index section. Without the fix, the test
3 ## failed when LLVM is built with UBSan.
4 ## Note that additional sections (.debug_abbrev.dwo, .debug_info.dwo, and
5 ## .debug_types.dwo) are required to reach the test points in the code.
7 # RUN: llvm-mc -triple x86_64-unknown-linux-gnu %s -filetype=obj -o %t.dwp
8 # RUN: llvm-dwp %t.dwp -o - | \
9 # RUN: llvm-dwarfdump -debug-cu-index -debug-tu-index - | \
12 ## Check that all known sections are preserved and no data for unknown section
13 ## identifiers is copied.
15 # CHECK: .debug_cu_index contents:
16 # CHECK-NEXT: version = 2, units = 1, slots = 2
17 # CHECK: Index Signature INFO ABBREV
20 # CHECK-NEXT: 1 0x1100002222222222 [0x0000000000000000, 0x0000000000000014) [0x00000000, 0x00000009)
23 # CHECK: .debug_tu_index contents:
24 # CHECK-NEXT: version = 2, units = 1, slots = 2
25 # CHECK: Index Signature TYPES ABBREV
28 # CHECK-NEXT: 2 0x1100003333333333 [0x0000000000000000, 0x0000000000000019) [0x00000009, 0x00000014)
31 .section .debug_abbrev.dwo, "e", @progbits
33 .uleb128 1 # Abbreviation Code
34 .uleb128 0x11 # DW_TAG_compile_unit
35 .byte 0 # DW_CHILDREN_no
36 .uleb128 0x2131 # DW_AT_GNU_dwo_id
37 .uleb128 7 # DW_FORM_data8
44 .uleb128 1 # Abbreviation Code
45 .uleb128 0x41 # DW_TAG_type_unit
46 .byte 1 # DW_CHILDREN_yes
49 .uleb128 2 # Abbreviation Code
50 .uleb128 0x13 # DW_TAG_structure_type
51 .byte 0 # DW_CHILDREN_no
57 .section .debug_info.dwo, "e", @progbits
59 .long .LCUEnd-.LCUVersion # Length of Unit
62 .long 0 # Abbrev offset
63 .byte 8 # Address size
64 .uleb128 1 # Abbrev [1] DW_TAG_compile_unit
65 .quad 0x1100002222222222 # DW_AT_GNU_dwo_id
68 .section .debug_types.dwo, "e", @progbits
70 .long .LTUEnd-.LTUVersion # Length of Unit
73 .long 0 # Abbrev offset
74 .byte 8 # Address size
75 .quad 0x1100003333333333 # Type signature
76 .long .LTUType-.LTUBegin # Type offset
77 .uleb128 1 # Abbrev [1] DW_TAG_type_unit
79 .uleb128 2 # Abbrev [2] DW_TAG_structure_type
82 .section .debug_cu_index, "", @progbits
85 .long 4 # Section count
88 ## Hash Table of Signatures:
89 .quad 0x1100002222222222
91 ## Parallel Table of Indexes:
94 ## Table of Section Offsets:
96 .long 1 # DW_SECT_INFO
97 .long 3 # DW_SECT_ABBREV
98 .long 0 # Invalid ID, less than DW_SECT_INFO
99 .long 9 # Invalid ID, greater than DW_SECT_MACRO
101 .long 0 # Offset in .debug_info.dwo
102 .long 0 # Offset in .debug_abbrev.dwo
105 ## Table of Section Sizes:
106 .long .LCUEnd-.LCUBegin # Size in .debug_info.dwo
107 .long .LCUAbbrevEnd-.LCUAbbrevBegin # Size in .debug_abbrev.dwo
111 .section .debug_tu_index, "", @progbits
114 .long 4 # Section count
117 ## Hash Table of Signatures:
119 .quad 0x1100003333333333
120 ## Parallel Table of Indexes:
123 ## Table of Section Offsets:
125 .long 2 # DW_SECT_TYPES
126 .long 3 # DW_SECT_ABBREV
127 .long 0 # Invalid ID, less than DW_SECT_INFO
128 .long 9 # Invalid ID, greater than DW_SECT_MACRO
130 .long 0 # Offset in .debug_types.dwo
131 .long .LTUAbbrevBegin-.debug_abbrev.dwo # Offset in .debug_abbrev.dwo
134 ## Table of Section Sizes:
135 .long .LTUEnd-.LTUBegin # Size in .debug_types.dwo
136 .long .LTUAbbrevEnd-.LTUAbbrevBegin # Size in .debug_abbrev.dwo