@@ -50,16 +50,12 @@ bool DWARFDebugInfoEntry::Extract(const DWARFDataExtractor &data,
50
50
lldbassert (abbr_idx <= UINT16_MAX);
51
51
m_abbr_idx = abbr_idx;
52
52
53
- // assert (fixed_form_sizes); // For best performance this should be
54
- // specified!
55
-
56
53
if (m_abbr_idx == 0 ) {
57
54
m_tag = llvm::dwarf::DW_TAG_null;
58
55
m_has_children = false ;
59
56
return true ; // NULL debug tag entry
60
57
}
61
58
62
- lldb::offset_t offset = *offset_ptr;
63
59
const auto *abbrevDecl = GetAbbreviationDeclarationPtr (cu);
64
60
if (abbrevDecl == nullptr ) {
65
61
cu->GetSymbolFileDWARF ().GetObjectFile ()->GetModule ()->ReportError (
@@ -74,137 +70,18 @@ bool DWARFDebugInfoEntry::Extract(const DWARFDataExtractor &data,
74
70
m_tag = abbrevDecl->getTag ();
75
71
m_has_children = abbrevDecl->hasChildren ();
76
72
// Skip all data in the .debug_info or .debug_types for the attributes
77
- dw_form_t form;
78
73
for (const auto &attribute : abbrevDecl->attributes ()) {
79
- form = attribute.Form ;
80
- std::optional<uint8_t > fixed_skip_size =
81
- DWARFFormValue::GetFixedSize (form, cu);
82
- if (fixed_skip_size)
83
- offset += *fixed_skip_size;
84
- else {
85
- bool form_is_indirect = false ;
86
- do {
87
- form_is_indirect = false ;
88
- uint32_t form_size = 0 ;
89
- switch (form) {
90
- // Blocks if inlined data that have a length field and the data bytes
91
- // inlined in the .debug_info/.debug_types
92
- case DW_FORM_exprloc:
93
- case DW_FORM_block:
94
- form_size = data.GetULEB128 (&offset);
95
- break ;
96
- case DW_FORM_block1:
97
- form_size = data.GetU8_unchecked (&offset);
98
- break ;
99
- case DW_FORM_block2:
100
- form_size = data.GetU16_unchecked (&offset);
101
- break ;
102
- case DW_FORM_block4:
103
- form_size = data.GetU32_unchecked (&offset);
104
- break ;
105
-
106
- // Inlined NULL terminated C-strings
107
- case DW_FORM_string:
108
- data.GetCStr (&offset);
109
- break ;
110
-
111
- // Compile unit address sized values
112
- case DW_FORM_addr:
113
- form_size = cu->GetAddressByteSize ();
114
- break ;
115
- case DW_FORM_ref_addr:
116
- if (cu->GetVersion () <= 2 )
117
- form_size = cu->GetAddressByteSize ();
118
- else
119
- form_size = 4 ;
120
- break ;
74
+ if (DWARFFormValue::SkipValue (attribute.Form , data, offset_ptr, cu))
75
+ continue ;
121
76
122
- // 0 sized form
123
- case DW_FORM_flag_present:
124
- form_size = 0 ;
125
- break ;
126
-
127
- // 1 byte values
128
- case DW_FORM_addrx1:
129
- case DW_FORM_data1:
130
- case DW_FORM_flag:
131
- case DW_FORM_ref1:
132
- case DW_FORM_strx1:
133
- form_size = 1 ;
134
- break ;
135
-
136
- // 2 byte values
137
- case DW_FORM_addrx2:
138
- case DW_FORM_data2:
139
- case DW_FORM_ref2:
140
- case DW_FORM_strx2:
141
- form_size = 2 ;
142
- break ;
143
-
144
- // 3 byte values
145
- case DW_FORM_addrx3:
146
- case DW_FORM_strx3:
147
- form_size = 3 ;
148
- break ;
149
-
150
- // 4 byte values
151
- case DW_FORM_addrx4:
152
- case DW_FORM_data4:
153
- case DW_FORM_ref4:
154
- case DW_FORM_strx4:
155
- form_size = 4 ;
156
- break ;
157
-
158
- // 8 byte values
159
- case DW_FORM_data8:
160
- case DW_FORM_ref8:
161
- case DW_FORM_ref_sig8:
162
- form_size = 8 ;
163
- break ;
164
-
165
- // signed or unsigned LEB 128 values
166
- case DW_FORM_addrx:
167
- case DW_FORM_loclistx:
168
- case DW_FORM_rnglistx:
169
- case DW_FORM_sdata:
170
- case DW_FORM_udata:
171
- case DW_FORM_ref_udata:
172
- case DW_FORM_GNU_addr_index:
173
- case DW_FORM_GNU_str_index:
174
- case DW_FORM_strx:
175
- data.Skip_LEB128 (&offset);
176
- break ;
177
-
178
- case DW_FORM_indirect:
179
- form_is_indirect = true ;
180
- form = static_cast <dw_form_t >(data.GetULEB128 (&offset));
181
- break ;
182
-
183
- case DW_FORM_strp:
184
- case DW_FORM_line_strp:
185
- case DW_FORM_sec_offset:
186
- data.GetU32 (&offset);
187
- break ;
188
-
189
- case DW_FORM_implicit_const:
190
- form_size = 0 ;
191
- break ;
192
-
193
- default :
194
- cu->GetSymbolFileDWARF ().GetObjectFile ()->GetModule ()->ReportError (
195
- " [{0:x16}]: Unsupported DW_FORM_{1:x}, please file a bug "
196
- " and "
197
- " attach the file at the start of this error message" ,
198
- (uint64_t )m_offset, (unsigned )form);
199
- *offset_ptr = m_offset;
200
- return false ;
201
- }
202
- offset += form_size;
203
-
204
- } while (form_is_indirect);
205
- }
77
+ cu->GetSymbolFileDWARF ().GetObjectFile ()->GetModule ()->ReportError (
78
+ " [{0:x16}]: Unsupported DW_FORM_{1:x}, please file a bug "
79
+ " and "
80
+ " attach the file at the start of this error message" ,
81
+ (uint64_t )m_offset, (unsigned )attribute.Form );
82
+ *offset_ptr = m_offset;
83
+ return false ;
206
84
}
207
- *offset_ptr = offset;
208
85
return true ;
209
86
}
210
87
0 commit comments