From 3a0a58369a6de177c3cbc2c549ba1c06f51791bc Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Sat, 30 Nov 2024 01:33:21 -0600 Subject: [PATCH] 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. --- scripts/ctx.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/ctx.py b/scripts/ctx.py index cc99fa6c..47409a07 100755 --- a/scripts/ctx.py +++ b/scripts/ctx.py @@ -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