aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/traceback.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2018-07-16 14:39:40 -0700
committerKeith Randall <khr@golang.org>2018-07-24 21:06:55 +0000
commitfe68ab3bcde97e3a325e4aa3c70f5f9172540453 (patch)
tree2181dfee533b37de34b2bab525c88f4104c34942 /src/runtime/traceback.go
parent5fc70b6fac0664f3f9d2c2948ba78db420ba70c5 (diff)
downloadgo-fe68ab3bcde97e3a325e4aa3c70f5f9172540453.tar.gz
go-fe68ab3bcde97e3a325e4aa3c70f5f9172540453.zip
runtime: traceback from outermost libc call
If we're in a libc call and get a trap, don't try to traceback the libc call. Start from the state we had at entry to libc. If there are multiple libc calls outstanding, remember the outermost one. Fixes #26393 Change-Id: Icfe8794b95bf3bfd1a0679b456dcde2481dcabf3 Reviewed-on: https://go-review.googlesource.com/124195 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/traceback.go')
-rw-r--r--src/runtime/traceback.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go
index 49536539008..d8c225d975f 100644
--- a/src/runtime/traceback.go
+++ b/src/runtime/traceback.go
@@ -679,7 +679,14 @@ func traceback(pc, sp, lr uintptr, gp *g) {
// the initial PC must not be rewound to the previous instruction.
// (All the saved pairs record a PC that is a return address, so we
// rewind it into the CALL instruction.)
+// If gp.m.libcall{g,pc,sp} information is available, it uses that information in preference to
+// the pc/sp/lr passed in.
func tracebacktrap(pc, sp, lr uintptr, gp *g) {
+ if gp.m.libcallsp != 0 {
+ // We're in C code somewhere, traceback from the saved position.
+ traceback1(gp.m.libcallpc, gp.m.libcallsp, 0, gp.m.libcallg.ptr(), 0)
+ return
+ }
traceback1(pc, sp, lr, gp, _TraceTrap)
}