runtime: abort stack scan in cases that we cannot unwind the stack
    
    In signal-triggered stack scan, if the signal is delivered at
    certain bad time (e.g. in vdso, or in the middle of setcontext?),
    the unwinder may not be able to unwind the whole stack, while it
    still reports _URC_END_OF_STACK. So we cannot rely on _URC_END_OF_STACK
    to tell if it successfully scanned the stack. Instead, we check
    the last Go frame to see it actually reached the end of the stack.
    For Go-created stack, this is runtime.kickoff. For C-created
    stack, we need to record the outermost Go frame when it enters
    the Go side.
    
    Also we cannot unwind the stack if the signal is delivered in the
    middle of runtime.gogo, halfway through a goroutine switch, where
    the g and the stack don't match. Give up in this case as well.
    
    Reviewed-on: https://go-review.googlesource.com/c/159098


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@269018 138bc75d-0d04-0410-961f-82ee72b054a4
6 files changed