• Ian Lance Taylor's avatar
    runtime: record current PC for SIGPROF on non-Go thread · d03e8b22
    Ian Lance Taylor authored
    If we get a SIGPROF on a non-Go thread, and the program has not called
    runtime.SetCgoTraceback so we have no way to collect a stack trace, then
    record a profile that is just the PC where the signal occurred. That
    will at least point the user to the right area.
    
    Retrieving the PC from the sigctxt in a signal handler on a non-G thread
    required marking a number of trivial sigctxt methods as nosplit, and,
    for extra safety, nowritebarrierrec.
    
    The test shows that the existing test CgoPprofThread test does not test
    the stack trace, just the profile signal. Leaving that for later.
    
    Change-Id: I8f8f3ff09ac099fc9d9df94b5a9d210ffc20c4ab
    Reviewed-on: https://go-review.googlesource.com/30252
    Run-TryBot: Ian Lance Taylor <iant@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarDmitry Vyukov <dvyukov@google.com>
    d03e8b22
crash_cgo_test.go 8.99 KB