1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
| # Test object to verify dwarfdump handles a syntactically correct line-number
# program containing unrecognized extended opcodes.
# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o
# RUN: llvm-dwarfdump -v %t.o | FileCheck %s
# RUN: llvm-dwarfdump -v %t.o 2>&1 | FileCheck %s --check-prefix=ERR
.section .text
# Dummy function
foo: ret
# FIXME: When we can dump a line-table without a unit, we could remove
# the .debug_abbrev and .debug_info sections from this test.
.section .debug_abbrev,"",@progbits
.byte 0x01 # Abbrev code
.byte 0x11 # DW_TAG_compile_unit
.byte 0x00 # DW_CHILDREN_no
.byte 0x10 # DW_AT_stmt_list
.byte 0x17 # DW_FORM_sec_offset
.byte 0x00 # EOM(1)
.byte 0x00 # EOM(2)
.section .debug_info,"",@progbits
.long CU_end-CU_version # Length of Unit
CU_version:
.short 4 # DWARF version number
.long .debug_abbrev # Offset Into Abbrev. Section
.byte 8 # Address Size (in bytes)
# The compile-unit DIE, with DW_AT_stmt_list.
.byte 1
.long LT_start
.byte 0 # NULL
CU_end:
.long CU2_end-CU2_version # Length of Unit
CU2_version:
.short 4 # DWARF version number
.long .debug_abbrev # Offset Into Abbrev. Section
.byte 8 # Address Size (in bytes)
# The compile-unit DIE, with DW_AT_stmt_list.
.byte 1
.long LT2_start
.byte 0 # NULL
CU2_end:
.section .debug_line,"",@progbits
# CHECK-LABEL: .debug_line contents:
# DWARF v4 line-table header.
LT_start:
.long LT_end-LT_version # Length of Unit (DWARF-32 format)
LT_version:
.short 4 # DWARF version number
.long LT_header_end-LT_params # Length of Prologue
LT_params:
.byte 1 # Minimum Instruction Length
.byte 1 # Maximum Operations per Instruction
.byte 1 # Default is_stmt
.byte -5 # Line Base
.byte 14 # Line Range
.byte 13 # Opcode Base
.byte 0 # Standard Opcode Lengths
.byte 1
.byte 1
.byte 1
.byte 1
.byte 0
.byte 0
.byte 0
.byte 1
.byte 0
.byte 0
.byte 1
# No directories.
.byte 0
# No files.
.byte 0
LT_header_end:
# Bogus extended opcode with zero length.
.byte 0 # Extended opcode indicator.
.byte 0 # LEB length of extended opcode + operands.
# Real opcode and operand.
.byte 0
.byte 9
.byte 2 # DW_LNE_set_address
.quad .text
# Bogus extended opcode with multibyte LEB length.
.byte 0
.byte 0x82 # Length of 2 but with additional length byte.
.byte 0 # Additional length byte.
.byte 0x47 # Unrecognized opcode...
.byte 0 # with its 1-byte operand.
# Proper end-sequence opcode.
.byte 0
.byte 1
.byte 1 # DW_LNE_end_sequence
LT_end:
# CHECK: Line table prologue:
# CHECK: version: 4
# Exact prologue length isn't important but it tells us where to expect the
# line-number program to start, and we do want to verify those offsets.
# CHECK-NEXT: prologue_length: 0x00000014
# CHECK: 0x0000001e: 00 Badly formed extended line op
# CHECK-NEXT: 0x00000020: 00 DW_LNE_set_address
# CHECK-NEXT: 0x0000002b: 00 Unrecognized extended op 0x47 length 2
# CHECK-NEXT: 0x00000030: 00 DW_LNE_end_sequence
# CHECK-NEXT: 0x0000000000000000 {{.*}} is_stmt end_sequence
# DWARF v4 line-table header #2.
LT2_start:
.long LT2_end-LT2_version # Length of Unit (DWARF-32 format)
LT2_version:
.short 4 # DWARF version number
.long LT2_header_end-LT2_params # Length of Prologue
LT2_params:
.byte 1 # Minimum Instruction Length
.byte 1 # Maximum Operations per Instruction
.byte 1 # Default is_stmt
.byte -5 # Line Base
.byte 14 # Line Range
.byte 13 # Opcode Base
.byte 0 # Standard Opcode Lengths
.byte 1
.byte 1
.byte 1
.byte 1
.byte 0
.byte 0
.byte 0
.byte 1
.byte 0
.byte 0
.byte 1
# No directories.
.byte 0
# No files.
.byte 0
LT2_header_end:
# Real opcode and operand.
.byte 0
.byte 9
.byte 2 # DW_LNE_set_address
.quad .text
# Real opcode with incorrect length.
.byte 0
.byte 2 # Wrong length, should be 1.
.byte 1 # DW_LNE_end_sequence
LT2_end:
# ERR: warning: unexpected line op length at offset 0x0000005e
# ERR-SAME: expected 0x02 found 0x01
|