1
0
mirror of https://github.com/golang/go synced 2024-11-26 22:11:25 -07:00

runtime: remove unused skip arg from fpTracebackPCs

This was accidentally left behind when moving the logic to set the skip
sentinel in pcBuf to the caller.

Change-Id: Id7565f6ea4df6b32cf18b99c700bca322998d182
Reviewed-on: https://go-review.googlesource.com/c/go/+/489095
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Felix Geisendörfer <felix.geisendoerfer@datadoghq.com>
This commit is contained in:
Felix Geisendörfer 2023-04-26 09:36:53 +02:00 committed by Michael Pratt
parent 6d2309b576
commit c3db9af3a6
3 changed files with 7 additions and 7 deletions

View File

@ -443,7 +443,7 @@ func fpCallersCached(b *testing.B, n int) int {
pcs := make([]uintptr, 32) pcs := make([]uintptr, 32)
b.ResetTimer() b.ResetTimer()
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
runtime.FPCallers(0, pcs) runtime.FPCallers(pcs)
} }
b.StopTimer() b.StopTimer()
return 0 return 0

View File

@ -437,7 +437,7 @@ func ShrinkStackAndVerifyFramePointers() {
}) })
// If our new stack contains frame pointers into the old stack, this will // If our new stack contains frame pointers into the old stack, this will
// crash because the old stack has been poisoned. // crash because the old stack has been poisoned.
FPCallers(0, make([]uintptr, 1024)) FPCallers(make([]uintptr, 1024))
} }
// BlockOnSystemStack switches to the system stack, prints "x\n" to // BlockOnSystemStack switches to the system stack, prints "x\n" to
@ -1819,6 +1819,6 @@ func PersistentAlloc(n uintptr) unsafe.Pointer {
// FPCallers works like Callers and uses frame pointer unwinding to populate // FPCallers works like Callers and uses frame pointer unwinding to populate
// pcBuf with the return addresses of the physical frames on the stack. // pcBuf with the return addresses of the physical frames on the stack.
func FPCallers(skip int, pcBuf []uintptr) int { func FPCallers(pcBuf []uintptr) int {
return fpTracebackPCs(unsafe.Pointer(getcallerfp()), skip, pcBuf) return fpTracebackPCs(unsafe.Pointer(getcallerfp()), pcBuf)
} }

View File

@ -917,7 +917,7 @@ func traceStackID(mp *m, pcBuf []uintptr, skip int) uint64 {
// Fast path: Unwind using frame pointers. // Fast path: Unwind using frame pointers.
pcBuf[0] = uintptr(skip) pcBuf[0] = uintptr(skip)
if curgp == gp { if curgp == gp {
nstk += fpTracebackPCs(unsafe.Pointer(getcallerfp()), skip, pcBuf[1:]) nstk += fpTracebackPCs(unsafe.Pointer(getcallerfp()), pcBuf[1:])
} else if curgp != nil { } else if curgp != nil {
// We're called on the g0 stack through mcall(fn) or systemstack(fn). To // We're called on the g0 stack through mcall(fn) or systemstack(fn). To
// behave like gcallers above, we start unwinding from sched.bp, which // behave like gcallers above, we start unwinding from sched.bp, which
@ -925,7 +925,7 @@ func traceStackID(mp *m, pcBuf []uintptr, skip int) uint64 {
// address of the leaf frame is stored in sched.pc, which we manually // address of the leaf frame is stored in sched.pc, which we manually
// capture here. // capture here.
pcBuf[1] = curgp.sched.pc pcBuf[1] = curgp.sched.pc
nstk += 1 + fpTracebackPCs(unsafe.Pointer(curgp.sched.bp), skip, pcBuf[2:]) nstk += 1 + fpTracebackPCs(unsafe.Pointer(curgp.sched.bp), pcBuf[2:])
} }
} }
if nstk > 0 { if nstk > 0 {
@ -948,7 +948,7 @@ func tracefpunwindoff() bool {
// returns the number of PCs written to pcBuf. The returned PCs correspond to // returns the number of PCs written to pcBuf. The returned PCs correspond to
// "physical frames" rather than "logical frames"; that is if A is inlined into // "physical frames" rather than "logical frames"; that is if A is inlined into
// B, this will return a PC for only B. // B, this will return a PC for only B.
func fpTracebackPCs(fp unsafe.Pointer, skip int, pcBuf []uintptr) (i int) { func fpTracebackPCs(fp unsafe.Pointer, pcBuf []uintptr) (i int) {
for i = 0; i < len(pcBuf) && fp != nil; i++ { for i = 0; i < len(pcBuf) && fp != nil; i++ {
// return addr sits one word above the frame pointer // return addr sits one word above the frame pointer
pcBuf[i] = *(*uintptr)(unsafe.Pointer(uintptr(fp) + goarch.PtrSize)) pcBuf[i] = *(*uintptr)(unsafe.Pointer(uintptr(fp) + goarch.PtrSize))