-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/cmd/callgraph: calls from unreachable unexported methods not reported in callgraph #66251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@adonovan Given your closeness to the likely similar prior issue |
Thanks. I expect a patch along these lines should be effective:
|
Agree with respect to |
Based on my early testing, I believe you'll also need to filter out |
The bug in -algo=static was fixed yesterday by https://go.dev/cl/609280. The fix for the bug in CHA (which is really a bug in AllFunctions) is something along the lines of https://go.dev/cl/609281, but as it stands that CL would cause CHA's analysis of |
Change https://go.dev/cl/609281 mentions this issue: |
On further reflection, I think the If you were to use a different algorithm to gather up functions (" My apologies for the various contradictory things I have said on this and other related callgraph issues this week. |
Go version
go version go1.22.0 darwin/amd64
Output of
go env
in your module/workspace:What did you do?
go.mod
example2/main.go
Ran
callgraph -algo={algo} ./example2
foralgo
in[static, cha, rta, vta]
What did you see happen?
callgraph -algo=static ./example2
callgraph -algo=cha ./example2
callgraph -algo=rta ./example2
callgraph -algo=vta ./example2
What did you expect to see?
callgraph -algo=static ./example2
callgraph -algo=cha ./example2
callgraph -algo=rta ./example2
This is because rta only includes reachable funcs by design
callgraph -algo=vta ./example2
Note that the link from
example2.unexported).Func1
tocalled
is present whenexample2.unexported).Func1
is forced to be reachable. For example:example2/main.go
callgraph -algo=static ./example2
callgraph -algo=cha ./example2
callgraph -algo=rta ./example2
This is because rta only includes reachable funcs by design
callgraph -algo=vta ./example2
This likely has to do with the same usage of
ssautil.AllFunctions
(at least for vta) that resulted in this bug for thedeadcode
command.The text was updated successfully, but these errors were encountered: