When you debug native core dumps, you may have asked your customer for the matching shared objects [or DLLs]. This is because text (a.k.a "code") pages are not dumped into core dump in most operating systems [although you could configure any page to be dumped into core on Solaris 10+]
In JVM, the equivalent of "text" section is the JVM internal data structures created by parsing the loaded .class files. Such data structures are stored in an area of the Java heap called "permanent generation". Because the Java heap is included into the core dumps, it should be possible to access these from Java core dumps. If so, how about reconstructing .class files from core dumps? As it turns out, there is already a tool to do exactly that!
HotSpot Serviceability Agent (SA) is a postmortem/snapshot debugger for HotSpot Java Virtual Machine. SA has a number of tools that are not bundled with JDK/JRE. But, now that HotSpot JVM is a open source, you can look/modify/build HotSpot SA. HotSpot SA lives under the
$HOTSPOT/agent directory. There are tools under
$HOTSPOT/agent/make directory. To use the SA tools, you need to build SA. There is a gnumake file for SA under
After building HotSpot SA, you can run any of the tools under
$HOTSPOT/agent/make. There are shell scripts the SA tools -
jcoreproc.sh is the tool to retrieve .class files from core dumps. There is another tool called
clhsdbproc.sh that supports dbx/gdb like command line interface. This tool supports
dumpclass command to retrieve .class files from core dump. There is some documentation of SA tools under
$HOTSPOT/agent/doc directory. Happy core dump debugging!