hotspot/src/os/linux/vm/os_linux.cpp
changeset 34305 e399e6b44631
parent 34145 f8097485b483
child 34621 7676bec20997
equal deleted inserted replaced
34234:e4a23d294f48 34305:e399e6b44631
  4968 }
  4968 }
  4969 
  4969 
  4970 void os::print_statistics() {
  4970 void os::print_statistics() {
  4971 }
  4971 }
  4972 
  4972 
  4973 int os::message_box(const char* title, const char* message) {
  4973 bool os::message_box(const char* title, const char* message) {
  4974   int i;
  4974   int i;
  4975   fdStream err(defaultStream::error_fd());
  4975   fdStream err(defaultStream::error_fd());
  4976   for (i = 0; i < 78; i++) err.print_raw("=");
  4976   for (i = 0; i < 78; i++) err.print_raw("=");
  4977   err.cr();
  4977   err.cr();
  4978   err.print_raw_cr(title);
  4978   err.print_raw_cr(title);
  5993   }
  5993   }
  5994 
  5994 
  5995   return strlen(buffer);
  5995   return strlen(buffer);
  5996 }
  5996 }
  5997 
  5997 
       
  5998 bool os::start_debugging(char *buf, int buflen) {
       
  5999   int len = (int)strlen(buf);
       
  6000   char *p = &buf[len];
       
  6001 
       
  6002   jio_snprintf(p, buflen-len,
       
  6003              "\n\n"
       
  6004              "Do you want to debug the problem?\n\n"
       
  6005              "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " UINTX_FORMAT " (" INTPTR_FORMAT ")\n"
       
  6006              "Enter 'yes' to launch gdb automatically (PATH must include gdb)\n"
       
  6007              "Otherwise, press RETURN to abort...",
       
  6008              os::current_process_id(), os::current_process_id(),
       
  6009              os::current_thread_id(), os::current_thread_id());
       
  6010 
       
  6011   bool yes = os::message_box("Unexpected Error", buf);
       
  6012 
       
  6013   if (yes) {
       
  6014     // yes, user asked VM to launch debugger
       
  6015     jio_snprintf(buf, sizeof(buf), "gdb /proc/%d/exe %d",
       
  6016                      os::current_process_id(), os::current_process_id());
       
  6017 
       
  6018     os::fork_and_exec(buf);
       
  6019     yes = false;
       
  6020   }
       
  6021   return yes;
       
  6022 }
       
  6023 
       
  6024 
       
  6025 
  5998 /////////////// Unit tests ///////////////
  6026 /////////////// Unit tests ///////////////
  5999 
  6027 
  6000 #ifndef PRODUCT
  6028 #ifndef PRODUCT
  6001 
  6029 
  6002 #define test_log(...)              \
  6030 #define test_log(...)              \