< prev index next >

src/hotspot/share/utilities/vmError.cpp

Print this page




  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "jvm.h"
  27 #include "code/codeCache.hpp"
  28 #include "compiler/compileBroker.hpp"
  29 #include "compiler/disassembler.hpp"
  30 #include "gc/shared/gcConfig.hpp"
  31 #include "logging/logConfiguration.hpp"
  32 #include "jfr/jfrEvents.hpp"
  33 #include "memory/resourceArea.hpp"
  34 #include "memory/universe.hpp"
  35 #include "oops/compressedOops.hpp"
  36 #include "prims/whitebox.hpp"
  37 #include "runtime/arguments.hpp"
  38 #include "runtime/atomic.hpp"
  39 #include "runtime/frame.inline.hpp"
  40 #include "runtime/init.hpp"
  41 #include "runtime/os.hpp"
  42 #include "runtime/safepointMechanism.hpp"
  43 #include "runtime/thread.inline.hpp"
  44 #include "runtime/threadSMR.hpp"
  45 #include "runtime/vmThread.hpp"
  46 #include "runtime/vmOperations.hpp"
  47 #include "runtime/vm_version.hpp"
  48 #include "runtime/flags/jvmFlag.hpp"
  49 #include "services/memTracker.hpp"
  50 #include "utilities/debug.hpp"
  51 #include "utilities/decoder.hpp"
  52 #include "utilities/defaultStream.hpp"


 603        frame fr = os::fetch_frame_from_context(_context);
 604        fr.print_on_error(st, buf, sizeof(buf));
 605        st->cr();
 606        st->print_cr("#");
 607      }
 608 
 609   STEP("printing core file information")
 610     st->print("# ");
 611     if (CreateCoredumpOnCrash) {
 612       if (coredump_status) {
 613         st->print("Core dump will be written. Default location: %s", coredump_message);
 614       } else {
 615         st->print("No core dump will be written. %s", coredump_message);
 616       }
 617     } else {
 618       st->print("CreateCoredumpOnCrash turned off, no core file dumped");
 619     }
 620     st->cr();
 621     st->print_cr("#");
 622 



 623   STEP("printing bug submit message")
 624 
 625      if (should_report_bug(_id) && _verbose) {
 626        print_bug_submit_message(st, _thread);
 627      }
 628 
 629   STEP("printing summary")
 630 
 631      if (_verbose) {
 632        st->cr();
 633        st->print_cr("---------------  S U M M A R Y ------------");
 634        st->cr();
 635      }
 636 
 637   STEP("printing VM option summary")
 638 
 639      if (_verbose) {
 640        // VM options
 641        Arguments::print_summary_on(st);
 642        st->cr();


1393       // TestUnresponsiveErrorHandler test. For that test we record
1394       // reporting_start_time at the beginning of the test.
1395       record_reporting_start_time();
1396     } else {
1397       out.print_raw_cr("Delaying recording reporting_start_time for TestUnresponsiveErrorHandler.");
1398     }
1399 
1400     if (ShowMessageBoxOnError || PauseAtExit) {
1401       show_message_box(buffer, sizeof(buffer));
1402 
1403       // User has asked JVM to abort. Reset ShowMessageBoxOnError so the
1404       // WatcherThread can kill JVM if the error handler hangs.
1405       ShowMessageBoxOnError = false;
1406     }
1407 
1408     os::check_dump_limit(buffer, sizeof(buffer));
1409 
1410     // reset signal handlers or exception filter; make sure recursive crashes
1411     // are handled properly.
1412     reset_signal_handlers();
1413 
1414     EventShutdown e;
1415     if (e.should_commit()) {
1416       e.set_reason("VM Error");
1417       e.commit();
1418     }
1419 
1420     JFR_ONLY(Jfr::on_vm_shutdown(true);)
1421 
1422   } else {
1423     // If UseOsErrorReporting we call this for each level of the call stack
1424     // while searching for the exception handler.  Only the first level needs
1425     // to be reported.
1426     if (UseOSErrorReporting && log_done) return;
1427 
1428     // This is not the first error, see if it happened in a different thread
1429     // or in the same thread during error reporting.
1430     if (_first_error_tid != mytid) {
1431       char msgbuf[64];
1432       jio_snprintf(msgbuf, sizeof(msgbuf),
1433                    "[thread " INTX_FORMAT " also had an error]",
1434                    mytid);
1435       out.print_raw_cr(msgbuf);
1436 
1437       // error reporting is not MT-safe, block current thread
1438       os::infinite_sleep();
1439 
1440     } else {
1441       if (recursive_error_count++ > 30) {


1522         } else {
1523           out.print_raw_cr("# Can not save log file, dump to screen..");
1524           fd_log = 1;
1525         }
1526       }
1527       log.set_fd(fd_log);
1528     }
1529 
1530     report(&log, true);
1531     log_done = true;
1532     _current_step = 0;
1533     _current_step_info = "";
1534 
1535     if (fd_log > 3) {
1536       close(fd_log);
1537       fd_log = -1;
1538     }
1539 
1540     log.set_fd(-1);
1541   }


1542 
1543   if (PrintNMTStatistics) {
1544     fdStream fds(fd_out);
1545     MemTracker::final_report(&fds);
1546   }
1547 
1548   static bool skip_replay = ReplayCompiles; // Do not overwrite file during replay
1549   if (DumpReplayDataOnError && _thread && _thread->is_Compiler_thread() && !skip_replay) {
1550     skip_replay = true;
1551     ciEnv* env = ciEnv::current();
1552     if (env != NULL) {
1553       const bool overwrite = false; // We do not overwrite an existing replay file.
1554       int fd = prepare_log_file(ReplayDataFile, "replay_pid%p.log", overwrite, buffer, sizeof(buffer));
1555       if (fd != -1) {
1556         FILE* replay_data_file = os::open(fd, "w");
1557         if (replay_data_file != NULL) {
1558           fileStream replay_data_stream(replay_data_file, /*need_close=*/true);
1559           env->dump_replay_data_unsafe(&replay_data_stream);
1560           out.print_raw("#\n# Compiler replay data is saved as:\n# ");
1561           out.print_raw_cr(buffer);




  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "jvm.h"
  27 #include "code/codeCache.hpp"
  28 #include "compiler/compileBroker.hpp"
  29 #include "compiler/disassembler.hpp"
  30 #include "gc/shared/gcConfig.hpp"
  31 #include "logging/logConfiguration.hpp"

  32 #include "memory/resourceArea.hpp"
  33 #include "memory/universe.hpp"
  34 #include "oops/compressedOops.hpp"
  35 #include "prims/whitebox.hpp"
  36 #include "runtime/arguments.hpp"
  37 #include "runtime/atomic.hpp"
  38 #include "runtime/frame.inline.hpp"
  39 #include "runtime/init.hpp"
  40 #include "runtime/os.hpp"
  41 #include "runtime/safepointMechanism.hpp"
  42 #include "runtime/thread.inline.hpp"
  43 #include "runtime/threadSMR.hpp"
  44 #include "runtime/vmThread.hpp"
  45 #include "runtime/vmOperations.hpp"
  46 #include "runtime/vm_version.hpp"
  47 #include "runtime/flags/jvmFlag.hpp"
  48 #include "services/memTracker.hpp"
  49 #include "utilities/debug.hpp"
  50 #include "utilities/decoder.hpp"
  51 #include "utilities/defaultStream.hpp"


 602        frame fr = os::fetch_frame_from_context(_context);
 603        fr.print_on_error(st, buf, sizeof(buf));
 604        st->cr();
 605        st->print_cr("#");
 606      }
 607 
 608   STEP("printing core file information")
 609     st->print("# ");
 610     if (CreateCoredumpOnCrash) {
 611       if (coredump_status) {
 612         st->print("Core dump will be written. Default location: %s", coredump_message);
 613       } else {
 614         st->print("No core dump will be written. %s", coredump_message);
 615       }
 616     } else {
 617       st->print("CreateCoredumpOnCrash turned off, no core file dumped");
 618     }
 619     st->cr();
 620     st->print_cr("#");
 621 
 622   JFR_ONLY(STEP("printing jfr information"))
 623   JFR_ONLY(Jfr::on_vm_error_report(st);)
 624 
 625   STEP("printing bug submit message")
 626 
 627      if (should_report_bug(_id) && _verbose) {
 628        print_bug_submit_message(st, _thread);
 629      }
 630 
 631   STEP("printing summary")
 632 
 633      if (_verbose) {
 634        st->cr();
 635        st->print_cr("---------------  S U M M A R Y ------------");
 636        st->cr();
 637      }
 638 
 639   STEP("printing VM option summary")
 640 
 641      if (_verbose) {
 642        // VM options
 643        Arguments::print_summary_on(st);
 644        st->cr();


1395       // TestUnresponsiveErrorHandler test. For that test we record
1396       // reporting_start_time at the beginning of the test.
1397       record_reporting_start_time();
1398     } else {
1399       out.print_raw_cr("Delaying recording reporting_start_time for TestUnresponsiveErrorHandler.");
1400     }
1401 
1402     if (ShowMessageBoxOnError || PauseAtExit) {
1403       show_message_box(buffer, sizeof(buffer));
1404 
1405       // User has asked JVM to abort. Reset ShowMessageBoxOnError so the
1406       // WatcherThread can kill JVM if the error handler hangs.
1407       ShowMessageBoxOnError = false;
1408     }
1409 
1410     os::check_dump_limit(buffer, sizeof(buffer));
1411 
1412     // reset signal handlers or exception filter; make sure recursive crashes
1413     // are handled properly.
1414     reset_signal_handlers();









1415   } else {
1416     // If UseOsErrorReporting we call this for each level of the call stack
1417     // while searching for the exception handler.  Only the first level needs
1418     // to be reported.
1419     if (UseOSErrorReporting && log_done) return;
1420 
1421     // This is not the first error, see if it happened in a different thread
1422     // or in the same thread during error reporting.
1423     if (_first_error_tid != mytid) {
1424       char msgbuf[64];
1425       jio_snprintf(msgbuf, sizeof(msgbuf),
1426                    "[thread " INTX_FORMAT " also had an error]",
1427                    mytid);
1428       out.print_raw_cr(msgbuf);
1429 
1430       // error reporting is not MT-safe, block current thread
1431       os::infinite_sleep();
1432 
1433     } else {
1434       if (recursive_error_count++ > 30) {


1515         } else {
1516           out.print_raw_cr("# Can not save log file, dump to screen..");
1517           fd_log = 1;
1518         }
1519       }
1520       log.set_fd(fd_log);
1521     }
1522 
1523     report(&log, true);
1524     log_done = true;
1525     _current_step = 0;
1526     _current_step_info = "";
1527 
1528     if (fd_log > 3) {
1529       close(fd_log);
1530       fd_log = -1;
1531     }
1532 
1533     log.set_fd(-1);
1534   }
1535 
1536   JFR_ONLY(Jfr::on_vm_shutdown(true);)
1537 
1538   if (PrintNMTStatistics) {
1539     fdStream fds(fd_out);
1540     MemTracker::final_report(&fds);
1541   }
1542 
1543   static bool skip_replay = ReplayCompiles; // Do not overwrite file during replay
1544   if (DumpReplayDataOnError && _thread && _thread->is_Compiler_thread() && !skip_replay) {
1545     skip_replay = true;
1546     ciEnv* env = ciEnv::current();
1547     if (env != NULL) {
1548       const bool overwrite = false; // We do not overwrite an existing replay file.
1549       int fd = prepare_log_file(ReplayDataFile, "replay_pid%p.log", overwrite, buffer, sizeof(buffer));
1550       if (fd != -1) {
1551         FILE* replay_data_file = os::open(fd, "w");
1552         if (replay_data_file != NULL) {
1553           fileStream replay_data_stream(replay_data_file, /*need_close=*/true);
1554           env->dump_replay_data_unsafe(&replay_data_stream);
1555           out.print_raw("#\n# Compiler replay data is saved as:\n# ");
1556           out.print_raw_cr(buffer);


< prev index next >