From 4c6339ac4697e99e6190a8603a746759e6fe4c81 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Wed, 2 Jun 2021 17:01:29 +0200 Subject: [PATCH] elf_mem_map: decode correctly void pointers --- tools/elf_mem_map | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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