1 /*
2 * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
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 *
1043 skip_OnError = true;
1044
1045 out.print_raw_cr("#");
1046 out.print_raw ("# -XX:OnError=\"");
1047 out.print_raw (OnError);
1048 out.print_raw_cr("\"");
1049
1050 char* cmd;
1051 const char* ptr = OnError;
1052 while ((cmd = next_OnError_command(buffer, sizeof(buffer), &ptr)) != NULL){
1053 out.print_raw ("# Executing ");
1054 #if defined(LINUX) || defined(_ALLBSD_SOURCE)
1055 out.print_raw ("/bin/sh -c ");
1056 #elif defined(SOLARIS)
1057 out.print_raw ("/usr/bin/sh -c ");
1058 #endif
1059 out.print_raw ("\"");
1060 out.print_raw (cmd);
1061 out.print_raw_cr("\" ...");
1062
1063 if (os::fork_and_exec(cmd) < 0) {
1064 out.print_cr("os::fork_and_exec failed: %s (%d)", strerror(errno), errno);
1065 }
1066 }
1067
1068 // done with OnError
1069 OnError = NULL;
1070 }
1071
1072 static bool skip_replay = ReplayCompiles; // Do not overwrite file during replay
1073 if (DumpReplayDataOnError && _thread && _thread->is_Compiler_thread() && !skip_replay) {
1074 skip_replay = true;
1075 ciEnv* env = ciEnv::current();
1076 if (env != NULL) {
1077 int fd = prepare_log_file(ReplayDataFile, "replay_pid%p.log", buffer, sizeof(buffer));
1078 if (fd != -1) {
1079 FILE* replay_data_file = os::open(fd, "w");
1080 if (replay_data_file != NULL) {
1081 fileStream replay_data_stream(replay_data_file, /*need_close=*/true);
1082 env->dump_replay_data_unsafe(&replay_data_stream);
1083 out.print_raw("#\n# Compiler replay data is saved as:\n# ");
|
1 /*
2 * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
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 *
1043 skip_OnError = true;
1044
1045 out.print_raw_cr("#");
1046 out.print_raw ("# -XX:OnError=\"");
1047 out.print_raw (OnError);
1048 out.print_raw_cr("\"");
1049
1050 char* cmd;
1051 const char* ptr = OnError;
1052 while ((cmd = next_OnError_command(buffer, sizeof(buffer), &ptr)) != NULL){
1053 out.print_raw ("# Executing ");
1054 #if defined(LINUX) || defined(_ALLBSD_SOURCE)
1055 out.print_raw ("/bin/sh -c ");
1056 #elif defined(SOLARIS)
1057 out.print_raw ("/usr/bin/sh -c ");
1058 #endif
1059 out.print_raw ("\"");
1060 out.print_raw (cmd);
1061 out.print_raw_cr("\" ...");
1062
1063 if (os::fork_and_exec(cmd, true) < 0) {
1064 out.print_cr("os::fork_and_exec failed: %s (%d)", strerror(errno), errno);
1065 }
1066 }
1067
1068 // done with OnError
1069 OnError = NULL;
1070 }
1071
1072 static bool skip_replay = ReplayCompiles; // Do not overwrite file during replay
1073 if (DumpReplayDataOnError && _thread && _thread->is_Compiler_thread() && !skip_replay) {
1074 skip_replay = true;
1075 ciEnv* env = ciEnv::current();
1076 if (env != NULL) {
1077 int fd = prepare_log_file(ReplayDataFile, "replay_pid%p.log", buffer, sizeof(buffer));
1078 if (fd != -1) {
1079 FILE* replay_data_file = os::open(fd, "w");
1080 if (replay_data_file != NULL) {
1081 fileStream replay_data_stream(replay_data_file, /*need_close=*/true);
1082 env->dump_replay_data_unsafe(&replay_data_stream);
1083 out.print_raw("#\n# Compiler replay data is saved as:\n# ");
|