mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: add test for signalM
For #10958, #24543. Change-Id: Ib009a83fe02bc623894f4908fe8f6b266382ba95 Reviewed-on: https://go-review.googlesource.com/c/go/+/201404 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
42aab4b0af
commit
8dc1a158e4
3 changed files with 82 additions and 3 deletions
|
|
@ -412,10 +412,11 @@ func adjustSignalStack(sig uint32, mp *m, gsigStack *gsignalStack) bool {
|
|||
// GOTRACEBACK=crash when a signal is received.
|
||||
var crashing int32
|
||||
|
||||
// testSigtrap is used by the runtime tests. If non-nil, it is called
|
||||
// on SIGTRAP. If it returns true, the normal behavior on SIGTRAP is
|
||||
// suppressed.
|
||||
// testSigtrap and testSigusr1 are used by the runtime tests. If
|
||||
// non-nil, it is called on SIGTRAP/SIGUSR1. If it returns true, the
|
||||
// normal behavior on this signal is suppressed.
|
||||
var testSigtrap func(info *siginfo, ctxt *sigctxt, gp *g) bool
|
||||
var testSigusr1 func(gp *g) bool
|
||||
|
||||
// sighandler is invoked when a signal occurs. The global g will be
|
||||
// set to a gsignal goroutine and we will be running on the alternate
|
||||
|
|
@ -441,6 +442,10 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) {
|
|||
return
|
||||
}
|
||||
|
||||
if sig == _SIGUSR1 && testSigusr1 != nil && testSigusr1(gp) {
|
||||
return
|
||||
}
|
||||
|
||||
flags := int32(_SigThrow)
|
||||
if sig < uint32(len(sigtable)) {
|
||||
flags = sigtable[sig].flags
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue