aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2022-07-12 16:42:06 -0400
committerAustin Clements <austin@google.com>2023-03-10 17:18:22 +0000
commit4f132b7ef862d83390feb074be3e04109e43adaa (patch)
treea0cbaac86091ea06f5ae17639faea11214c208a5 /src/runtime
parent2d93805171275a4199bf74fe0e47671fb2f9aea4 (diff)
downloadgo-4f132b7ef862d83390feb074be3e04109e43adaa.tar.xz
runtime: don't track stack separately in gentraceback
Currently, gentraceback keeps a copy of the stack bounds of the stack it's walking in the "stack" variable. Now that "gp" always refers to the G whose stack it's walking, we can simply use gp.stack instead of keeping a separate copy. For #54466. Change-Id: I68256e5dff6212cfcf14eda615487e66a92d4914 Reviewed-on: https://go-review.googlesource.com/c/go/+/458215 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Felix Geisendörfer <felix.geisendoerfer@datadoghq.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/traceback.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go
index 6773509901..507f366037 100644
--- a/src/runtime/traceback.go
+++ b/src/runtime/traceback.go
@@ -78,7 +78,6 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
}
waspanic := false
cgoCtxt := gp.cgoCtxt
- stack := gp.stack
printing := pcbuf == nil && callback == nil
// If the PC is zero, it's likely a nil function call.
@@ -111,7 +110,7 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
if !f.valid() {
if callback != nil || printing {
print("runtime: g ", gp.goid, ": unknown pc ", hex(frame.pc), "\n")
- tracebackHexdump(stack, &frame, 0)
+ tracebackHexdump(gp.stack, &frame, 0)
}
if callback != nil {
throw("unknown pc")
@@ -177,7 +176,6 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
flag = f.flag
frame.lr = gp.sched.lr
frame.sp = gp.sched.sp
- stack = gp.stack
cgoCtxt = gp.cgoCtxt
case funcID_systemstack:
// systemstack returns normally, so just follow the
@@ -195,7 +193,6 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
}
gp = gp.m.curg
frame.sp = gp.sched.sp
- stack = gp.stack
cgoCtxt = gp.cgoCtxt
flag &^= funcFlag_SPWRITE
}
@@ -264,7 +261,7 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
}
if callback != nil || doPrint {
print("runtime: g ", gp.goid, ": unexpected return pc for ", funcname(f), " called from ", hex(frame.lr), "\n")
- tracebackHexdump(stack, &frame, lrPtr)
+ tracebackHexdump(gp.stack, &frame, lrPtr)
}
if callback != nil {
throw("unknown caller pc")
@@ -483,7 +480,7 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
if frame.pc == frame.lr && frame.sp == frame.fp {
// If the next frame is identical to the current frame, we cannot make progress.
print("runtime: traceback stuck. pc=", hex(frame.pc), " sp=", hex(frame.sp), "\n")
- tracebackHexdump(stack, &frame, frame.sp)
+ tracebackHexdump(gp.stack, &frame, frame.sp)
throw("traceback stuck")
}