elf_mem_map: decode correctly void pointers

This commit is contained in:
Yuri D'Elia 2021-06-02 17:01:29 +02:00 committed by DRracer
parent 1095b26570
commit 4c6339ac46

View File

@ -47,11 +47,15 @@ def get_elf_globals(path):
# variable name # variable name
name = DIE.attributes['DW_AT_name'].value.decode('ascii') name = DIE.attributes['DW_AT_name'].value.decode('ascii')
# recurse on type to find the leaf definition # recurse on type to find the final storage definition
type_DIE = DIE type_DIE = DIE
while 'DW_AT_type' in type_DIE.attributes: byte_size = None
while True:
if 'DW_AT_byte_size' in type_DIE.attributes:
byte_size = type_DIE.attributes.get('DW_AT_byte_size')
if 'DW_AT_type' not in type_DIE.attributes:
break
type_DIE = type_DIE.get_DIE_from_attribute('DW_AT_type') type_DIE = type_DIE.get_DIE_from_attribute('DW_AT_type')
byte_size = type_DIE.attributes.get('DW_AT_byte_size')
if byte_size is None: if byte_size is None:
continue continue
size = byte_size.value size = byte_size.value