mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-25 05:45:11 +02:00
8136978: Much nearly duplicated code for vmError support
Moved all non os specific code in vmError_[os].cpp to vmError_posix.cpp, moved os specific code to os_[os].cpp and refactored all other references accordingly Reviewed-by: stuefe, coleenp, dholmes
This commit is contained in:
parent
dcd4a03963
commit
4699c70e25
14 changed files with 202 additions and 480 deletions
|
@ -4970,7 +4970,7 @@ os::os_exception_wrapper(java_call_t f, JavaValue* value, const methodHandle& me
|
|||
void os::print_statistics() {
|
||||
}
|
||||
|
||||
int os::message_box(const char* title, const char* message) {
|
||||
bool os::message_box(const char* title, const char* message) {
|
||||
int i;
|
||||
fdStream err(defaultStream::error_fd());
|
||||
for (i = 0; i < 78; i++) err.print_raw("=");
|
||||
|
@ -5995,6 +5995,34 @@ int os::get_core_path(char* buffer, size_t bufferSize) {
|
|||
return strlen(buffer);
|
||||
}
|
||||
|
||||
bool os::start_debugging(char *buf, int buflen) {
|
||||
int len = (int)strlen(buf);
|
||||
char *p = &buf[len];
|
||||
|
||||
jio_snprintf(p, buflen-len,
|
||||
"\n\n"
|
||||
"Do you want to debug the problem?\n\n"
|
||||
"To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " UINTX_FORMAT " (" INTPTR_FORMAT ")\n"
|
||||
"Enter 'yes' to launch gdb automatically (PATH must include gdb)\n"
|
||||
"Otherwise, press RETURN to abort...",
|
||||
os::current_process_id(), os::current_process_id(),
|
||||
os::current_thread_id(), os::current_thread_id());
|
||||
|
||||
bool yes = os::message_box("Unexpected Error", buf);
|
||||
|
||||
if (yes) {
|
||||
// yes, user asked VM to launch debugger
|
||||
jio_snprintf(buf, sizeof(buf), "gdb /proc/%d/exe %d",
|
||||
os::current_process_id(), os::current_process_id());
|
||||
|
||||
os::fork_and_exec(buf);
|
||||
yes = false;
|
||||
}
|
||||
return yes;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////// Unit tests ///////////////
|
||||
|
||||
#ifndef PRODUCT
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue