[lldb-dev] Not stopping on EXC_BAD_ACCESS
Richard Brooksby
rb at ravenbrook.com
Fri Jul 5 04:45:51 PDT 2013
We are currently working around this problem by registering our own exception port for EXC_BAD_ACCESS using the Mach interface, overriding the debugger's port. The work can be seen here <https://github.com/Ravenbrook/mps-temporary/blob/dev/2013-06-18/macosx-threads/code/protxc.c>.
This makes our system debuggable with LLDB and removes the immediate problem, but I still think there's a flaw here. Mach exceptions don't seem to have much of an interface in LLDB, when they probably ought to have an equivalent interface to signals, allowing "nostop", "pass", etc. options.
I'll take a look into implementing this if I'm able.
On 2013-06-12, at 21:36, Richard Brooksby <rb at ravenbrook.com> wrote:
> Hello all.
>
> I'm working on a memory manager (and garbage collector) that relies on handling hardware protection faults. That means that the programs using the GC will routinely get EXC_BAD_ACCESS faults and I want to handle them programmatically as SIGSEGV signals.
>
> The problem is that LLDB always stops on EXC_BAD_ACCESS and there doesn't seem to be a way to continue on to the sending of a SIGSEGV and then into my exception handler. Since I expect to have thousands of protection faults, this pretty much makes my system unworkable in LLDB.
>
> In GDB there is a setting "set dont-handle-bad-access 1" for this. I haven't been able to find an equivalent in LLDB. Also, the bug report I filed with Apple about it is still open.
>
> Apple seem to be withdrawing GDB in Xcode 5, so I've got a problem. Up to now we just recommended using GDB.
>
> I've taken a quick look over the LLDB source code, searched this lists archives, searched the LLVM Bugzilla, and asked around on #llvm, (and of course tried Google, Stackoverflow, and the Apple Dev Forums) but to no avail.
>
> I'm willing to have a go at patching LLDB if someone would give me some pointers. This is a serious problem for us.
>
> Any pointers?
>
>
> References:
>
> - "Developers can't debug MPS on OS X" <http://www.ravenbrook.com/project/mps/issue/job001669/>
>
> - "Passing EXC_BAD_ACCESS in lldb" <https://devforums.apple.com/thread/188993>.
>
> - "Debugging with the Memory Pool System" <https://www.ravenbrook.com/project/mps/master/manual/html/guide/debug.html>
>
> - Apple Bug Report 12176156 and 7838916.
More information about the lldb-dev
mailing list