26 #include "runtime/arguments.hpp" |
26 #include "runtime/arguments.hpp" |
27 #include "runtime/os.hpp" |
27 #include "runtime/os.hpp" |
28 #include "runtime/thread.hpp" |
28 #include "runtime/thread.hpp" |
29 #include "utilities/vmError.hpp" |
29 #include "utilities/vmError.hpp" |
30 |
30 |
31 |
|
32 void VMError::show_message_box(char *buf, int buflen) { |
|
33 bool yes; |
|
34 do { |
|
35 error_string(buf, buflen); |
|
36 int len = (int)strlen(buf); |
|
37 char *p = &buf[len]; |
|
38 |
|
39 jio_snprintf(p, buflen - len, |
|
40 "\n\n" |
|
41 "Do you want to debug the problem?\n\n" |
|
42 "To debug, attach Visual Studio to process %d; then switch to thread 0x%x\n" |
|
43 "Select 'Yes' to launch Visual Studio automatically (PATH must include msdev)\n" |
|
44 "Otherwise, select 'No' to abort...", |
|
45 os::current_process_id(), os::current_thread_id()); |
|
46 |
|
47 yes = os::message_box("Unexpected Error", buf) != 0; |
|
48 |
|
49 if (yes) { |
|
50 // yes, user asked VM to launch debugger |
|
51 // |
|
52 // os::breakpoint() calls DebugBreak(), which causes a breakpoint |
|
53 // exception. If VM is running inside a debugger, the debugger will |
|
54 // catch the exception. Otherwise, the breakpoint exception will reach |
|
55 // the default windows exception handler, which can spawn a debugger and |
|
56 // automatically attach to the dying VM. |
|
57 os::breakpoint(); |
|
58 yes = false; |
|
59 } |
|
60 } while (yes); |
|
61 } |
|
62 |
|
63 int VMError::get_resetted_sigflags(int sig) { |
31 int VMError::get_resetted_sigflags(int sig) { |
64 return -1; |
32 return -1; |
65 } |
33 } |
66 |
34 |
67 address VMError::get_resetted_sighandler(int sig) { |
35 address VMError::get_resetted_sighandler(int sig) { |