7#if defined(DART_USE_CRASHPAD)
12#include "crashpad/client/crashpad_client.h"
13#include "crashpad/client/crashpad_info.h"
23#if defined(DART_USE_CRASHPAD)
24#if !defined(DART_HOST_OS_WINDOWS)
25#error "Currently we only support Crashpad on Windows"
31 wchar_t* handler = _wgetenv(
L"DART_CRASHPAD_HANDLER");
32 wchar_t* crashes_dir = _wgetenv(
L"DART_CRASHPAD_CRASHES_DIR");
33 if (handler ==
nullptr || crashes_dir ==
nullptr || wcslen(handler) == 0 ||
34 wcslen(crashes_dir) == 0) {
40 const base::FilePath handler_path{std::wstring(handler)};
41 const base::FilePath crashes_dir_path{std::wstring(crashes_dir)};
42 const std::string url(
"");
43 std::map<std::string, std::string> annotations;
44 char* test_name =
getenv(
"DART_TEST_NAME");
45 if (test_name !=
nullptr) {
46 annotations[
"dart_test_name"] = test_name;
49 std::vector<std::string> arguments;
51 crashpad::CrashpadClient client;
56 HANDLE original_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
57 HANDLE original_stderr = GetStdHandle(STD_ERROR_HANDLE);
61 client.StartHandler(handler_path, crashes_dir_path, crashes_dir_path, url,
62 annotations, arguments,
65 SetStdHandle(STD_OUTPUT_HANDLE, original_stdout);
66 SetStdHandle(STD_ERROR_HANDLE, original_stderr);
72 crashpad::CrashpadInfo::GetCrashpadInfo()
73 ->set_gather_indirectly_referenced_memory(crashpad::TriState::kEnabled,
static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
constexpr int kErrorExitCode
void InitializeCrashpadClient()
#define INVALID_HANDLE_VALUE