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/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"
52 #include "utilities/events.hpp"
601 frame fr = os::fetch_frame_from_context(_context);
602 fr.print_on_error(st, buf, sizeof(buf));
603 st->cr();
604 st->print_cr("#");
605 }
606
607 STEP("printing core file information")
608 st->print("# ");
609 if (CreateCoredumpOnCrash) {
610 if (coredump_status) {
611 st->print("Core dump will be written. Default location: %s", coredump_message);
612 } else {
613 st->print("No core dump will be written. %s", coredump_message);
614 }
615 } else {
616 st->print("CreateCoredumpOnCrash turned off, no core file dumped");
617 }
618 st->cr();
619 st->print_cr("#");
620
621 STEP("printing bug submit message")
622
623 if (should_report_bug(_id) && _verbose) {
624 print_bug_submit_message(st, _thread);
625 }
626
627 STEP("printing summary")
628
629 if (_verbose) {
630 st->cr();
631 st->print_cr("--------------- S U M M A R Y ------------");
632 st->cr();
633 }
634
635 STEP("printing VM option summary")
636
637 if (_verbose) {
638 // VM options
639 Arguments::print_summary_on(st);
640 st->cr();
1391 // TestUnresponsiveErrorHandler test. For that test we record
1392 // reporting_start_time at the beginning of the test.
1393 record_reporting_start_time();
1394 } else {
1395 out.print_raw_cr("Delaying recording reporting_start_time for TestUnresponsiveErrorHandler.");
1396 }
1397
1398 if (ShowMessageBoxOnError || PauseAtExit) {
1399 show_message_box(buffer, sizeof(buffer));
1400
1401 // User has asked JVM to abort. Reset ShowMessageBoxOnError so the
1402 // WatcherThread can kill JVM if the error handler hangs.
1403 ShowMessageBoxOnError = false;
1404 }
1405
1406 os::check_dump_limit(buffer, sizeof(buffer));
1407
1408 // reset signal handlers or exception filter; make sure recursive crashes
1409 // are handled properly.
1410 reset_signal_handlers();
1411
1412 EventShutdown e;
1413 if (e.should_commit()) {
1414 e.set_reason("VM Error");
1415 e.commit();
1416 }
1417
1418 JFR_ONLY(Jfr::on_vm_shutdown(true);)
1419
1420 } else {
1421 // If UseOsErrorReporting we call this for each level of the call stack
1422 // while searching for the exception handler. Only the first level needs
1423 // to be reported.
1424 if (UseOSErrorReporting && log_done) return;
1425
1426 // This is not the first error, see if it happened in a different thread
1427 // or in the same thread during error reporting.
1428 if (_first_error_tid != mytid) {
1429 char msgbuf[64];
1430 jio_snprintf(msgbuf, sizeof(msgbuf),
1431 "[thread " INTX_FORMAT " also had an error]",
1432 mytid);
1433 out.print_raw_cr(msgbuf);
1434
1435 // error reporting is not MT-safe, block current thread
1436 os::infinite_sleep();
1437
1438 } else {
1439 if (recursive_error_count++ > 30) {
1520 } else {
1521 out.print_raw_cr("# Can not save log file, dump to screen..");
1522 fd_log = 1;
1523 }
1524 }
1525 log.set_fd(fd_log);
1526 }
1527
1528 report(&log, true);
1529 log_done = true;
1530 _current_step = 0;
1531 _current_step_info = "";
1532
1533 if (fd_log > 3) {
1534 close(fd_log);
1535 fd_log = -1;
1536 }
1537
1538 log.set_fd(-1);
1539 }
1540
1541 if (PrintNMTStatistics) {
1542 fdStream fds(fd_out);
1543 MemTracker::final_report(&fds);
1544 }
1545
1546 static bool skip_replay = ReplayCompiles; // Do not overwrite file during replay
1547 if (DumpReplayDataOnError && _thread && _thread->is_Compiler_thread() && !skip_replay) {
1548 skip_replay = true;
1549 ciEnv* env = ciEnv::current();
1550 if (env != NULL) {
1551 const bool overwrite = false; // We do not overwrite an existing replay file.
1552 int fd = prepare_log_file(ReplayDataFile, "replay_pid%p.log", overwrite, buffer, sizeof(buffer));
1553 if (fd != -1) {
1554 FILE* replay_data_file = os::open(fd, "w");
1555 if (replay_data_file != NULL) {
1556 fileStream replay_data_stream(replay_data_file, /*need_close=*/true);
1557 env->dump_replay_data_unsafe(&replay_data_stream);
1558 out.print_raw("#\n# Compiler replay data is saved as:\n# ");
1559 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/thread.inline.hpp"
42 #include "runtime/threadSMR.hpp"
43 #include "runtime/vmThread.hpp"
44 #include "runtime/vmOperations.hpp"
45 #include "runtime/vm_version.hpp"
46 #include "runtime/flags/jvmFlag.hpp"
47 #include "services/memTracker.hpp"
48 #include "utilities/debug.hpp"
49 #include "utilities/decoder.hpp"
50 #include "utilities/defaultStream.hpp"
51 #include "utilities/events.hpp"
600 frame fr = os::fetch_frame_from_context(_context);
601 fr.print_on_error(st, buf, sizeof(buf));
602 st->cr();
603 st->print_cr("#");
604 }
605
606 STEP("printing core file information")
607 st->print("# ");
608 if (CreateCoredumpOnCrash) {
609 if (coredump_status) {
610 st->print("Core dump will be written. Default location: %s", coredump_message);
611 } else {
612 st->print("No core dump will be written. %s", coredump_message);
613 }
614 } else {
615 st->print("CreateCoredumpOnCrash turned off, no core file dumped");
616 }
617 st->cr();
618 st->print_cr("#");
619
620 JFR_ONLY(STEP("printing jfr information"))
621 JFR_ONLY(Jfr::on_vm_error_report(st);)
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 } else {
1414 // If UseOsErrorReporting we call this for each level of the call stack
1415 // while searching for the exception handler. Only the first level needs
1416 // to be reported.
1417 if (UseOSErrorReporting && log_done) return;
1418
1419 // This is not the first error, see if it happened in a different thread
1420 // or in the same thread during error reporting.
1421 if (_first_error_tid != mytid) {
1422 char msgbuf[64];
1423 jio_snprintf(msgbuf, sizeof(msgbuf),
1424 "[thread " INTX_FORMAT " also had an error]",
1425 mytid);
1426 out.print_raw_cr(msgbuf);
1427
1428 // error reporting is not MT-safe, block current thread
1429 os::infinite_sleep();
1430
1431 } else {
1432 if (recursive_error_count++ > 30) {
1513 } else {
1514 out.print_raw_cr("# Can not save log file, dump to screen..");
1515 fd_log = 1;
1516 }
1517 }
1518 log.set_fd(fd_log);
1519 }
1520
1521 report(&log, true);
1522 log_done = true;
1523 _current_step = 0;
1524 _current_step_info = "";
1525
1526 if (fd_log > 3) {
1527 close(fd_log);
1528 fd_log = -1;
1529 }
1530
1531 log.set_fd(-1);
1532 }
1533
1534 JFR_ONLY(Jfr::on_vm_shutdown(true);)
1535
1536 if (PrintNMTStatistics) {
1537 fdStream fds(fd_out);
1538 MemTracker::final_report(&fds);
1539 }
1540
1541 static bool skip_replay = ReplayCompiles; // Do not overwrite file during replay
1542 if (DumpReplayDataOnError && _thread && _thread->is_Compiler_thread() && !skip_replay) {
1543 skip_replay = true;
1544 ciEnv* env = ciEnv::current();
1545 if (env != NULL) {
1546 const bool overwrite = false; // We do not overwrite an existing replay file.
1547 int fd = prepare_log_file(ReplayDataFile, "replay_pid%p.log", overwrite, buffer, sizeof(buffer));
1548 if (fd != -1) {
1549 FILE* replay_data_file = os::open(fd, "w");
1550 if (replay_data_file != NULL) {
1551 fileStream replay_data_stream(replay_data_file, /*need_close=*/true);
1552 env->dump_replay_data_unsafe(&replay_data_stream);
1553 out.print_raw("#\n# Compiler replay data is saved as:\n# ");
1554 out.print_raw_cr(buffer);
|