mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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
This commit is contained in:
parent
e56dc99665
commit
14d2ee1d00
10 changed files with 257 additions and 16 deletions
|
|
@ -492,10 +492,14 @@ adjustframe(Stkframe *frame, void *arg)
|
|||
adjinfo = arg;
|
||||
f = frame->fn;
|
||||
if(StackDebug >= 2)
|
||||
runtime·printf(" adjusting %s frame=[%p,%p] pc=%p\n", runtime·funcname(f), frame->sp, frame->fp, frame->pc);
|
||||
runtime·printf(" adjusting %s frame=[%p,%p] pc=%p continpc=%p\n", runtime·funcname(f), frame->sp, frame->fp, frame->pc, frame->continpc);
|
||||
if(f->entry == (uintptr)runtime·main)
|
||||
return true;
|
||||
targetpc = frame->pc;
|
||||
targetpc = frame->continpc;
|
||||
if(targetpc == 0) {
|
||||
// Frame is dead.
|
||||
return true;
|
||||
}
|
||||
if(targetpc != f->entry)
|
||||
targetpc--;
|
||||
pcdata = runtime·pcdatavalue(f, PCDATA_StackMapIndex, targetpc);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue