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
x/tools/go/callgraph/vta: panics in analysis.Analyzer #50670
Comments
It seems some functions passed to VTA have an empty body/missing parameters, which can happen when VTA is used within analysis.Analyzer. I will look into that and make a fix/workaround so that panic goes away. A comment on the code in |
IIUC this is not quite right. The result of x/tools/go/analysis/passes/buildssa is a new package with its directly imported packages stubbed out [+ a bit of extra stuff]. The current package+the stubs form the program accessible from the buildssa Result. This enables modular analysis of ssa without access to transitively imported packages. A big implication of this is that (1) type sets for CHA cannot be complete, and (2) type flows for VTA will only contain the current package. Calling an imported function |
thanks for comments! I wanted to investigate which function causes panic. that is why I separate and build callgraph of each functions. and more general situation to cause this panic is calling other package's exported function. |
Change https://golang.org/cl/380795 mentions this issue: |
For golang/go#50670 Change-Id: I86d4aee70584cf255f0972e56726b29555120e6d Reviewed-on: https://go-review.googlesource.com/c/tools/+/380795 Reviewed-by: Guodong Li <guodongli@google.com> Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Trust: Michael Knyszek <mknyszek@google.com> Reviewed-by: Tim King <taking@google.com>
The fix should now be in. Closing this one. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://github.com/knsh14/vtasample/blob/master/vtasample.go
using vta package to build call graph in
golang.org/x/tools/go/analysis.Analyzer.Run
What did you expect to see?
build callgraph or return error
What did you see instead?
test panics with
panic: runtime error: index out of range [0] with length 0
at this line https://cs.opensource.google/go/x/tools/+/master:go/callgraph/vta/graph.go;l=588
The text was updated successfully, but these errors were encountered: