Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4997835

RFE: crash dump will only be created when running w/ -XX:+ShowMessageBoxOnError

XMLWordPrintable

    • b01
    • x86
    • windows_2000, windows_xp
    • Verified

        Java on Windows will only generate a crash dump, when running with
        -XX:+ShowMessageErrorOnBox. Any other windows application however, will
        create a crash dump upon each and every crash.

        Running Java with -XX:+ShowMessageErrorOnBox does yield a windows dump
        file, however it suppresses the creation of an hs_err_pid.log file. On
        Unix (Solaris and Linux), both a crash dump (core file) and an hs_err_pid.log
        file are generated at one time.

        So, the proposal is:
        Is it possible to get both crash dump and hs_err_pid.log file on Windows
        platforms at one time (possibly without using -XX:+ShowMessageErrorOnBox).
        The crash dump file will be generated depending on Dr Watson being installed.


        Here is an example: Please find attached a complete example.

        It is supposed than Dr Watson is installed.

        1. native testcase
        ------------------
        1.1 Testcase
        ------------
        % more Hello.c

        #include <stdio.h>
        int main() {
          char str1[]="Sample string";
          char * str2= NULL;
          strcpy(str2, str1);
            return;
        }
        %

        1.2. run native testcase
        ------------------------
        It will crash and generate a crash dump.
        Compile with Borland's bcc32 (for example):

        C:> C:\bcc32 -IC:\bcc55\include -LC:\bcc55\include -ehello.exe hello.c
        Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
        Hello.c:
        Warning W8065 Hello.c 10: Call to function 'strcpy' with no prototype in function main
        Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland

        C:>


        C:>hello

        [ hello.exe has generated errors and will be closed by Windows.
          You will need to restart the program.

          An error log is being created.

         [OK]
        ]

        drwtsn32.log and user.dmp has been created.



        C:>more drwtsn32.log

        Microsoft (R) Windows 2000 (TM) Version 5.00 DrWtsn32
        Copyright (C) 1985-1999 Microsoft Corp. All rights reserved.



        Application exception occurred:
                App: (pid=856)
                When: 2/20/2004 @ 13:37:44.542
                Exception number: c0000005 (access violation)

        *----> System Information <----*
                Computer Name: SUN-DE9D5C19522
                User Name: Administrator
                Number of Processors: 1
                Processor Type: x86 Family 15 Model 2 Stepping 7
                Windows 2000 Version: 5.0
                Current Build: 2195
                Service Pack: 3
                Current Type: Uniprocessor Free
                Registered Organization: Sun Microsystems
                Registered Owner: Sun Microsystems

        *----> Task List <----*
        [ ... ]
         856 hello.exe
        C:>


        3. Try a JNI testcase based on the above example
        ------------------------------------------------
        3.1 Compile
        -----------
        C:>make

        C:>set JAVA_HOME=C:\j2sdk1.4.2

        C:>set PATH=C:\bcc55\bin;C:\bcc55\bin;C:\bcc55\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem

        C:>set INCLUDES=-IC:\bcc55\include -IC:\j2sdk1.4.2\include -IC:\j2sdk1.4.2\include\win32

        C:>C:\j2sdk1.4.2\bin\javac HelloWorld.java

        C:>C:\j2sdk1.4.2\bin\javah -jni HelloWorld

        C:>bcc32 -tWD -IC:\bcc55\include -IC:\j2sdk1.4.2\include -IC:\j2sdk1.4.2\include\win32 -LC:\bcc55\lib HelloWorldImp.c
        Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
        HelloWorldImp.c:
        Warning W8065 HelloWorldImp.c 13: Call to function 'strcpy' with no prototype in function Java_HelloWorld_displayHelloWorld
        Warning W8057 HelloWorldImp.c 15: Parameter 'env' is never used in function Java_HelloWorld_displayHelloWorld
        Warning W8057 HelloWorldImp.c 15: Parameter 'obj' is never used in function Java_HelloWorld_displayHelloWorld
        Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland

        C:>


        3.2 Run without -XX:+ShowMessageBoxOnError
        ------------------------------------------

        C:>c:\j2sdk1.4.2\bin\java HelloWorld

        An unexpected exception has been detected in native code outside the VM.
        Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x182
        722BA
        Function=Java_HelloWorld_displayHelloWorld+0x1082
        Library=C:\test\HelloWorldImp.dll
        [ ... ]

         Please note that *no* crash dump file is be created.



        3.3 Run with -XX:+ShowMessageBoxOnError
        ---------------------------------------

        C:>c:\j2sdk1.4.2\bin\java -XX:+ShowMessageBoxOnError HelloWorld

        [ An error has occurred. Do you want to debug the problem ?
          [Yes] [No]
        ]

         Choose "No" and you will get an hs_err_pid.log file.

         Choose "Yes" and you will get:

        [ java.exe has generated errors and will be closed by Windows.
          You will need to restart the program.

          An error log is being created.

         [OK]
        ]

         Both a crash dump file and a drwtsn32.log file will be generated, but *no*
         hs_err_pid.log file.

              coleenp Coleen Phillimore
              thlenz Thomas Lenz (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: