1 # RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
2 # RUN: llvm-dwarfdump -v %t.o 2>&1 | FileCheck %s
4 # Test object to verify that llvm-dwarfdump handles an invalid string offsets
7 # A rudimentary abbrev section.
8 .section .debug_abbrev,"",@progbits
9 .byte 0x01 # Abbrev code
10 .byte 0x11 # DW_TAG_compile_unit
11 .byte 0x00 # DW_CHILDREN_no
12 .byte 0x72 # DW_AT_str_offsets_base
13 .byte 0x17 # DW_FORM_sec_offset
18 # A rudimentary compile unit to convince dwarfdump that we are dealing with a
19 # DWARF v5 string offsets table.
20 .section .debug_info,"",@progbits
22 # DWARF v5 32 bit CU header.
23 .long CU1_end-CU1_begin # Length of Unit
25 .short 5 # DWARF version number
26 .byte 1 # DWARF Unit Type
27 .byte 8 # Address Size (in bytes)
28 .long .debug_abbrev # Offset Into Abbrev. Section
29 .byte 1 # Abbreviation code: DW_TAG_compile_unit
30 .long 0 # DW_AT_str_offsets_base
33 # DWARF v5 64 bit CU header.
35 .quad CU2_end-CU2_begin # Length of Unit
37 .short 5 # DWARF version number
38 .byte 1 # DWARF Unit Type
39 .byte 8 # Address Size (in bytes)
40 .quad .debug_abbrev # Offset Into Abbrev. Section
41 .byte 1 # Abbreviation code: DW_TAG_compile_unit
42 .quad 0 # DW_AT_str_offsets_base
44 .long CU3_end-CU3_begin # Length of Unit
46 .short 5 # DWARF version number
47 .byte 1 # DWARF Unit Type
48 .byte 8 # Address Size (in bytes)
49 .long .debug_abbrev # Offset Into Abbrev. Section
50 .byte 1 # Abbreviation code: DW_TAG_compile_unit
51 .quad .str_off0 # DW_AT_str_offsets_base
53 .long CU4_end-CU4_begin # Length of Unit
55 .short 5 # DWARF version number
56 .byte 1 # DWARF Unit Type
57 .byte 8 # Address Size (in bytes)
58 .long .debug_abbrev # Offset Into Abbrev. Section
59 .byte 1 # Abbreviation code: DW_TAG_compile_unit
60 .quad .str_off1 # DW_AT_str_offsets_base
62 .long CU5_end-CU5_begin # Length of Unit
64 .short 5 # DWARF version number
65 .byte 1 # DWARF Unit Type
66 .byte 8 # Address Size (in bytes)
67 .long .debug_abbrev # Offset Into Abbrev. Section
68 .byte 1 # Abbreviation code: DW_TAG_compile_unit
69 .long .str_off2_begin # DW_AT_str_offsets_base
71 .long CU6_end-CU6_begin # Length of Unit
73 .short 5 # DWARF version number
74 .byte 1 # DWARF Unit Type
75 .byte 8 # Address Size (in bytes)
76 .long .debug_abbrev # Offset Into Abbrev. Section
77 .byte 1 # Abbreviation code: DW_TAG_compile_unit
78 .long .str_off3_begin # DW_AT_str_offsets_base
81 .quad CU7_end-CU7_begin # Length of Unit
83 .short 5 # DWARF version number
84 .byte 1 # DWARF Unit Type
85 .byte 8 # Address Size (in bytes)
86 .quad .debug_abbrev # Offset Into Abbrev. Section
87 .byte 1 # Abbreviation code: DW_TAG_compile_unit
88 .quad .str_off4_begin # DW_AT_str_offsets_base
90 .long CU8_end-CU8_begin # Length of Unit
92 .short 5 # DWARF version number
93 .byte 1 # DWARF Unit Type
94 .byte 8 # Address Size (in bytes)
95 .long .debug_abbrev # Offset Into Abbrev. Section
96 .byte 1 # Abbreviation code: DW_TAG_compile_unit
97 .long .str_off_end+16 # DW_AT_str_offsets_base
100 .quad CU9_end-CU9_begin # Length of Unit
102 .short 5 # DWARF version number
103 .byte 1 # DWARF Unit Type
104 .byte 8 # Address Size (in bytes)
105 .quad .debug_abbrev # Offset Into Abbrev. Section
106 .byte 1 # Abbreviation code: DW_TAG_compile_unit
107 .quad .str_off_end+8 # DW_AT_str_offsets_base
110 .section .debug_str_offsets,"",@progbits
113 .short 5 # DWARF version
117 # Length beyond section bounds
118 .long .str_off_end-.str_off1+8
119 .short 5 # DWARF version
123 # Length intrudes on following unit
124 .long .str_off2_end-.str_off2_begin+8
125 .short 5 # DWARF version
130 # Plain contribution, no errors here
131 .long .str_off3_end-.str_off3_begin
132 .short 5 # DWARF version
137 # 32 bit contribution referenced from a 64 bit unit
138 .long .str_off4_end-.str_off4_begin
139 .short 5 # DWARF version
147 # CHECK: error: invalid reference to or invalid content in .debug_str_offsets[.dwo]: insufficient space for 32 bit header prefix
148 # CHECK: error: invalid reference to or invalid content in .debug_str_offsets[.dwo]: insufficient space for 64 bit header prefix
149 # CHECK: error: invalid reference to or invalid content in .debug_str_offsets[.dwo]: invalid length
150 # CHECK: error: invalid reference to or invalid content in .debug_str_offsets[.dwo]: length exceeds section size
151 # CHECK: error: invalid reference to or invalid content in .debug_str_offsets[.dwo]: 32 bit contribution referenced from a 64 bit unit
152 # CHECK: error: invalid reference to or invalid content in .debug_str_offsets[.dwo]: section offset exceeds section size
153 # CHECK: error: invalid reference to or invalid content in .debug_str_offsets[.dwo]: section offset exceeds section size
154 # CHECK: error: overlapping contributions to string offsets table in section .debug_str_offsets.