From 2ff746d7dc3ce5ce7034bfcc3af16b7b8eab7413 Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Sun, 20 Oct 2019 17:25:02 -0400 Subject: runtime: add async preemption support on ARM This CL adds support of call injection and async preemption on ARM. Injected call, like sigpanic, has special frame layout. Teach traceback to handle it. Change-Id: I887e90134fbf8a676b73c26321c50b3c4762dba4 Reviewed-on: https://go-review.googlesource.com/c/go/+/202338 Run-TryBot: Cherry Zhang Reviewed-by: Austin Clements --- src/runtime/traceback.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/runtime/traceback.go') diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go index 9be7d739d1..dc2a7a3693 100644 --- a/src/runtime/traceback.go +++ b/src/runtime/traceback.go @@ -462,6 +462,7 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in } waspanic = f.funcID == funcID_sigpanic + injectedCall := waspanic || f.funcID == funcID_asyncPreempt // Do not unwind past the bottom of the stack. if !flr.valid() { @@ -477,8 +478,8 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in frame.argmap = nil // On link register architectures, sighandler saves the LR on stack - // before faking a call to sigpanic. - if usesLR && waspanic { + // before faking a call. + if usesLR && injectedCall { x := *(*uintptr)(unsafe.Pointer(frame.sp)) frame.sp += sys.MinFrameSize if GOARCH == "arm64" { -- cgit v1.3-5-g9baa