forked from Imagelibrary/littlefs
scripts: Fixed incorrect files on recursive results
It's been a while since I've been hurt by Python's late-binding variables. In this case the scope-creep of the "file" variable hid that we didn't actually know which recursive result belonged to which file. Instead we were just assigning whatever the most recent top-level result was. This is fixed by looking up the correct file in childrenof. Though this unfortunately does add quite a bit of noise.
This commit is contained in:
@@ -546,12 +546,17 @@ def collect(obj_paths, *,
|
||||
'DW_TAG_union_type'}:
|
||||
children = []
|
||||
for child in entry.children:
|
||||
# if we have no file guess from obj path
|
||||
if 'DW_AT_decl_file' in child:
|
||||
file_ = files.get(int(child['DW_AT_decl_file']), '?')
|
||||
else:
|
||||
file_ = re.sub('(\.o)?$', '.c', obj_path, 1)
|
||||
name_ = child.name
|
||||
size_ = sizeof(child)
|
||||
align_ = alignof(child)
|
||||
children_ = childrenof(child)
|
||||
children.append(StructResult(
|
||||
file, name_, size_, align_,
|
||||
file_, name_, size_, align_,
|
||||
i=child.off,
|
||||
children=children_))
|
||||
# indirect type?
|
||||
|
||||
Reference in New Issue
Block a user