scripts: ctx.py: Added struct/union namespace prefix to results

This is a bit more readable and better matches the names used in the C
code (lfs_config vs struct lfs_config).

The downside is we now have fields with spaces in them, which may cause
problems for naive parsers.
This commit is contained in:
Christopher Haster
2024-11-30 01:33:21 -06:00
parent 2df97cd858
commit 3a0a58369a
+7 -1
View File
@@ -368,7 +368,13 @@ def collect_dwarf_info(obj_path, filter=None, *,
@ft.cached_property
def name(self):
if 'DW_AT_name' in self:
return self['DW_AT_name'].split(':')[-1].strip()
name = self['DW_AT_name'].split(':')[-1].strip()
# prefix with struct/union
if self.tag == 'DW_TAG_structure_type':
name = 'struct ' + name
elif self.tag == 'DW_TAG_union_type':
name = 'union ' + name
return name
else:
return None