forked from Imagelibrary/littlefs
scripts: Reverted stack.py to use -fcallgraph-info=su again
See previous commit for the issues with stack.py's current approach. I'm convinced dwarf-info simply does not contain enough info to figure out stack usage. There is one last idea, which is to parse the dissassembly. In theory you only need to understand calls, branches (for control-flow), and push/pop instructions to figure out the worst-case stack usage. But this would be ISA-specific and error-prone, so it probably shouldn't _replace_ the -fcallgraph-info=su based stack.py. So, out of ideas, reverting. --- It's worth noting this isn't a trivial revert. There's a couple interesting changes in stack.py: - We now use .o files to map callgraph nodes to relevant symbol names. This should be a bit more robust than relying only on the names in the .ci files, and guarantees function names line up with other symbol-based scripts (code.py, ctx.py, etc). This also lets us warn on missing callgraph nodes, in case the callgraph info is incomplete. - Callgraph parsing should be quite a bit more robust now. Added a small (and reusable?) Parser class. - Moved cycle detection into result collection. This should let us drop cycle detection from the table renderer eventually.
This commit is contained in:
@@ -705,10 +705,10 @@ def collect(obj_paths, *,
|
||||
size_ = sizeof(type, seen | {entry.off})
|
||||
children_, notes_, dirty_ = childrenof(
|
||||
type, seen | {entry.off})
|
||||
dirty = dirty or dirty_
|
||||
children.append(CtxResult(file, name_, size_,
|
||||
children=children_,
|
||||
notes=notes_))
|
||||
dirty = dirty or dirty_
|
||||
# struct? union?
|
||||
elif entry.tag in {
|
||||
'DW_TAG_structure_type',
|
||||
@@ -721,11 +721,11 @@ def collect(obj_paths, *,
|
||||
size_ = sizeof(child, seen | {entry.off})
|
||||
children_, notes_, dirty_ = childrenof(
|
||||
child, seen | {entry.off})
|
||||
dirty = dirty or dirty_
|
||||
children.append(CtxResult(file, name_, size_,
|
||||
i=child.off,
|
||||
children=children_,
|
||||
notes=notes_))
|
||||
dirty = dirty or dirty_
|
||||
# base type? function pointer?
|
||||
elif entry.tag in {
|
||||
'DW_TAG_base_type',
|
||||
|
||||
Reference in New Issue
Block a user