aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/symtab.go
diff options
context:
space:
mode:
authorKeith Randall <keithr@alum.mit.edu>2018-09-11 15:14:28 -0700
committerKeith Randall <khr@golang.org>2018-10-03 19:54:23 +0000
commit9dac0a8132d7db5225b27bdd8faeb3158e624159 (patch)
treef2d0d9f80bc5f7101fc06c1d13d719fbd663533b /src/runtime/symtab.go
parent9a8372f8bd5a39d2476bfa9247407b51f9193b9e (diff)
downloadgo-9dac0a8132d7db5225b27bdd8faeb3158e624159.tar.gz
go-9dac0a8132d7db5225b27bdd8faeb3158e624159.zip
runtime: on a signal, set traceback address to a deferreturn call
When a function triggers a signal (like a segfault which translates to a nil pointer exception) during execution, a sigpanic handler is just below it on the stack. The function itself did not stop at a safepoint, so we have to figure out what safepoint we should use to scan its stack frame. Previously we used the site of the most recent defer to get the live variables at the signal site. That answer is not quite correct, as explained in #27518. Instead, use the site of a deferreturn call. It has all the right variables marked as live (no args, all the return values, except those that escape to the heap, in which case the corresponding PAUTOHEAP variables will be live instead). This CL requires stack objects, so that all the local variables and args referenced by the deferred closures keep the right variables alive. Fixes #27518 Change-Id: Id45d8a8666759986c203181090b962e2981e48ca Reviewed-on: https://go-review.googlesource.com/c/134637 Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/runtime/symtab.go')
-rw-r--r--src/runtime/symtab.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go
index 452e9d06ae..1dc7ab740e 100644
--- a/src/runtime/symtab.go
+++ b/src/runtime/symtab.go
@@ -357,7 +357,7 @@ const (
// Note that in some situations involving plugins, there may be multiple
// copies of a particular special runtime function.
// Note: this list must match the list in cmd/internal/objabi/funcid.go.
-type funcID uint32
+type funcID uint8
const (
funcID_normal funcID = iota // not a special function
@@ -856,7 +856,7 @@ func pcdatavalue(f funcInfo, table int32, targetpc uintptr, cache *pcvalueCache)
return pcvalue(f, off, targetpc, cache, true)
}
-func funcdata(f funcInfo, i int32) unsafe.Pointer {
+func funcdata(f funcInfo, i uint8) unsafe.Pointer {
if i < 0 || i >= f.nfuncdata {
return nil
}