Skip to content

internal/report: fix exact function matching in disasm - #1027

Open
IamPritamAcharya wants to merge 2 commits into
google:mainfrom
IamPritamAcharya:fix-disasm-function-matching
Open

internal/report: fix exact function matching in disasm#1027
IamPritamAcharya wants to merge 2 commits into
google:mainfrom
IamPritamAcharya:fix-disasm-function-matching

Conversation

@IamPritamAcharya

Copy link
Copy Markdown

Fixes #1015.

The web UI converts a selected function name into an exact regexp, for example:

^example\.com/foo\.BenchmarkWork$

disasm builds its report with address granularity. At that granularity,
NodeInfo.PrintableName() also contains the address and source location:

000000010010bfb4 example.com/foo.BenchmarkWork /tmp/foo_test.go:14

symbolsFromBinaries used the regexp against this printable name when deciding
which binary mappings to inspect. An exact function-name regexp could therefore
reject the mapping before ObjFile.Symbols had a chance to match the binary
symbol name.

Update the preliminary mapping check to also match NodeInfo.Name, which is the
function name represented by the web UI selection. Keep the existing
PrintableName() check to avoid narrowing previously supported matching
behavior. Final symbol selection continues to be performed by
ObjFile.Symbols.

The regression test exercises the web /disasm handler with an anchored
function regexp. It failed with no matches found for regexp ^F2$ before this
change. The existing unanchored disassembly case remains covered.

Validation:

  • go test -v ./...
  • (cd browsertests && go test)

@google-cla

google-cla Bot commented Sep 6, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

go tool pprof web UI Disassemble sends ^func$, but disasm matches PrintableName

1 participant