RFR (L): Adding core file parsing on Mac OS X to SA
Staffan Larsen
staffan.larsen at oracle.com
Tue May 8 10:28:48 PDT 2012
Good one - I wasn't aware of the ErrorHandlerTest. I agree that duplication of code is not good and perhaps the whitebox API is overkill for the job at hand. I see other tests uses sun.misc.Unsafe to cause crashes which may make more sense than reusing the ErrorHandlerTest since I want Java frames on the stack. On the other hand I can envision expanding the test to check for both Java frames and native C++ frames, in which case neither ErrorHandlerTest or sun.misc.Unsafe works out of the box.
> (and I'm not a Committer, so don't listen to me).
Of course I do.
Ideas are welcome,
/Staffan
On 8 maj 2012, at 17:17, Mikael Gerdin wrote:
> Staffan,
>
> I looked through test makefile changes and the white box test, the changes seem alright but I'm not convinced that using a white box test for this is the best approach.
> There are some existing tests for the error handler and hs_err creation in test_error_handler in debug.cpp (look for use of the ErrorHandlerTest flag)
>
> I realize that this would not work for your test since you use jstack to verify that the SA works and ErrorHandlerTest crashes the VM before any Java frames are on the stack. But it would be great if we could re-use the existing code to force the VM to crash instead of duplicating it.
>
> Anyway, I won't object to the changes in their current state
>
> /mg
>
> On 2012-05-08 13:11, Staffan Larsen wrote:
>> The Serviceability Agent currently has an outage on Mac OS X compared to
>> other platforms in that we cannot read core files. We plan to address
>> this for 7u6 by incorporating code from a separate tool called "kjdb"
>> developed at Oracle. Kjdb is a cross-platform core-file debugger written
>> completely in Java that currently works on ELF (solaris, linux) and
>> Mach-O (mac) core files. Since it is written in Java it can read core
>> files from a different system than the system you are running kjdb on,
>> which is very useful.
>>
>> The alternative to incorporating the kjdb technology would have been to
>> implement this in C as is done for the other platforms, but reusing
>> existing code saves us some trouble. The kjdb debugger backend will
>> automatically be enabled when you are opening a Mach-O core file (or if
>> you explicitly set the -Duse.kjdb property when starting SA).
>>
>> The risks with this is that this is a large addition of relatively new
>> code to SA (around 100 files). It also means that debugging a live
>> process or a core file on OS X will use different debugger backends
>> which may have different behavior and bugs.
>>
>> This change also adds a basic test that creates a core file and uses SA
>> to print the thread dumps in the core. This test runs on all platforms,
>> not just Mac OS X. Other than that test, some level of manual testing
>> has been done with various core files.
>>
>> Please see the webrev at: http://cr.openjdk.java.net/~sla/kjdb/webrev.01/
>>
>> There are quite a number of added files in this webrev, so it's probably
>> best to concentrate on the changes in the existing files.
>>
>> Thanks,
>> /Staffan
More information about the serviceability-dev
mailing list