]> Cypherpunks repositories - gostls13.git/commit
runtime/cgo: catch EXC_BAD_ACCESS on darwin/arm
authorDavid Crawshaw <crawshaw@golang.org>
Sun, 8 Mar 2015 15:37:02 +0000 (11:37 -0400)
committerDavid Crawshaw <crawshaw@golang.org>
Tue, 17 Mar 2015 12:12:48 +0000 (12:12 +0000)
commit1b49a86ecece3978ceba60c372327b9cbcc68501
treecec7efed39acac32ac8161eb2b241a45d09c0fb4
parent1f3fe910664069a94acdbd27d2ba3e6f5b256dbe
runtime/cgo: catch EXC_BAD_ACCESS on darwin/arm

The Go builders (and standard development cycle) for programs on iOS
require running the programs under lldb. Unfortunately lldb intercepts
SIGSEGV and will not give it back.

https://llvm.org/bugs/show_bug.cgi?id=22868

We get around this by never letting lldb see the SIGSEGV. On darwin,
Unix signals are emulated on top of mach exceptions. The debugger
registers a task-level mach exception handler. We register a
thread-level exception handler which acts as a faux signal handler.
The thread-level handler gets precedence over the task-level handler,
so we can turn the exception EXC_BAD_ACCESS into a panic before lldb
can see it.

Fixes #10043

Change-Id: I64d7c310dfa7ecf60eb1e59f094966520d473335
Reviewed-on: https://go-review.googlesource.com/7072
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
src/runtime/cgo/gcc_darwin_arm.c
src/runtime/cgo/gcc_signal_darwin_armx.c [new file with mode: 0644]
src/runtime/cgo/gcc_signal_darwin_lldb.c [new file with mode: 0644]
src/runtime/cgo/libcgo.h
src/runtime/cgo/signal_darwin_arm.s [new file with mode: 0644]
src/runtime/cgo/signal_darwin_armx.go [new file with mode: 0644]
src/runtime/sigpanic_unix.go