]> Cypherpunks repositories - gostls13.git/commit
runtime: do not stop traceback at onM
authorRuss Cox <rsc@golang.org>
Fri, 5 Sep 2014 02:48:08 +0000 (22:48 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 5 Sep 2014 02:48:08 +0000 (22:48 -0400)
commitd16a2ad09b373efe891f0acf9c27e0f2455e5590
tree982392a217107c0cc840ecf8f752ba328c498f08
parentcf3fd0a55fde7c8bf579bdcab663890404a337c4
runtime: do not stop traceback at onM

Behavior before this CL:

1. If onM is called on a g0 stack, it just calls the given function.

2. If onM is called on a gsignal stack, it calls badonm.

3. If onM is called on a curg stack, it switches to the g0 stack
and then calls the function.

In cases 1 and 2, if the program then crashes (and badonm always does),
we want to see what called onM, but the traceback stops at onM.
In case 3, the traceback must stop at onM, because the g0
stack we are renting really does stop at onM.

The current code stops the traceback at onM to handle 3,
at the cost of making 1 and 2 crash with incomplete traces.

Change traceback to scan past onM but in case 3 make it look
like on the rented g0 stack, onM was called from mstart.
The traceback already knows that mstart is a top-of-stack function.

Alternate fix at CL 132610043 but I think this one is cleaner.
This CL makes 3 the exception, while that CL makes 1 and 2 the exception.

Submitting TBR to try to get better stack traces out of the
freebsd/amd64 builder, but happy to make changes in a
followup CL.

TBR=khr
R=khr
CC=golang-codereviews
https://golang.org/cl/133620043
src/pkg/runtime/asm_386.s
src/pkg/runtime/asm_amd64.s
src/pkg/runtime/asm_arm.s
src/pkg/runtime/traceback.go