Browse Source

elf_mem_map: handle all pointer types correctly

Yuri D'Elia 2 years ago
parent
commit
1181e78484
1 changed files with 2 additions and 2 deletions
  1. 2 2
      tools/elf_mem_map

+ 2 - 2
tools/elf_mem_map

@@ -75,12 +75,12 @@ def get_elf_globals(path):
             byte_size = None
             array_dim = []
             while True:
-                if 'DW_AT_byte_size' in type_DIE.attributes:
+                if byte_size is None and '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')
-                if type_DIE.tag == 'DW_TAG_array_type':
+                if len(array_dim) == 0 and type_DIE.tag == 'DW_TAG_array_type':
                     # fetch array dimensions (if known)
                     for range_DIE in type_DIE.iter_children():
                         if range_DIE.tag == 'DW_TAG_subrange_type' and \