8027429.01 Cdiff src/share/vm/utilities/vmError.cpp (original) (raw)

src/share/vm/utilities/vmError.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8027429.01 Cdiff src/share/vm/utilities/vmError.cpp Print this page


*** 223,232 **** --- 223,259 ---- if (UseConcMarkSweepGC) return "concurrent mark sweep gc"; if (UseSerialGC) return "serial gc"; return "ERROR in GC mode"; }


*** 252,306 **** // thread can report error, so large buffers are statically allocated in data // segment.

int VMError::_current_step; const char* VMError::_current_step_info;

! void VMError::report(outputStream* st, bool _verbose) {

! # define BEGIN if (_current_step == 0) { _current_step = 1; ! # define STEP(n, s) } if (_current_step < n) { _current_step = n; _current_step_info = s; ! # define END }

! // don't allocate large buffer on stack ! static char buf[O_BUFLEN];

BEGIN

! STEP(10, "(printing fatal error message)")

! st->print_cr("#"); ! if (should_report_bug(_id)) { ! st->print_cr("# A fatal error has been detected by the Java Runtime Environment:"); } else { ! st->print_cr("# There is insufficient memory for the Java " ! "Runtime Environment to continue."); }

! #ifndef PRODUCT ! // Error handler self tests

// test secondary error handling. Test it twice, to test that resetting
// error handler after a secondary crash works.
STEP(20, "(test secondary crash 1)")

! if (_verbose && TestCrashInErrorHandler != 0) { st->print_cr("Will crash now (TestCrashInErrorHandler=" UINTX_FORMAT ")...", TestCrashInErrorHandler); controlled_crash(TestCrashInErrorHandler); }

STEP(30, "(test secondary crash 2)")

! if (_verbose && TestCrashInErrorHandler != 0) { st->print_cr("Will crash now (TestCrashInErrorHandler=" UINTX_FORMAT ")...", TestCrashInErrorHandler); controlled_crash(TestCrashInErrorHandler); }

STEP(40, "(test safefetch in error handler)")
  // test whether it is safe to use SafeFetch32 in Crash Handler. Test twice
  // to test that resetting the signal handler works correctly.

! if (_verbose && TestSafeFetchInErrorHandler) { st->print_cr("Will test SafeFetch..."); if (CanUseSafeFetch32()) { int* const invalid_pointer = (int*) get_segfault_address(); const int x = 0x76543210; int i1 = SafeFetch32(invalid_pointer, x); --- 279,492 ---- // thread can report error, so large buffers are statically allocated in data // segment.

int VMError::_current_step; const char* VMError::_current_step_info;

! void VMError::report_summary(outputStream* st, char* buf, int buflen) {

! BEGIN

! // Summary reports are in the 200s. ! STEP(200, "(printing summary)" ) ! ! st->cr(); ! st->print_cr("--------------- S U M M A R Y ------------"); ! st->cr(); ! ! STEP(210, "(printing VM option summary)" ) ! ! // VM options ! Arguments::print_summary_on(st); ! st->cr(); ! ! STEP(220, "(printing summary machine and OS info)") ! ! os::print_summary_info(st, buf, sizeof(buf)); ! ! STEP(230, "(printing date and time)" ) ! ! os::print_date_and_time(st, buf, sizeof(buf)); ! END ! } ! ! void VMError::report_process(outputStream* st, char* buf, int buflen) {

BEGIN

! st->cr(); ! st->print_cr("--------------- P R O C E S S ---------------"); ! st->cr();

! STEP(510, "(printing all threads)" ) ! ! // all threads ! if (_thread) { ! Threads::print_on_error(st, _thread, buf, buflen); ! st->cr(); ! } ! ! STEP(520, "(printing VM state)" ) ! ! // Safepoint state ! st->print("VM state:"); ! ! if (SafepointSynchronize::is_synchronizing()) st->print("synchronizing"); ! else if (SafepointSynchronize::is_at_safepoint()) st->print("at safepoint"); ! else st->print("not at safepoint"); ! ! // Also see if error occurred during initialization or shutdown ! if (!Universe::is_fully_initialized()) { ! st->print(" (not fully initialized)"); ! } else if (VM_Exit::vm_exited()) { ! st->print(" (shutting down)"); } else { ! st->print(" (normal execution)"); }

! STEP(530, "(printing owned locks on error)" ) ! ! // mutexes/monitors that currently have an owner ! print_owned_locks_on_error(st); ! st->cr(); ! ! STEP(540, "(printing number of OutOfMemoryError and StackOverflow exceptions)") ! ! if (Exceptions::has_exception_counts()) { ! st->print_cr("OutOfMemory and StackOverflow Exception counts:"); ! Exceptions::print_exception_counts_on_error(st); ! st->cr(); ! } ! ! STEP(550, "(printing compressed oops mode")

! if (TestCrashInErrorHandler != 0) { st->print_cr("Will crash now (TestCrashInErrorHandler=" UINTX_FORMAT ")...", TestCrashInErrorHandler); controlled_crash(TestCrashInErrorHandler); }

STEP(40, "(test safefetch in error handler)")
  // test whether it is safe to use SafeFetch32 in Crash Handler. Test twice
  // to test that resetting the signal handler works correctly.

! if (TestSafeFetchInErrorHandler) { st->print_cr("Will test SafeFetch..."); if (CanUseSafeFetch32()) { int* const invalid_pointer = (int*) get_segfault_address(); const int x = 0x76543210; int i1 = SafeFetch32(invalid_pointer, x);


*** 312,321 **** --- 498,533 ---- } } else { st->print_cr("not possible; skipped."); } }

#endif // PRODUCT

STEP(50, "(printing type of error)")

   switch(_id) {

*** 344,353 **** --- 556,566 ---- print_oom_reasons(st); } else { return; // that's enough for the screen } break; + case VM_INFO: case INTERNAL_ERROR: default: break; }

*** 400,432 **** }

STEP(90, "(printing Java version string)")

   // VM version

! st->print_cr("#"); ! JDK_Version::current().to_string(buf, sizeof(buf)); ! const char* runtime_name = JDK_Version::runtime_name() != NULL ? ! JDK_Version::runtime_name() : ""; ! const char* runtime_version = JDK_Version::runtime_version() != NULL ? ! JDK_Version::runtime_version() : ""; ! st->print_cr("# JRE version: %s (%s) (build %s)", runtime_name, buf, runtime_version); ! // This is the long version with some default settings added ! st->print_cr("# Java VM: %s (%s, %s%s%s%s%s, %s, %s)", ! Abstract_VM_Version::vm_name(), ! Abstract_VM_Version::vm_release(), ! Abstract_VM_Version::vm_info_string(), ! TieredCompilation ? ", tiered" : "", ! #if INCLUDE_JVMCI ! EnableJVMCI ? ", jvmci" : "", ! UseJVMCICompiler ? ", jvmci compiler" : "", ! #else ! "", "", ! #endif ! UseCompressedOops ? ", compressed oops" : "", ! gc_mode(), ! Abstract_VM_Version::vm_platform_string() ! );

STEP(100, "(printing problematic frame)")

   // Print current frame if we have a context (i.e. it's a crash)
   if (_context) {

--- 613,623 ---- }

STEP(90, "(printing Java version string)")

   // VM version

! report_vm_version(st, buf, sizeof(buf));

STEP(100, "(printing problematic frame)")

   // Print current frame if we have a context (i.e. it's a crash)
   if (_context) {

*** 456,503 ****
if (should_report_bug(_id) && _verbose) { print_bug_submit_message(st, _thread); }
- STEP(130, "(printing summary)" )

! os::print_date_and_time(st, buf, sizeof(buf)); }

! STEP(170, "(printing thread)" )

   if (_verbose) {
     st->cr();
     st->print_cr("---------------  T H R E A D  ---------------");
     st->cr();
   }

! STEP(180, "(printing current thread)" )

   // current thread
   if (_verbose) {
     if (_thread) {
       st->print("Current thread (" PTR_FORMAT "):  ", p2i(_thread));

--- 647,672 ----

   if (should_report_bug(_id) && _verbose) {
     print_bug_submit_message(st, _thread);
   }

! STEP(300, "(printing thread)" )

   if (_verbose) {
     st->cr();
     st->print_cr("---------------  T H R E A D  ---------------");
     st->cr();
   }

! STEP(310, "(printing current thread)" )

   // current thread
   if (_verbose) {
     if (_thread) {
       st->print("Current thread (" PTR_FORMAT "):  ", p2i(_thread));

*** 507,517 **** st->print_cr("Current thread is native thread"); } st->cr(); }

! STEP(190, "(printing current compile task)" )

   if (_verbose && _thread && _thread->is_Compiler_thread()) {
      CompilerThread* t = (CompilerThread*)_thread;
      if (t->task()) {
         st->cr();

--- 676,686 ---- st->print_cr("Current thread is native thread"); } st->cr(); }

! STEP(320, "(printing current compile task)" )

   if (_verbose && _thread && _thread->is_Compiler_thread()) {
      CompilerThread* t = (CompilerThread*)_thread;
      if (t->task()) {
         st->cr();

*** 520,530 **** st->cr(); } }

! STEP(200, "(printing stack bounds)" )

   if (_verbose) {
     st->print("Stack: ");

     address stack_top;

--- 689,699 ---- st->cr(); } }

! STEP(330, "(printing stack bounds)" )

   if (_verbose) {
     st->print("Stack: ");

     address stack_top;

*** 551,561 **** }

     st->cr();
   }

! STEP(210, "(printing native stack)" )

 if (_verbose) {
   if (os::platform_print_native_stack(st, _context, buf, sizeof(buf))) {
     // We have printed the native stack in platform-specific code
     // Windows/x64 needs special handling.

--- 720,730 ---- }

     st->cr();
   }

! STEP(340, "(printing native stack)" )

 if (_verbose) {
   if (os::platform_print_native_stack(st, _context, buf, sizeof(buf))) {
     // We have printed the native stack in platform-specific code
     // Windows/x64 needs special handling.

*** 565,617 ****

     print_native_stack(st, fr, _thread, buf, sizeof(buf));
   }
 }

! STEP(220, "(printing Java stack)" )

   if (_verbose && _thread && _thread->is_Java_thread()) {
     print_stack_trace(st, (JavaThread*)_thread, buf, sizeof(buf));
   }

! STEP(230, "(printing target Java thread stack)" )

   // printing Java thread stack trace if it is involved in GC crash
   if (_verbose && _thread && (_thread->is_Named_thread())) {
     JavaThread*  jt = ((NamedThread *)_thread)->processed_thread();
     if (jt != NULL) {
       st->print_cr("JavaThread " PTR_FORMAT " (nid = %d) was being processed", p2i(jt), jt->osthread()->thread_id());
       print_stack_trace(st, jt, buf, sizeof(buf), true);
     }
   }

! STEP(240, "(printing siginfo)" )

   // signal no, signal code, address that caused the fault
   if (_verbose && _siginfo) {
     st->cr();
     os::print_siginfo(st, _siginfo);
     st->cr();
   }

! STEP(250, "(printing register info)")

   // decode register contents if possible
   if (_verbose && _context && Universe::is_fully_initialized()) {
     os::print_register_info(st, _context);
     st->cr();
   }

! STEP(260, "(printing registers, top of stack, instructions near pc)")

   // registers, top of stack, instructions near pc
   if (_verbose && _context) {
     os::print_context(st, _context);
     st->cr();
   }

! STEP(265, "(printing code blob if possible)")

   if (_verbose && _context) {
     CodeBlob* cb = CodeCache::find_blob(_pc);
     if (cb != NULL) {
       if (Interpreter::contains(_pc)) {

--- 734,786 ----

     print_native_stack(st, fr, _thread, buf, sizeof(buf));
   }
 }

! STEP(350, "(printing Java stack)" )

   if (_verbose && _thread && _thread->is_Java_thread()) {
     print_stack_trace(st, (JavaThread*)_thread, buf, sizeof(buf));
   }

! STEP(360, "(printing target Java thread stack)" )

   // printing Java thread stack trace if it is involved in GC crash
   if (_verbose && _thread && (_thread->is_Named_thread())) {
     JavaThread*  jt = ((NamedThread *)_thread)->processed_thread();
     if (jt != NULL) {
       st->print_cr("JavaThread " PTR_FORMAT " (nid = %d) was being processed", p2i(jt), jt->osthread()->thread_id());
       print_stack_trace(st, jt, buf, sizeof(buf), true);
     }
   }

! STEP(370, "(printing siginfo)" )

   // signal no, signal code, address that caused the fault
   if (_verbose && _siginfo) {
     st->cr();
     os::print_siginfo(st, _siginfo);
     st->cr();
   }

! STEP(380, "(printing register info)")

   // decode register contents if possible
   if (_verbose && _context && Universe::is_fully_initialized()) {
     os::print_register_info(st, _context);
     st->cr();
   }

! STEP(390, "(printing registers, top of stack, instructions near pc)")

   // registers, top of stack, instructions near pc
   if (_verbose && _context) {
     os::print_context(st, _context);
     st->cr();
   }

! STEP(400, "(printing code blob if possible)")

   if (_verbose && _context) {
     CodeBlob* cb = CodeCache::find_blob(_pc);
     if (cb != NULL) {
       if (Interpreter::contains(_pc)) {

*** 632,642 **** } } } }

! STEP(270, "(printing VM operation)" )

   if (_verbose && _thread && _thread->is_VM_thread()) {
      VMThread* t = (VMThread*)_thread;
      VM_Operation* op = t->vm_operation();
      if (op) {

--- 801,811 ---- } } } }

! STEP(410, "(printing VM operation)" )

   if (_verbose && _thread && _thread->is_VM_thread()) {
      VMThread* t = (VMThread*)_thread;
      VM_Operation* op = t->vm_operation();
      if (op) {

*** 644,821 **** st->cr(); st->cr(); } }
- STEP(280, "(printing process)" )

! os::print_environment_variables(st, env_list); ! st->cr(); ! } ! ! STEP(410, "(printing signal handlers)" ) ! ! if (_verbose) { ! os::print_signal_handlers(st, buf, sizeof(buf)); ! st->cr(); ! } ! ! STEP(420, "(Native Memory Tracking)" ) ! if (_verbose) { ! MemTracker::error_report(st); ! } ! ! STEP(430, "(printing system)" ) ! ! if (_verbose) { ! st->cr(); ! st->print_cr("--------------- S Y S T E M ---------------"); ! st->cr(); ! } ! ! STEP(440, "(printing OS information)" ) ! ! if (_verbose) { ! os::print_os_info(st); ! st->cr(); ! } ! ! STEP(450, "(printing CPU info)" ) ! if (_verbose) { ! os::print_cpu_info(st, buf, sizeof(buf)); ! st->cr(); ! } ! ! STEP(460, "(printing memory info)" ) ! ! if (_verbose) { ! os::print_memory_info(st); ! st->cr(); ! } ! ! STEP(470, "(printing internal vm info)" ) ! ! if (_verbose) { ! st->print_cr("vm_info: %s", Abstract_VM_Version::internal_vm_info_string()); ! st->cr(); }
// print a defined marker to show that error handling finished correctly. ! STEP(480, "(printing end marker)" )
if (_verbose) { st->print_cr("END."); }
--- 813,834 ---- st->cr(); st->cr(); } }
if (_verbose) { ! // PROCESS ! // Step 500-690 ! report_process(st, buf, sizeof(buf)); ! ! // SYSTEM ! // Step 700-790 ! report_system(st, buf, sizeof(buf)); }
// print a defined marker to show that error handling finished correctly. ! STEP(800, "(printing end marker)" )
if (_verbose) { st->print_cr("END."); }

*** 824,833 **** --- 837,860 ----

undef BEGIN

undef STEP

undef END

}


*** 886,905 **** --- 913,948 ----

return fd;

}

int VMError::_id;


*** 958,967 **** --- 1001,1011 ---- intptr_t mytid = os::current_thread_id(); if (first_error_tid == -1 && Atomic::cmpxchg_ptr(mytid, &first_error_tid, -1) == -1) {

  _id = id;

src/share/vm/utilities/vmError.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File