aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/runtime.h
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-05-31 10:10:12 -0400
committerRuss Cox <rsc@golang.org>2014-05-31 10:10:12 -0400
commit14d2ee1d00b4fcaef569a84cb84888603405ca31 (patch)
treef519d33ed7365cda86ba3cfb81a708d36d023857 /src/pkg/runtime/runtime.h
parente56dc9966504405ecdad49f54edb45859ab3fa91 (diff)
downloadgo-14d2ee1d00b4fcaef569a84cb84888603405ca31.tar.xz
runtime: make continuation pc available to stack walk
The 'continuation pc' is where the frame will continue execution, if anywhere. For a frame that stopped execution due to a CALL instruction, the continuation pc is immediately after the CALL. But for a frame that stopped execution due to a fault, the continuation pc is the pc after the most recent CALL to deferproc in that frame, or else 0. That is where execution will continue, if anywhere. The liveness information is only recorded for CALL instructions. This change makes sure that we never look for liveness information except for CALL instructions. Using a valid PC fixes crashes when a garbage collection or stack copying tries to process a stack frame that has faulted. Record continuation pc in heapdump (format change). Fixes #8048. LGTM=iant, khr R=khr, iant, dvyukov CC=golang-codereviews, r https://golang.org/cl/100870044
Diffstat (limited to 'src/pkg/runtime/runtime.h')
-rw-r--r--src/pkg/runtime/runtime.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pkg/runtime/runtime.h b/src/pkg/runtime/runtime.h
index fa6b6ffa04..5115503789 100644
--- a/src/pkg/runtime/runtime.h
+++ b/src/pkg/runtime/runtime.h
@@ -703,6 +703,11 @@ struct Defer
void* args[1]; // padded to actual size
};
+// argp used in Defer structs when there is no argp.
+// TODO(rsc): Maybe we could use nil instead, but we've always used -1
+// and I don't want to change this days before the Go 1.3 release.
+#define NoArgs ((byte*)-1)
+
/*
* panics
*/
@@ -724,6 +729,7 @@ struct Stkframe
{
Func* fn; // function being run
uintptr pc; // program counter within fn
+ uintptr continpc; // program counter where execution can continue, or 0 if not
uintptr lr; // program counter at caller aka link register
uintptr sp; // stack pointer at pc
uintptr fp; // stack pointer at caller aka frame pointer