aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/proc.go
diff options
context:
space:
mode:
authorMark Pulford <mark@kyne.com.au>2018-11-30 21:12:06 +1100
committerIan Lance Taylor <iant@golang.org>2018-12-10 23:09:58 +0000
commit0f0b10818bd00b1c5778f7c2fbed72bb06defbba (patch)
tree3d0d71c967cce3b7e1e0c3367b3eee8699b5fc28 /src/runtime/proc.go
parent963c9fdf9735bc464521cde3d46b596ce0d74eba (diff)
downloadgo-0f0b10818bd00b1c5778f7c2fbed72bb06defbba.tar.xz
runtime: fix CGO traceback frame count
Without this, each additional C frame found via SetCgoTraceback will cause a frame to be dropped from the bottom of the traceback stack. Fixes #29034 Change-Id: I90aa6b2a1dced90c69b64c5dd565fe64a25724a3 Reviewed-on: https://go-review.googlesource.com/c/151917 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/proc.go')
-rw-r--r--src/runtime/proc.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index 409869fd10..fc77a964b6 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -3742,6 +3742,9 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) {
// Collect Go stack that leads to the cgo call.
n = gentraceback(mp.curg.syscallpc, mp.curg.syscallsp, 0, mp.curg, 0, &stk[cgoOff], len(stk)-cgoOff, nil, nil, 0)
+ if n > 0 {
+ n += cgoOff
+ }
} else if traceback {
n = gentraceback(pc, sp, lr, gp, 0, &stk[0], len(stk), nil, nil, _TraceTrap|_TraceJumpStack)
}