diff --git a/flow/flow_run_all_unittests.cc b/flow/flow_run_all_unittests.cc index efa27a7433834158fb2e6604dd4f4db754d7c916..e2106829a83c411e3cdbcdc16e677b7cc7826bb1 100644 --- a/flow/flow_run_all_unittests.cc +++ b/flow/flow_run_all_unittests.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "flutter/fml/backtrace.h" #include "flutter/fml/build_config.h" #include "flutter/fml/command_line.h" #include "flutter/fml/logging.h" @@ -10,6 +11,7 @@ #include "flow_test_utils.h" int main(int argc, char** argv) { + fml::InstallCrashHandler(); testing::InitGoogleTest(&argc, argv); fml::CommandLine cmd = fml::CommandLineFromArgcArgv(argc, argv); diff --git a/fml/backtrace.cc b/fml/backtrace.cc index 98e5c22b4fd7ec25e06ae3851ee1d55c4fd5929a..bcf9ca7ea1594c96cd1bdd4933ce66a816bdceb7 100644 --- a/fml/backtrace.cc +++ b/fml/backtrace.cc @@ -7,10 +7,15 @@ #include #include #include -#include +#include #include +#if OS_WIN +#include +#include +#endif + #include "flutter/fml/logging.h" namespace fml { @@ -126,6 +131,12 @@ static void ToggleSignalHandlers(bool set) { } void InstallCrashHandler() { +#if OS_WIN + if (!IsDebuggerPresent()) { + _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); + _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); + } +#endif ToggleSignalHandlers(true); } diff --git a/third_party/txt/tests/txt_run_all_unittests.cc b/third_party/txt/tests/txt_run_all_unittests.cc index e2db322bbc108f8e079bcd758e6cee528eb3f30d..dceb19277c9366b28f3434bd0210bf17905cd8ed 100644 --- a/third_party/txt/tests/txt_run_all_unittests.cc +++ b/third_party/txt/tests/txt_run_all_unittests.cc @@ -16,6 +16,7 @@ #include +#include "flutter/fml/backtrace.h" #include "flutter/fml/command_line.h" #include "flutter/fml/icu_util.h" #include "flutter/fml/logging.h" @@ -24,6 +25,7 @@ #include "txt_test_utils.h" int main(int argc, char** argv) { + fml::InstallCrashHandler(); fml::CommandLine cmd = fml::CommandLineFromArgcArgv(argc, argv); txt::SetCommandLine(cmd); txt::SetFontDir(flutter::testing::GetFixturesPath());