diff options
| author | Austin Clements <austin@google.com> | 2016-10-13 10:44:57 -0400 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2016-10-17 18:56:09 +0000 |
| commit | 687d9d5d78f8a2d09b2052e73be0c83740e17fda (patch) | |
| tree | d8aa74b0a3aea918b939be3aad6fda4c5d4e0946 /src/runtime/asm_amd64.s | |
| parent | 0ba3c607dfcc90072191375d57c4059be1ae96c7 (diff) | |
| download | go-687d9d5d78f8a2d09b2052e73be0c83740e17fda.tar.xz | |
runtime: print a message on bad morestack
If morestack runs on the g0 or gsignal stack, it currently performs
some abort operation that typically produces a signal (e.g., it does
an INT $3 on x86). This is useful if you're running in a debugger, but
if you're not, the runtime tries to trap this signal, which is likely
to send the program into a deeper spiral of collapse and lead to very
confusing diagnostic output.
Help out people trying to debug without a debugger by making morestack
print an informative message before blowing up.
Change-Id: I2814c64509b137bfe20a00091d8551d18c2c4749
Reviewed-on: https://go-review.googlesource.com/31133
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/asm_amd64.s')
| -rw-r--r-- | src/runtime/asm_amd64.s | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index 8d992188de..34da3bda9f 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -331,13 +331,15 @@ TEXT runtime·morestack(SB),NOSPLIT,$0-0 MOVQ g_m(BX), BX MOVQ m_g0(BX), SI CMPQ g(CX), SI - JNE 2(PC) + JNE 3(PC) + CALL runtime·badmorestackg0(SB) INT $3 // Cannot grow signal stack (m->gsignal). MOVQ m_gsignal(BX), SI CMPQ g(CX), SI - JNE 2(PC) + JNE 3(PC) + CALL runtime·badmorestackgsignal(SB) INT $3 // Called from f. |
