Try to fix members types
Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
parent
e1f6b279f2
commit
e0b5edca57
18
main.py
18
main.py
|
@ -17,6 +17,14 @@ configuration = {
|
|||
'print_debug_info': False,
|
||||
}
|
||||
|
||||
supported_types = [
|
||||
'DW_TAG_base_type',
|
||||
'DW_TAG_structure_type',
|
||||
'DW_TAG_array_type',
|
||||
'DW_TAG_union_type',
|
||||
'DW_TAG_enumeration_type'
|
||||
]
|
||||
|
||||
|
||||
def eprint(*args, **kwargs):
|
||||
if configuration['print_debug_info']:
|
||||
|
@ -168,7 +176,7 @@ class Bear():
|
|||
die_type_test = die_type
|
||||
while 'DW_AT_type' in die_type_test.attributes:
|
||||
die_type_test = die_type_test.get_DIE_from_attribute('DW_AT_type')
|
||||
if die_type_test.tag in ['DW_TAG_base_type', 'DW_TAG_structure_type', 'DW_TAG_array_type', 'DW_TAG_union_type']:
|
||||
if die_type_test.tag in supported_types:
|
||||
die_type = die_type_test
|
||||
break
|
||||
|
||||
|
@ -180,7 +188,7 @@ class Bear():
|
|||
if real_type_name != '?' and real_type_name != entry['type']:
|
||||
entry['type'] = '{name} ({real})'.format(name=entry['type'],
|
||||
real=safe_DIE_name(die_type, '?'))
|
||||
elif die_type.tag == "DW_TAG_structure_type":
|
||||
elif die_type.tag == 'DW_TAG_structure_type':
|
||||
load_children(die_type)
|
||||
child_dies = []
|
||||
child_offset = 0
|
||||
|
@ -188,6 +196,8 @@ class Bear():
|
|||
for child_die in die_type._children:
|
||||
if 'DW_AT_type' in child_die.attributes:
|
||||
typ_die = child_die.get_DIE_from_attribute('DW_AT_type')
|
||||
elif child_die.tag in supported_types:
|
||||
typ_die = child_die
|
||||
else:
|
||||
eprint('Child DIE with no type information')
|
||||
epprint(child_die)
|
||||
|
@ -212,7 +222,7 @@ class Bear():
|
|||
|
||||
child_dies.append(child_entry)
|
||||
entry['children'] = child_dies
|
||||
elif die_type.tag == "DW_TAG_array_type":
|
||||
elif die_type.tag == 'DW_TAG_array_type':
|
||||
self.truly_resolve_type(entry, die_type.get_DIE_from_attribute('DW_AT_type'))
|
||||
load_children(die_type)
|
||||
entry['number_of_elements'] = die_type._children[0].attributes['DW_AT_upper_bound'].value + 1
|
||||
|
@ -222,6 +232,8 @@ class Bear():
|
|||
for child_die in die_type._children:
|
||||
if 'DW_AT_type' in child_die.attributes:
|
||||
typ_die = child_die.get_DIE_from_attribute('DW_AT_type')
|
||||
elif child_die.tag in supported_types:
|
||||
typ_die = child_die
|
||||
else:
|
||||
eprint('Child DIE with no type information')
|
||||
epprint(child_die)
|
||||
|
|
Loading…
Reference in New Issue
Block a user