mirror of
https://github.com/golang/go
synced 2024-11-17 07:54:41 -07:00
runtime: mark sigtramp as TOPFRAME
Currently throw() in the signal handler results in "fatal error: unknown return pc from runtime.sigreturn ...". Marking sigtramp as TOPFRAME allows gentraceback to stop tracebacks at the end of a signal handler, since there is not much beyond sigtramp. This is just done on Linux for now, but may apply to other Unix systems as well. Change-Id: I96edcb945283f417a5bfe00ce2fb2b1a0d578692 Reviewed-on: https://go-review.googlesource.com/c/go/+/402190 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
17371eea25
commit
4bb45f7549
@ -433,7 +433,7 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$12-16
|
||||
RET
|
||||
|
||||
// Called using C ABI.
|
||||
TEXT runtime·sigtramp(SB),NOSPLIT,$28
|
||||
TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME,$28
|
||||
// Save callee-saved C registers, since the caller may be a C signal handler.
|
||||
MOVL BX, bx-4(SP)
|
||||
MOVL BP, bp-8(SP)
|
||||
|
@ -339,7 +339,7 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
|
||||
RET
|
||||
|
||||
// Called using C ABI.
|
||||
TEXT runtime·sigtramp(SB),NOSPLIT,$0
|
||||
TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME,$0
|
||||
// Transition from C ABI to Go ABI.
|
||||
PUSH_REGS_HOST_TO_ABI0()
|
||||
|
||||
|
@ -566,7 +566,7 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-16
|
||||
MOVW R4, R13
|
||||
RET
|
||||
|
||||
TEXT runtime·sigtramp(SB),NOSPLIT,$0
|
||||
TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME,$0
|
||||
// Reserve space for callee-save registers and arguments.
|
||||
MOVM.DB.W [R4-R11], (R13)
|
||||
SUB $16, R13
|
||||
|
@ -445,7 +445,7 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
|
||||
RET
|
||||
|
||||
// Called from c-abi, R0: sig, R1: info, R2: cxt
|
||||
TEXT runtime·sigtramp(SB),NOSPLIT,$176
|
||||
TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME,$176
|
||||
// Save callee-save registers in the case of signal forwarding.
|
||||
// Please refer to https://golang.org/issue/31827 .
|
||||
SAVE_R19_TO_R28(8*4)
|
||||
|
@ -405,7 +405,7 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
|
||||
JAL (R25)
|
||||
RET
|
||||
|
||||
TEXT runtime·sigtramp(SB),NOSPLIT,$64
|
||||
TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME,$64
|
||||
// initialize REGSB = PC&0xffffffff00000000
|
||||
BGEZAL R0, 1(PC)
|
||||
SRLV $32, R31, RSB
|
||||
|
@ -311,7 +311,7 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-16
|
||||
MOVW R22, R29
|
||||
RET
|
||||
|
||||
TEXT runtime·sigtramp(SB),NOSPLIT,$12
|
||||
TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME,$12
|
||||
// this might be called in external code context,
|
||||
// where g is not set.
|
||||
MOVB runtime·iscgo(SB), R1
|
||||
|
@ -459,7 +459,7 @@ TEXT runtime·sigtramp(SB),NOSPLIT|NOFRAME,$0
|
||||
DWORD $sigtramp<>(SB)
|
||||
DWORD $0
|
||||
DWORD $0
|
||||
TEXT sigtramp<>(SB),NOSPLIT|NOFRAME,$0
|
||||
TEXT sigtramp<>(SB),NOSPLIT|NOFRAME|TOPFRAME,$0
|
||||
#endif
|
||||
// Start with standard C stack frame layout and linkage.
|
||||
MOVD LR, R0
|
||||
|
@ -417,7 +417,7 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
|
||||
RET
|
||||
|
||||
// func sigtramp(signo, ureg, ctxt unsafe.Pointer)
|
||||
TEXT runtime·sigtramp(SB),NOSPLIT,$64
|
||||
TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME,$64
|
||||
MOVW A0, 8(X2)
|
||||
MOV A1, 16(X2)
|
||||
MOV A2, 24(X2)
|
||||
|
@ -272,7 +272,7 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
|
||||
TEXT runtime·sigreturn(SB),NOSPLIT,$0-0
|
||||
RET
|
||||
|
||||
TEXT runtime·sigtramp(SB),NOSPLIT,$64
|
||||
TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME,$64
|
||||
// initialize essential registers (just in case)
|
||||
XOR R0, R0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user