src/share/vm/utilities/vmError.cpp

Print this page




 488                    Abstract_VM_Version::vm_name(),
 489                    Abstract_VM_Version::vm_release(),
 490                    Abstract_VM_Version::vm_info_string(),
 491                    Abstract_VM_Version::vm_platform_string(),
 492                    UseCompressedOops ? "compressed oops" : ""
 493                  );
 494 
 495   STEP(60, "(printing problematic frame)")
 496 
 497      // Print current frame if we have a context (i.e. it's a crash)
 498      if (_context) {
 499        st->print_cr("# Problematic frame:");
 500        st->print("# ");
 501        frame fr = os::fetch_frame_from_context(_context);
 502        fr.print_on_error(st, buf, sizeof(buf));
 503        st->cr();
 504        st->print_cr("#");
 505      }
 506   STEP(63, "(printing core file information)")
 507     st->print("# ");

 508     if (coredump_status) {
 509       st->print("Core dump written. Default location: %s", coredump_message);
 510     } else {
 511       st->print("Failed to write core dump. %s", coredump_message);
 512     }



 513     st->cr();
 514     st->print_cr("#");
 515 
 516   STEP(65, "(printing bug submit message)")
 517 
 518      if (should_report_bug(_id) && _verbose) {
 519        print_bug_submit_message(st, _thread);
 520      }
 521 
 522   STEP(70, "(printing thread)" )
 523 
 524      if (_verbose) {
 525        st->cr();
 526        st->print_cr("---------------  T H R E A D  ---------------");
 527        st->cr();
 528      }
 529 
 530   STEP(80, "(printing current thread)" )
 531 
 532      // current thread


 881      }
 882    }
 883 
 884   return fd;
 885 }
 886 
 887 void VMError::report_and_die() {
 888   // Don't allocate large buffer on stack
 889   static char buffer[O_BUFLEN];
 890 
 891   // How many errors occurred in error handler when reporting first_error.
 892   static int recursive_error_count;
 893 
 894   // We will first print a brief message to standard out (verbose = false),
 895   // then save detailed information in log file (verbose = true).
 896   static bool out_done = false;         // done printing to standard out
 897   static bool log_done = false;         // done saving error log
 898   static bool transmit_report_done = false; // done error reporting
 899 
 900   if (SuppressFatalErrorMessage) {
 901       os::abort();
 902   }
 903   jlong mytid = os::current_thread_id();
 904   if (first_error == NULL &&
 905       Atomic::cmpxchg_ptr(this, &first_error, NULL) == NULL) {
 906 
 907     // first time
 908     first_error_tid = mytid;
 909     set_error_reported();
 910 
 911     if (ShowMessageBoxOnError || PauseAtExit) {
 912       show_message_box(buffer, sizeof(buffer));
 913 
 914       // User has asked JVM to abort. Reset ShowMessageBoxOnError so the
 915       // WatcherThread can kill JVM if the error handler hangs.
 916       ShowMessageBoxOnError = false;
 917     }
 918 
 919     // Write a minidump on Windows, check core dump limits on Linux/Solaris
 920     os::check_or_create_dump(_siginfo, _context, buffer, sizeof(buffer));
 921 


1071           out.print_raw_cr(strerror(os::get_last_error()));
1072         }
1073       }
1074     }
1075   }
1076 
1077   static bool skip_bug_url = !should_report_bug(first_error->_id);
1078   if (!skip_bug_url) {
1079     skip_bug_url = true;
1080 
1081     out.print_raw_cr("#");
1082     print_bug_submit_message(&out, _thread);
1083   }
1084 
1085   if (!UseOSErrorReporting) {
1086     // os::abort() will call abort hooks, try it first.
1087     static bool skip_os_abort = false;
1088     if (!skip_os_abort) {
1089       skip_os_abort = true;
1090       bool dump_core = should_report_bug(first_error->_id);
1091       os::abort(dump_core);
1092     }
1093 
1094     // if os::abort() doesn't abort, try os::die();
1095     os::die();
1096   }
1097 }
1098 
1099 /*
1100  * OnOutOfMemoryError scripts/commands executed while VM is a safepoint - this
1101  * ensures utilities such as jmap can observe the process is a consistent state.
1102  */
1103 class VM_ReportJavaOutOfMemory : public VM_Operation {
1104  private:
1105   VMError *_err;
1106  public:
1107   VM_ReportJavaOutOfMemory(VMError *err) { _err = err; }
1108   VMOp_Type type() const                 { return VMOp_ReportJavaOutOfMemory; }
1109   void doit();
1110 };
1111 




 488                    Abstract_VM_Version::vm_name(),
 489                    Abstract_VM_Version::vm_release(),
 490                    Abstract_VM_Version::vm_info_string(),
 491                    Abstract_VM_Version::vm_platform_string(),
 492                    UseCompressedOops ? "compressed oops" : ""
 493                  );
 494 
 495   STEP(60, "(printing problematic frame)")
 496 
 497      // Print current frame if we have a context (i.e. it's a crash)
 498      if (_context) {
 499        st->print_cr("# Problematic frame:");
 500        st->print("# ");
 501        frame fr = os::fetch_frame_from_context(_context);
 502        fr.print_on_error(st, buf, sizeof(buf));
 503        st->cr();
 504        st->print_cr("#");
 505      }
 506   STEP(63, "(printing core file information)")
 507     st->print("# ");
 508     if (CreateCoredumpOnCrash) {
 509       if (coredump_status) {
 510         st->print("Core dump written. Default location: %s", coredump_message);
 511       } else {
 512         st->print("Failed to write core dump. %s", coredump_message);
 513       }
 514     } else {
 515       st->print("CreateCoredumpOnCrash turned off, no core file dumped");
 516     }
 517     st->cr();
 518     st->print_cr("#");
 519 
 520   STEP(65, "(printing bug submit message)")
 521 
 522      if (should_report_bug(_id) && _verbose) {
 523        print_bug_submit_message(st, _thread);
 524      }
 525 
 526   STEP(70, "(printing thread)" )
 527 
 528      if (_verbose) {
 529        st->cr();
 530        st->print_cr("---------------  T H R E A D  ---------------");
 531        st->cr();
 532      }
 533 
 534   STEP(80, "(printing current thread)" )
 535 
 536      // current thread


 885      }
 886    }
 887 
 888   return fd;
 889 }
 890 
 891 void VMError::report_and_die() {
 892   // Don't allocate large buffer on stack
 893   static char buffer[O_BUFLEN];
 894 
 895   // How many errors occurred in error handler when reporting first_error.
 896   static int recursive_error_count;
 897 
 898   // We will first print a brief message to standard out (verbose = false),
 899   // then save detailed information in log file (verbose = true).
 900   static bool out_done = false;         // done printing to standard out
 901   static bool log_done = false;         // done saving error log
 902   static bool transmit_report_done = false; // done error reporting
 903 
 904   if (SuppressFatalErrorMessage) {
 905       os::abort(CreateCoredumpOnCrash);
 906   }
 907   jlong mytid = os::current_thread_id();
 908   if (first_error == NULL &&
 909       Atomic::cmpxchg_ptr(this, &first_error, NULL) == NULL) {
 910 
 911     // first time
 912     first_error_tid = mytid;
 913     set_error_reported();
 914 
 915     if (ShowMessageBoxOnError || PauseAtExit) {
 916       show_message_box(buffer, sizeof(buffer));
 917 
 918       // User has asked JVM to abort. Reset ShowMessageBoxOnError so the
 919       // WatcherThread can kill JVM if the error handler hangs.
 920       ShowMessageBoxOnError = false;
 921     }
 922 
 923     // Write a minidump on Windows, check core dump limits on Linux/Solaris
 924     os::check_or_create_dump(_siginfo, _context, buffer, sizeof(buffer));
 925 


1075           out.print_raw_cr(strerror(os::get_last_error()));
1076         }
1077       }
1078     }
1079   }
1080 
1081   static bool skip_bug_url = !should_report_bug(first_error->_id);
1082   if (!skip_bug_url) {
1083     skip_bug_url = true;
1084 
1085     out.print_raw_cr("#");
1086     print_bug_submit_message(&out, _thread);
1087   }
1088 
1089   if (!UseOSErrorReporting) {
1090     // os::abort() will call abort hooks, try it first.
1091     static bool skip_os_abort = false;
1092     if (!skip_os_abort) {
1093       skip_os_abort = true;
1094       bool dump_core = should_report_bug(first_error->_id);
1095       os::abort(dump_core && CreateCoredumpOnCrash);
1096     }
1097 
1098     // if os::abort() doesn't abort, try os::die();
1099     os::die();
1100   }
1101 }
1102 
1103 /*
1104  * OnOutOfMemoryError scripts/commands executed while VM is a safepoint - this
1105  * ensures utilities such as jmap can observe the process is a consistent state.
1106  */
1107 class VM_ReportJavaOutOfMemory : public VM_Operation {
1108  private:
1109   VMError *_err;
1110  public:
1111   VM_ReportJavaOutOfMemory(VMError *err) { _err = err; }
1112   VMOp_Type type() const                 { return VMOp_ReportJavaOutOfMemory; }
1113   void doit();
1114 };
1115