runtime: refactor test for pushing sigpanic frame
This logic is duplicated in all of the preparePanic functions. Pull it
out into one architecture-independent function.
Change-Id: I7ef4e78e3eda0b7be1a480fb5245fc7424fb2b4e
Reviewed-on: https://go-review.googlesource.com/91255
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/src/runtime/signal_mipsx.go b/src/runtime/signal_mipsx.go
index 1c545ec..e223c28 100644
--- a/src/runtime/signal_mipsx.go
+++ b/src/runtime/signal_mipsx.go
@@ -70,18 +70,8 @@
pc := gp.sigpc
- // If we don't recognize the PC as code
- // but we do recognize the link register as code,
- // then assume this was a call to non-code and treat like
- // pc == 0, to make unwinding show the context.
- if pc != 0 && !findfunc(pc).valid() && findfunc(uintptr(c.link())).valid() {
- pc = 0
- }
-
- // Don't bother saving PC if it's zero, which is
- // probably a call to a nil func: the old link register
- // is more useful in the stack trace.
- if pc != 0 {
+ if shouldPushSigpanic(gp, pc, uintptr(c.link())) {
+ // Make it look the like faulting PC called sigpanic.
c.set_link(uint32(pc))
}