OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/crash/content/app/crashpad.h" | 5 #include "components/crash/content/app/crashpad.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/numerics/safe_conversions.h" | 11 #include "base/numerics/safe_conversions.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "components/crash/content/app/crash_reporter_client.h" | 16 #include "components/crash/content/app/crash_reporter_client.h" |
17 #include "components/crash/content/app/crash_switches.h" | 17 #include "components/crash/content/app/crash_switches.h" |
18 #include "components/startup_metric_utils/common/pre_read_field_trial_utils_win.
h" | |
19 #include "third_party/crashpad/crashpad/client/crashpad_client.h" | 18 #include "third_party/crashpad/crashpad/client/crashpad_client.h" |
20 #include "third_party/crashpad/crashpad/client/crashpad_info.h" | 19 #include "third_party/crashpad/crashpad/client/crashpad_info.h" |
21 #include "third_party/crashpad/crashpad/client/simulate_crash_win.h" | 20 #include "third_party/crashpad/crashpad/client/simulate_crash_win.h" |
22 | 21 |
23 namespace crash_reporter { | 22 namespace crash_reporter { |
24 namespace internal { | 23 namespace internal { |
25 | 24 |
26 namespace { | 25 namespace { |
27 | 26 |
28 base::LazyInstance<crashpad::CrashpadClient>::Leaky g_crashpad_client = | 27 base::LazyInstance<crashpad::CrashpadClient>::Leaky g_crashpad_client = |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 crashpad::TriState::kEnabled, kIndirectMemoryLimit); | 93 crashpad::TriState::kEnabled, kIndirectMemoryLimit); |
95 } | 94 } |
96 | 95 |
97 // If the handler is embedded in the binary (e.g. chrome, setup), we | 96 // If the handler is embedded in the binary (e.g. chrome, setup), we |
98 // reinvoke it with --type=crashpad-handler. Otherwise, we use the | 97 // reinvoke it with --type=crashpad-handler. Otherwise, we use the |
99 // standalone crashpad_handler.exe (for tests, etc.). | 98 // standalone crashpad_handler.exe (for tests, etc.). |
100 std::vector<std::string> arguments; | 99 std::vector<std::string> arguments; |
101 if (embedded_handler) { | 100 if (embedded_handler) { |
102 arguments.push_back(std::string("--type=") + switches::kCrashpadHandler); | 101 arguments.push_back(std::string("--type=") + switches::kCrashpadHandler); |
103 // The prefetch argument added here has to be documented in | 102 // The prefetch argument added here has to be documented in |
104 // chrome_switches.cc, below the kPrefetchArgument* constants. A | 103 // chrome_switches.cc, below the kPrefetchArgument* constants. A constant |
105 // constant can't be used here because crashpad can't depend on Chrome. | 104 // can't be used here because crashpad can't depend on Chrome. |
106 arguments.push_back("/prefetch:7"); | 105 arguments.push_back("/prefetch:7"); |
107 } else { | 106 } else { |
108 base::FilePath exe_dir = exe_file.DirName(); | 107 base::FilePath exe_dir = exe_file.DirName(); |
109 exe_file = exe_dir.Append(FILE_PATH_LITERAL("crashpad_handler.exe")); | 108 exe_file = exe_dir.Append(FILE_PATH_LITERAL("crashpad_handler.exe")); |
110 } | 109 } |
111 // TODO(scottmg): See https://crashpad.chromium.org/bug/23. | 110 // TODO(scottmg): See https://crashpad.chromium.org/bug/23. |
112 arguments.push_back("--no-rate-limit"); | 111 arguments.push_back("--no-rate-limit"); |
113 | 112 |
114 result = g_crashpad_client.Get().StartHandler( | 113 result = g_crashpad_client.Get().StartHandler( |
115 exe_file, database_path, url, process_annotations, arguments, false); | 114 exe_file, database_path, url, process_annotations, arguments, false); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 void __declspec(dllexport) __cdecl UnregisterNonABICompliantCodeRange( | 285 void __declspec(dllexport) __cdecl UnregisterNonABICompliantCodeRange( |
287 void* start) { | 286 void* start) { |
288 ExceptionHandlerRecord* record = | 287 ExceptionHandlerRecord* record = |
289 reinterpret_cast<ExceptionHandlerRecord*>(start); | 288 reinterpret_cast<ExceptionHandlerRecord*>(start); |
290 | 289 |
291 CHECK(RtlDeleteFunctionTable(&record->runtime_function)); | 290 CHECK(RtlDeleteFunctionTable(&record->runtime_function)); |
292 } | 291 } |
293 #endif // ARCH_CPU_X86_64 | 292 #endif // ARCH_CPU_X86_64 |
294 | 293 |
295 } // extern "C" | 294 } // extern "C" |
OLD | NEW |