scripts: Adopted ctx.py-related changes in structs.py

- Dropped --internal flag, structs.py includes all structs now.

  No reason to limit structs.py to public structs if ctx.py exists.

- Added struct/union/enum prefixes to results (enums were missing in
  ctx.py).

- Only sort children layers if explicitly requested. This should
  preserve field order, which is nice.

- Adopt more advanced FileInfo/DwarfInfo classes.

- Adopted table renderer changes (notes rendering).
This commit is contained in:
Christopher Haster
2024-11-30 23:34:44 -06:00
parent c8a4ee91a6
commit 55d01f69f9
2 changed files with 230 additions and 94 deletions

View File

@@ -369,11 +369,13 @@ def collect_dwarf_info(obj_path, filter=None, *,
def name(self):
if 'DW_AT_name' in self:
name = self['DW_AT_name'].split(':')[-1].strip()
# prefix with struct/union
# prefix with struct/union/enum
if self.tag == 'DW_TAG_structure_type':
name = 'struct ' + name
elif self.tag == 'DW_TAG_union_type':
name = 'union ' + name
elif self.tag == 'DW_TAG_enumeration_type':
name = 'enum ' + name
return name
else:
return None