From bca0b44629f1317cc177072560d9a1486620e48f Mon Sep 17 00:00:00 2001 From: David Chase Date: Mon, 24 Aug 2020 22:57:01 -0400 Subject: [PATCH] cmd/compile: also check package.function for GOSSAFUNC match Old behavior is still enabled because it doesn't hurt to leave it in and existing users of this feature (there are dozens of us!) will not be surprised. Adding this finer control allows users to avoid writing ssa.html where they can't, shouldn't, or just don't want to. Example, both ways: $ GOSSAFUNC="(*Reader).Reset" go test -c -o ./a compress/gzip dumped SSA to bytes/ssa.html dumped SSA to strings/ssa.html dumped SSA to bufio/ssa.html dumped SSA to compress/gzip/ssa.html $ GOSSAFUNC="compress/gzip.(*Reader).Reset" go test -c -o ./a compress/gzip dumped SSA to compress/gzip/ssa.html Updates #40919. Change-Id: I06b77c3c1d326372a32651570b5dd6e56dfb1d7f Reviewed-on: https://go-review.googlesource.com/c/go/+/250340 Run-TryBot: David Chase TryBot-Result: Gobot Gobot Reviewed-by: Keith Randall --- src/cmd/compile/internal/gc/ssa.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cmd/compile/internal/gc/ssa.go b/src/cmd/compile/internal/gc/ssa.go index c8fb013ad0..104dd403ea 100644 --- a/src/cmd/compile/internal/gc/ssa.go +++ b/src/cmd/compile/internal/gc/ssa.go @@ -295,7 +295,10 @@ func (s *state) emitOpenDeferInfo() { // worker indicates which of the backend workers is doing the processing. func buildssa(fn *Node, worker int) *ssa.Func { name := fn.funcname() - printssa := name == ssaDump + printssa := false + if ssaDump != "" { // match either a simple name e.g. "(*Reader).Reset", or a package.name e.g. "compress/gzip.(*Reader).Reset" + printssa = name == ssaDump || myimportpath+"."+name == ssaDump + } var astBuf *bytes.Buffer if printssa { astBuf = &bytes.Buffer{} -- 2.50.0