Open glatosinski opened 8 months ago
Hi @glatosinski!
Thanks for contributing this, and sorry for the long response time. Can you please add a minimal test that demonstrates the failure mode this PR fixes?
Thanks!
Hi, ok, I will prepare a minimal test
This PR introduces several small improvements to updating the current file name for the Callgrind parser:
cfn
) is within an inlined code block, it should use file names provided byfi
orfe
keys.fn
key is present, the parser should set the current file name to the value provided in the previousfl
key (such reset is also applied in KCacheGrind: link to code.fn
should be stored separately so that it is not overwritten later by newfl
calls.Those small modifications improve detection of root nodes. Before the PR, the same function could have several files associated with it - when
fi
/fe
are not taken into account, the file name for the current callee is taken from the lastfl
orcfi
call, which is later added tochildMap
inthis.childrenTotalWeights
instead of the actual function with its file name. After this, only one of the two representations of the same symbol get deleted fromrootNodes
.Without the improvement, we can observe detached call stacks for such "orphaned" functions. With the improvement, the functions have properly provided names, which leads to better generation of the call graph.
Some examples before and after applying the commit from the PR (the marked calls are for the same function):
Example 1 (callgrind file)
Example 2
Before:
After:
Example 3
This fixes https://github.com/jlfwong/speedscope/issues/465