I was having this talk with BobV and he has a trick in the ppc port that I
think should be done for all the ports.
We currently have an assembler routine on x86 int3() and breakpoint_trap() on sparc.
The int3 works well ok on windows where the debugger doesn't seem upset about finding
a breakpoint it set in the code and it allows you to continue. The same is not
true on linux/solaris where the debuggers don't like it and it is painful at
best to use them. As a result the assembler "breakpoints" on those systems generate
code that attempts to save all registers and then call os::breakpoint. This sort of
mostly works but often it can not precisely save the state (think condition codes
at the very least) besides being a large amount of code.
On ppc Bob has this assembler routine generate a recognizable illegal instruction. Then
the signal handler is modified to recognize this specific instruction and automatically
advance the pc over the illegal and continue. In order to get the stop in the
debugger it can call os::breakpoint before it does the advancing. This is a much
better approach for solaris and linux and because signal handlers by design automatically
save and restore the current state of the thread no code is needed to do this (and
even better that code doesn't bit rot). We should institute this as the way of
doing this in the vm.
think should be done for all the ports.
We currently have an assembler routine on x86 int3() and breakpoint_trap() on sparc.
The int3 works well ok on windows where the debugger doesn't seem upset about finding
a breakpoint it set in the code and it allows you to continue. The same is not
true on linux/solaris where the debuggers don't like it and it is painful at
best to use them. As a result the assembler "breakpoints" on those systems generate
code that attempts to save all registers and then call os::breakpoint. This sort of
mostly works but often it can not precisely save the state (think condition codes
at the very least) besides being a large amount of code.
On ppc Bob has this assembler routine generate a recognizable illegal instruction. Then
the signal handler is modified to recognize this specific instruction and automatically
advance the pc over the illegal and continue. In order to get the stop in the
debugger it can call os::breakpoint before it does the advancing. This is a much
better approach for solaris and linux and because signal handlers by design automatically
save and restore the current state of the thread no code is needed to do this (and
even better that code doesn't bit rot). We should institute this as the way of
doing this in the vm.