1428 _current_step_info, id);
1429 char signal_name[64];
1430 if (os::exception_name(id, signal_name, sizeof(signal_name))) {
1431 ss.print(", %s (0x%x) at pc=" PTR_FORMAT, signal_name, id, p2i(pc));
1432 } else {
1433 if (should_report_bug(id)) {
1434 ss.print(", Internal Error (%s:%d)",
1435 filename == NULL ? "??" : filename, lineno);
1436 } else {
1437 ss.print(", Out of Memory Error (%s:%d)",
1438 filename == NULL ? "??" : filename, lineno);
1439 }
1440 }
1441 ss.print("]");
1442 st->print_raw_cr(buffer);
1443 st->cr();
1444 }
1445 }
1446 }
1447
1448 // print to screen
1449 if (!out_done) {
1450 report(&out, false);
1451
1452 out_done = true;
1453
1454 _current_step = 0;
1455 _current_step_info = "";
1456 }
1457
1458 // print to error log file
1459 if (!log_done) {
1460 // see if log file is already open
1461 if (!log.is_open()) {
1462 // open log file
1463 fd_log = prepare_log_file(ErrorFile, "hs_err_pid%p.log", buffer, sizeof(buffer));
1464 if (fd_log != -1) {
1465 out.print_raw("# An error report file with more information is saved as:\n# ");
1466 out.print_raw_cr(buffer);
1467
1468 log.set_fd(fd_log);
1469 } else {
1470 out.print_raw_cr("# Can not save log file, dump to screen..");
1471 log.set_fd(fd_out);
1472 }
1473 }
1474
1475 report(&log, true);
1476 log_done = true;
1477 _current_step = 0;
1478 _current_step_info = "";
1479
1480 if (fd_log != -1) {
1481 close(fd_log);
1482 fd_log = -1;
1483 }
1484
1485 log.set_fd(-1);
1486 }
1487
1488 static bool skip_replay = ReplayCompiles; // Do not overwrite file during replay
1489 if (DumpReplayDataOnError && _thread && _thread->is_Compiler_thread() && !skip_replay) {
1490 skip_replay = true;
1491 ciEnv* env = ciEnv::current();
1492 if (env != NULL) {
1493 int fd = prepare_log_file(ReplayDataFile, "replay_pid%p.log", buffer, sizeof(buffer));
1494 if (fd != -1) {
1495 FILE* replay_data_file = os::open(fd, "w");
1496 if (replay_data_file != NULL) {
1497 fileStream replay_data_stream(replay_data_file, /*need_close=*/true);
1498 env->dump_replay_data_unsafe(&replay_data_stream);
1499 out.print_raw("#\n# Compiler replay data is saved as:\n# ");
1500 out.print_raw_cr(buffer);
|
1428 _current_step_info, id);
1429 char signal_name[64];
1430 if (os::exception_name(id, signal_name, sizeof(signal_name))) {
1431 ss.print(", %s (0x%x) at pc=" PTR_FORMAT, signal_name, id, p2i(pc));
1432 } else {
1433 if (should_report_bug(id)) {
1434 ss.print(", Internal Error (%s:%d)",
1435 filename == NULL ? "??" : filename, lineno);
1436 } else {
1437 ss.print(", Out of Memory Error (%s:%d)",
1438 filename == NULL ? "??" : filename, lineno);
1439 }
1440 }
1441 ss.print("]");
1442 st->print_raw_cr(buffer);
1443 st->cr();
1444 }
1445 }
1446 }
1447
1448 // Part 1: print an abbreviated version (the '#' section) to stdout.
1449 if (!out_done) {
1450 // Suppress this output if we plan to print Part 2 to stdout too.
1451 // No need to have the "#" section twice.
1452 if (!(ErrorFileToStdout && out.fd() == 1)) {
1453 report(&out, false);
1454 }
1455
1456 out_done = true;
1457
1458 _current_step = 0;
1459 _current_step_info = "";
1460 }
1461
1462 // Part 2: print a full error log file (optionally to stdout or stderr).
1463 // print to error log file
1464 if (!log_done) {
1465 // see if log file is already open
1466 if (!log.is_open()) {
1467 // open log file
1468 if (ErrorFileToStdout) {
1469 fd_log = 1;
1470 } else if (ErrorFileToStderr) {
1471 fd_log = 2;
1472 } else {
1473 fd_log = prepare_log_file(ErrorFile, "hs_err_pid%p.log", buffer, sizeof(buffer));
1474 if (fd_log != -1) {
1475 out.print_raw("# An error report file with more information is saved as:\n# ");
1476 out.print_raw_cr(buffer);
1477 } else {
1478 out.print_raw_cr("# Can not save log file, dump to screen..");
1479 fd_log = 1;
1480 }
1481 }
1482 log.set_fd(fd_log);
1483 }
1484
1485 report(&log, true);
1486 log_done = true;
1487 _current_step = 0;
1488 _current_step_info = "";
1489
1490 if (fd_log > 3) {
1491 close(fd_log);
1492 fd_log = -1;
1493 }
1494
1495 log.set_fd(-1);
1496 }
1497
1498 static bool skip_replay = ReplayCompiles; // Do not overwrite file during replay
1499 if (DumpReplayDataOnError && _thread && _thread->is_Compiler_thread() && !skip_replay) {
1500 skip_replay = true;
1501 ciEnv* env = ciEnv::current();
1502 if (env != NULL) {
1503 int fd = prepare_log_file(ReplayDataFile, "replay_pid%p.log", buffer, sizeof(buffer));
1504 if (fd != -1) {
1505 FILE* replay_data_file = os::open(fd, "w");
1506 if (replay_data_file != NULL) {
1507 fileStream replay_data_stream(replay_data_file, /*need_close=*/true);
1508 env->dump_replay_data_unsafe(&replay_data_stream);
1509 out.print_raw("#\n# Compiler replay data is saved as:\n# ");
1510 out.print_raw_cr(buffer);
|