diff options
| author | Russ Cox <rsc@golang.org> | 2024-03-14 15:32:00 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2024-03-15 17:11:58 +0000 |
| commit | 22f5e33031042ca2ac8521e4e7dc0783e8c0cdca (patch) | |
| tree | c88ed60a4f54caddfe89542121a8ac9db4b2338b /src/runtime/traceback.go | |
| parent | 88480fadcc5874f880623ca50713d0c62cc5259b (diff) | |
| download | go-22f5e33031042ca2ac8521e4e7dc0783e8c0cdca.tar.xz | |
runtime: allow omitting virtual PCs from runtime.CallersFrames input
This makes CL 561635's test pass without any changes to the
traceback textual format.
The test in this CL is copied identically from CL 561635.
Change-Id: I5130abdfefd9940f98f20c283cca6cd159e37617
Reviewed-on: https://go-review.googlesource.com/c/go/+/571798
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/runtime/traceback.go')
| -rw-r--r-- | src/runtime/traceback.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go index 1c75c447d2..bfdf70af9a 100644 --- a/src/runtime/traceback.go +++ b/src/runtime/traceback.go @@ -632,8 +632,11 @@ func tracebackPCs(u *unwinder, skip int, pcBuf []uintptr) int { skip-- } else { // Callers expect the pc buffer to contain return addresses - // and do the -1 themselves, so we add 1 to the call PC to - // create a return PC. + // and do the -1 themselves, so we add 1 to the call pc to + // create a "return pc". Since there is no actual call, here + // "return pc" just means a pc you subtract 1 from to get + // the pc of the "call". The actual no-op we insert may or + // may not be 1 byte. pcBuf[n] = uf.pc + 1 n++ } |
