]> git.ipfire.org Git - thirdparty/gcc.git/commit
runtime: add precise stack scan support
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 5 Dec 2018 23:09:51 +0000 (23:09 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 5 Dec 2018 23:09:51 +0000 (23:09 +0000)
commitdbf8e8e9c8d43a90e2649fca4f8b396d36c7b584
treedf5d750d82dff84b98ec03163cc8c2b2552a559a
parent16706a2e487b6cca44b65c13a9008eb20c2be345
runtime: add precise stack scan support

    This CL adds support of precise stack scan using stack maps to
    the runtime. The stack maps are generated by the compiler (if
    supported). Each safepoint is associated with a (real or dummy)
    landing pad, and its "type info" in the exception table is a
    pointer to the stack map. When a stack is scanned, the stack map
    is found by the stack unwinding code by inspecting the exception
    table (LSDA).

    For precise stack scan we need to unwind the stack. There are
    three cases:

    - If a goroutine is scanning its own stack, it can unwind the
      stack and scan the frames.

    - If a goroutine is scanning another, stopped, goroutine, it
      cannot directly unwind the target stack. We handle this by
      switching (runtime.gogo) to the target g, letting it unwind
      and scan the stack, and switch back.

    - If we are scanning a goroutine that is blocked in a syscall,
      we send a signal to the target goroutine's thread, and let the
      signal handler unwind and scan the stack. Extra care is needed
      as this races with enter/exit syscall.

    Currently this is only implemented on linux.

    Reviewed-on: https://go-review.googlesource.com/c/140518

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266832 138bc75d-0d04-0410-961f-82ee72b054a4
13 files changed:
gcc/go/gofrontend/MERGE
libgo/go/runtime/mgcmark.go
libgo/go/runtime/os_gccgo.go
libgo/go/runtime/proc.go
libgo/go/runtime/runtime2.go
libgo/go/runtime/signal_sighandler.go
libgo/go/runtime/stubs.go
libgo/go/runtime/stubs_linux.go
libgo/go/runtime/stubs_nonlinux.go
libgo/runtime/go-unwind.c
libgo/runtime/proc.c
libgo/runtime/runtime.h
libgo/runtime/stack.c