mirror of
https://github.com/golang/go
synced 2024-10-06 08:00:07 +00:00
runtime: tricky replacements of _g_ in signal_windows.go
winthrow is always called on g0. Change-Id: Ia23276a5bd545993faf4d75368c171f6ea7a3034 Reviewed-on: https://go-review.googlesource.com/c/go/+/418581 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Pratt <mpratt@google.com> Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
parent
8666d89ca8
commit
4240ff764b
|
@ -199,9 +199,10 @@ func lastcontinuehandler(info *exceptionrecord, r *context, gp *g) int32 {
|
||||||
return 0 // not reached
|
return 0 // not reached
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Always called on g0. gp is the G where the exception occurred.
|
||||||
//go:nosplit
|
//go:nosplit
|
||||||
func winthrow(info *exceptionrecord, r *context, gp *g) {
|
func winthrow(info *exceptionrecord, r *context, gp *g) {
|
||||||
_g_ := getg()
|
g0 := getg()
|
||||||
|
|
||||||
if panicking != 0 { // traceback already printed
|
if panicking != 0 { // traceback already printed
|
||||||
exit(2)
|
exit(2)
|
||||||
|
@ -211,23 +212,23 @@ func winthrow(info *exceptionrecord, r *context, gp *g) {
|
||||||
// In case we're handling a g0 stack overflow, blow away the
|
// In case we're handling a g0 stack overflow, blow away the
|
||||||
// g0 stack bounds so we have room to print the traceback. If
|
// g0 stack bounds so we have room to print the traceback. If
|
||||||
// this somehow overflows the stack, the OS will trap it.
|
// this somehow overflows the stack, the OS will trap it.
|
||||||
_g_.stack.lo = 0
|
g0.stack.lo = 0
|
||||||
_g_.stackguard0 = _g_.stack.lo + _StackGuard
|
g0.stackguard0 = g0.stack.lo + _StackGuard
|
||||||
_g_.stackguard1 = _g_.stackguard0
|
g0.stackguard1 = g0.stackguard0
|
||||||
|
|
||||||
print("Exception ", hex(info.exceptioncode), " ", hex(info.exceptioninformation[0]), " ", hex(info.exceptioninformation[1]), " ", hex(r.ip()), "\n")
|
print("Exception ", hex(info.exceptioncode), " ", hex(info.exceptioninformation[0]), " ", hex(info.exceptioninformation[1]), " ", hex(r.ip()), "\n")
|
||||||
|
|
||||||
print("PC=", hex(r.ip()), "\n")
|
print("PC=", hex(r.ip()), "\n")
|
||||||
if _g_.m.incgo && gp == _g_.m.g0 && _g_.m.curg != nil {
|
if g0.m.incgo && gp == g0.m.g0 && g0.m.curg != nil {
|
||||||
if iscgo {
|
if iscgo {
|
||||||
print("signal arrived during external code execution\n")
|
print("signal arrived during external code execution\n")
|
||||||
}
|
}
|
||||||
gp = _g_.m.curg
|
gp = g0.m.curg
|
||||||
}
|
}
|
||||||
print("\n")
|
print("\n")
|
||||||
|
|
||||||
_g_.m.throwing = throwTypeRuntime
|
g0.m.throwing = throwTypeRuntime
|
||||||
_g_.m.caughtsig.set(gp)
|
g0.m.caughtsig.set(gp)
|
||||||
|
|
||||||
level, _, docrash := gotraceback()
|
level, _, docrash := gotraceback()
|
||||||
if level > 0 {
|
if level > 0 {
|
||||||
|
|
Loading…
Reference in a new issue