diff --git a/engine/src/flutter/flow/flow_run_all_unittests.cc b/engine/src/flutter/flow/flow_run_all_unittests.cc index efa27a74338..e2106829a83 100644 --- a/engine/src/flutter/flow/flow_run_all_unittests.cc +++ b/engine/src/flutter/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/engine/src/flutter/fml/backtrace.cc b/engine/src/flutter/fml/backtrace.cc index 98e5c22b4fd..bcf9ca7ea15 100644 --- a/engine/src/flutter/fml/backtrace.cc +++ b/engine/src/flutter/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/engine/src/flutter/third_party/txt/tests/txt_run_all_unittests.cc b/engine/src/flutter/third_party/txt/tests/txt_run_all_unittests.cc index e2db322bbc1..dceb19277c9 100644 --- a/engine/src/flutter/third_party/txt/tests/txt_run_all_unittests.cc +++ b/engine/src/flutter/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());