How to native debug Java on macOS?
chris.plummer at oracle.com
Tue Sep 10 19:52:06 UTC 2019
On 9/9/19 9:57 AM, Alexander Miloslavskiy wrote:
>> Have you tried putting these two lines in your ~/.lldbinit file?
>> process handle -s false SIGSEGV
>> process handle -s false SIGBUS
> Hmm, these seem to work...
> Previously, on two different occasions, I spent a couple hours trying
> to get LLDB to work, also trying these very same commands, but failed.
> Back then I was stuck on EXC_BAD_ACCESS, from which I couldn't
> continue - it simply reoccurred again.
> However, this time it works. If for example I run these:
> process handle --pass true --stop false SIGSEGV
> process handle --pass true --stop false SIGBUS
> Then LLDB successfully skips all exceptions and my application runs as
> intended. Not sure why I was blocked previously.
I went down this path last week and never did get it working, even with
the above, so I'm not sure why it is suddenly working for you. I'm on
xcode 10.2.1. Maybe 10.3 fixes this.
The lldb handling of EXC_BAD_ACCESS seems to be a known issue. lldb
processes the EXC_BAD_ACCESS, not allowing it to eventually be consumed
and converted to a SIGSEGV or SIGBUS (I assume the pthread library does
this). Thus it never even gets to the part of lldb that cares that you
did a "process handle" for SIGSEGV. Here's one case in point of a user
running into this problem:
And bugs filed:
The only solution I've found is to run with -Xint.
And two things to consider with the "process handle" commands. The first
is it only impacts the current process. When you relaunch you need to
execute them again. This brings us to the second issue which is putting
"process handle" commands in your .lldbinit is pointless since you don't
even have a process at that point.
More information about the hotspot-dev