diff --git a/tools/elf_mem_map b/tools/elf_mem_map index 46f1e1c1e..a4301f979 100755 --- a/tools/elf_mem_map +++ b/tools/elf_mem_map @@ -47,11 +47,15 @@ def get_elf_globals(path): # variable name 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 - 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') - byte_size = type_DIE.attributes.get('DW_AT_byte_size') if byte_size is None: continue size = byte_size.value