By Poonam-Oracle on Dec 27, 2008
User Mode Process Dumper
There is another very good tool 'User Mode Process Dumper' that can be used to collect user dumps for crashing Java processes.
You can get it and install it from here:
After installation, run it from the Control Panel by clicking 'Process Dumper'. Add the application name to be monitored; java.exe in our case.
Set the process monitoring rules by clicking on 'Rules' button.
Here, specify the folder where dump should get created when the process crashes. Select 'Access Violation' exception to create dump when any access violation exception happens in the process.
Now, let's run the same test program.
You will see this message box creating the crash dump.
And then a hs_err log file will also be written:
# A fatal error has been detected by the Java Runtime Environment:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x10001032, pid=8112, tid=6788
# Java VM: OpenJDK Client VM (14.0-b05-internal-debug mixed mode windows-x86 )
# Problematic frame:
# C [test.dll+0x1032]
# An error report file with more information is saved as:
# If you would like to submit a bug report, please visit:
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
So using this tool, we get both the crash dump as well as the hs_err log file for the crash. :) And the crash dump thus created shows the crash in test.f() native method.
OnError JVM option
There is a JVM option 'OnError' that can be used to perform any action or invoke any tool at the occurrence of fatal error in VM.
-XX:OnError="drwtsn32 -p %p"
-XX:OnError=”userdump -p %p”
This will invoke drwtsn32/userdump whenever any fatal error occurs in VM.
UseOSErrorReporting JVM option
There is a new option UseOSErrorReporting in jdk7 that passes the exception to OS after handling and generating hs_err log file which invokes the Default System Debugger. So for example, If Dr. Watson is set as the default debugger, then with this option, after hs_err file is written, Dr. Watson would be invoked to create the crash dump for the exception.
This work is done under CR 6227246: Improve Windows unhandled structured exception reporting