6043 return -1; |
6044 return -1; |
6044 } |
6045 } |
6045 |
6046 |
6046 if (core_pattern[0] == '|') { |
6047 if (core_pattern[0] == '|') { |
6047 written = jio_snprintf(buffer, bufferSize, |
6048 written = jio_snprintf(buffer, bufferSize, |
6048 "\"%s\" (or dumping to %s/core.%d)", |
6049 "\"%s\" (or dumping to %s/core.%d)", |
6049 &core_pattern[1], p, current_process_id()); |
6050 &core_pattern[1], p, current_process_id()); |
6050 } else { |
6051 } else { |
6051 written = jio_snprintf(buffer, bufferSize, "%s/%s", p, core_pattern); |
6052 written = jio_snprintf(buffer, bufferSize, "%s/%s", p, core_pattern); |
6052 } |
6053 } |
6053 } |
6054 } |
6054 |
6055 |
6077 bool os::start_debugging(char *buf, int buflen) { |
6078 bool os::start_debugging(char *buf, int buflen) { |
6078 int len = (int)strlen(buf); |
6079 int len = (int)strlen(buf); |
6079 char *p = &buf[len]; |
6080 char *p = &buf[len]; |
6080 |
6081 |
6081 jio_snprintf(p, buflen-len, |
6082 jio_snprintf(p, buflen-len, |
6082 "\n\n" |
6083 "\n\n" |
6083 "Do you want to debug the problem?\n\n" |
6084 "Do you want to debug the problem?\n\n" |
6084 "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " UINTX_FORMAT " (" INTPTR_FORMAT ")\n" |
6085 "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " UINTX_FORMAT " (" INTPTR_FORMAT ")\n" |
6085 "Enter 'yes' to launch gdb automatically (PATH must include gdb)\n" |
6086 "Enter 'yes' to launch gdb automatically (PATH must include gdb)\n" |
6086 "Otherwise, press RETURN to abort...", |
6087 "Otherwise, press RETURN to abort...", |
6087 os::current_process_id(), os::current_process_id(), |
6088 os::current_process_id(), os::current_process_id(), |
6088 os::current_thread_id(), os::current_thread_id()); |
6089 os::current_thread_id(), os::current_thread_id()); |
6089 |
6090 |
6090 bool yes = os::message_box("Unexpected Error", buf); |
6091 bool yes = os::message_box("Unexpected Error", buf); |
6091 |
6092 |
6092 if (yes) { |
6093 if (yes) { |
6093 // yes, user asked VM to launch debugger |
6094 // yes, user asked VM to launch debugger |
6094 jio_snprintf(buf, sizeof(buf), "gdb /proc/%d/exe %d", |
6095 jio_snprintf(buf, sizeof(char)*buflen, "gdb /proc/%d/exe %d", |
6095 os::current_process_id(), os::current_process_id()); |
6096 os::current_process_id(), os::current_process_id()); |
6096 |
6097 |
6097 os::fork_and_exec(buf); |
6098 os::fork_and_exec(buf); |
6098 yes = false; |
6099 yes = false; |
6099 } |
6100 } |
6100 return yes; |
6101 return yes; |