Skip to content
This repository was archived by the owner on May 16, 2025. It is now read-only.

Commit 5f685e5

Browse files
committed
Second update to dwarf.py
1 parent 7b3f52b commit 5f685e5

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

volatility/dwarf.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,21 @@ def process_statement(self, kind, level, data, statement_id):
195195

196196
# If it's just a forward declaration, we want the name around,
197197
# but there won't be a size
198-
if 'DW_AT_declaration' not in data and 'DW_AT_byte_size' in data:
199-
self.vtypes[name] = [ int(data['DW_AT_byte_size'], self.base), {} ]
198+
if 'DW_AT_declaration' not in data:
199+
if 'DW_AT_byte_size' in data:
200+
self.vtypes[name] = [ int(data['DW_AT_byte_size'], self.base), {} ]
201+
else:
202+
self.vtypes[name] = [ 0, {} ]
200203

201204
elif kind == 'DW_TAG_union_type':
202205
name = data.get('DW_AT_name', "__unnamed_%s" % statement_id).strip('"')
203206
self.name_stack[-1][1] = name
204207
self.id_to_name[statement_id] = [name]
205-
if 'DW_AT_declaration' not in data and 'DW_AT_byte_size' in data:
206-
self.vtypes[name] = [ int(data['DW_AT_byte_size'], self.base), {} ]
208+
if 'DW_AT_declaration' not in data:
209+
if 'DW_AT_byte_size' in data:
210+
self.vtypes[name] = [ int(data['DW_AT_byte_size'], self.base), {} ]
211+
else:
212+
self.vtypes[name] = [ 0, {} ]
207213

208214
elif kind == 'DW_TAG_array_type':
209215
self.name_stack[-1][1] = statement_id
@@ -216,8 +222,12 @@ def process_statement(self, kind, level, data, statement_id):
216222

217223
# If it's just a forward declaration, we want the name around,
218224
# but there won't be a size
219-
if 'DW_AT_declaration' not in data and 'DW_AT_byte_size' in data:
220-
sz = int(data['DW_AT_byte_size'], self.base)
225+
if 'DW_AT_declaration' not in data:
226+
if 'DW_AT_byte_size' in data:
227+
sz = int(data['DW_AT_byte_size'], self.base)
228+
else:
229+
sz = 0
230+
221231
self.enums[name] = [sz, {}]
222232

223233
elif kind == 'DW_TAG_pointer_type':

0 commit comments

Comments
 (0)