RFR (L): Adding core file parsing on Mac OS X to SA

Kelly O'Hair kelly.ohair at oracle.com
Tue May 8 08:27:00 PDT 2012


On May 8, 2012, at 4:11 AM, 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. 

Keep in mind that a core file usually does not capture the entire process image, shared system library text sections (shared code of the system)
is typically not included, which creates a situation where a core file cannot be transported from the specific system it was created on
and interpreted 100% correctly on any similar system. Unless you can guarantee that the two systems have the exact same system shared libraries.
As far as I know, there is no tracking of this issue, and consequently, core files can only be trusted to be valid on the system that created it.

We had many discussions on this topic when I was in the dbx team. First there is a question of validation, 'how do you know the use of the core file is correct?'
and then how do you get the right information 'can we access the shared libraries of the system that created the core file?'

So be careful with core files, even as big as they are, there is missing information, and they become less and less accurate as
you drift away from the system that created it.

Having given you my warning on core files....  It has been a long time since I used libelf and walked around Elf files,
now you have me curious what this Java code looks like.  It is an interesting idea/approach.

-kto

> 
> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20120508/4c7f8fc9/attachment.html 


More information about the serviceability-dev mailing list