Commit 62515936 authored by Mike Stanton's avatar Mike Stanton Committed by Commit Bot

[bugfix] MkSnapshot Windows build errors should redirect to stdout

This is something we already do for d8, and in general, any process
we run as part of the build.

Bug: chromium:819237
Change-Id: I8b90505a5c447c0a0311e45c4056cd2b84da4284
Reviewed-on: https://chromium-review.googlesource.com/968244
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52180}
parent ee98ee58
......@@ -1246,6 +1246,24 @@ int OS::ActivationFrameAlignment() {
#endif
}
#if (defined(_WIN32) || defined(_WIN64))
void EnsureConsoleOutputWin32() {
UINT new_flags =
SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX;
UINT existing_flags = SetErrorMode(new_flags);
SetErrorMode(existing_flags | new_flags);
#if defined(_MSC_VER)
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
_set_error_mode(_OUT_TO_STDERR);
#endif // defined(_MSC_VER)
}
#endif // (defined(_WIN32) || defined(_WIN64))
// ----------------------------------------------------------------------------
// Win32 thread support.
......
......@@ -281,6 +281,18 @@ class V8_BASE_EXPORT OS {
DISALLOW_IMPLICIT_CONSTRUCTORS(OS);
};
#if (defined(_WIN32) || defined(_WIN64))
V8_BASE_EXPORT void EnsureConsoleOutputWin32();
#endif // (defined(_WIN32) || defined(_WIN64))
inline void EnsureConsoleOutput() {
#if (defined(_WIN32) || defined(_WIN64))
// Windows requires extra calls to send assert output to the console
// rather than a dialog box.
EnsureConsoleOutputWin32();
#endif // (defined(_WIN32) || defined(_WIN64))
}
// ----------------------------------------------------------------------------
// Thread
//
......
......@@ -3277,21 +3277,7 @@ void Shell::CleanupWorkers() {
int Shell::Main(int argc, char* argv[]) {
std::ofstream trace_file;
#if (defined(_WIN32) || defined(_WIN64))
UINT new_flags =
SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX;
UINT existing_flags = SetErrorMode(new_flags);
SetErrorMode(existing_flags | new_flags);
#if defined(_MSC_VER)
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
_set_error_mode(_OUT_TO_STDERR);
#endif // defined(_MSC_VER)
#endif // defined(_WIN32) || defined(_WIN64)
v8::base::EnsureConsoleOutput();
if (!SetOptions(argc, argv)) return 1;
v8::V8::InitializeICUDefaultLocation(argv[0], options.icu_data_file);
......
......@@ -361,6 +361,8 @@ void WriteEmbeddedFile(v8::SnapshotCreator* creator, SnapshotWriter* writer) {
} // namespace
int main(int argc, char** argv) {
v8::base::EnsureConsoleOutput();
// Make mksnapshot runs predictable to create reproducible snapshots.
i::FLAG_predictable = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment