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/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 (*annotations)["channel"] = base::UTF16ToUTF8(channel_name); | 45 (*annotations)["channel"] = base::UTF16ToUTF8(channel_name); |
46 if (!special_build.empty()) | 46 if (!special_build.empty()) |
47 (*annotations)["special"] = base::UTF16ToUTF8(special_build); | 47 (*annotations)["special"] = base::UTF16ToUTF8(special_build); |
48 #if defined(ARCH_CPU_X86) | 48 #if defined(ARCH_CPU_X86) |
49 (*annotations)["plat"] = std::string("Win32"); | 49 (*annotations)["plat"] = std::string("Win32"); |
50 #elif defined(ARCH_CPU_X86_64) | 50 #elif defined(ARCH_CPU_X86_64) |
51 (*annotations)["plat"] = std::string("Win64"); | 51 (*annotations)["plat"] = std::string("Win64"); |
52 #endif | 52 #endif |
53 } | 53 } |
54 | 54 |
55 base::FilePath PlatformCrashpadInitialization(bool initial_client, | 55 base::FilePath PlatformCrashpadInitialization( |
56 bool browser_process, | 56 bool initial_client, |
57 bool embedded_handler) { | 57 bool browser_process, |
58 bool embedded_handler, | |
59 const std::string& user_data_dir) { | |
58 base::FilePath database_path; // Only valid in the browser process. | 60 base::FilePath database_path; // Only valid in the browser process. |
59 base::FilePath metrics_path; // Only valid in the browser process. | 61 base::FilePath metrics_path; // Only valid in the browser process. |
60 | 62 |
61 const char kPipeNameVar[] = "CHROME_CRASHPAD_PIPE_NAME"; | 63 const char kPipeNameVar[] = "CHROME_CRASHPAD_PIPE_NAME"; |
62 const char kServerUrlVar[] = "CHROME_CRASHPAD_SERVER_URL"; | 64 const char kServerUrlVar[] = "CHROME_CRASHPAD_SERVER_URL"; |
63 std::unique_ptr<base::Environment> env(base::Environment::Create()); | 65 std::unique_ptr<base::Environment> env(base::Environment::Create()); |
64 if (initial_client) { | 66 if (initial_client) { |
65 CrashReporterClient* crash_reporter_client = GetCrashReporterClient(); | 67 CrashReporterClient* crash_reporter_client = GetCrashReporterClient(); |
66 | 68 |
67 base::string16 database_path_str; | 69 base::string16 database_path_str; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 crashpad::TriState::kEnabled, kIndirectMemoryLimit); | 102 crashpad::TriState::kEnabled, kIndirectMemoryLimit); |
101 } | 103 } |
102 | 104 |
103 // If the handler is embedded in the binary (e.g. chrome, setup), we | 105 // If the handler is embedded in the binary (e.g. chrome, setup), we |
104 // reinvoke it with --type=crashpad-handler. Otherwise, we use the | 106 // reinvoke it with --type=crashpad-handler. Otherwise, we use the |
105 // standalone crashpad_handler.exe (for tests, etc.). | 107 // standalone crashpad_handler.exe (for tests, etc.). |
106 std::vector<std::string> start_arguments; | 108 std::vector<std::string> start_arguments; |
107 if (embedded_handler) { | 109 if (embedded_handler) { |
108 start_arguments.push_back(std::string("--type=") + | 110 start_arguments.push_back(std::string("--type=") + |
109 switches::kCrashpadHandler); | 111 switches::kCrashpadHandler); |
112 start_arguments.push_back(std::string("--user-data-dir=") + | |
113 user_data_dir); | |
Sigurður Ásgeirsson
2017/05/10 17:46:23
Is this appropriately escaped already?
manzagop (departed)
2017/05/10 23:06:11
It comes directly from install_static::GetUserData
Sigurður Ásgeirsson
2017/05/11 13:48:32
Looks like Crashpad uses this: https://chromium.go
manzagop (departed)
2017/05/11 14:54:45
Looks like this is already applied to all argument
Sigurður Ásgeirsson
2017/05/11 15:33:40
Ah - figures. There's no escaping the escaping, al
manzagop (departed)
2017/05/11 19:14:53
Acknowledged.
| |
110 // The prefetch argument added here has to be documented in | 114 // The prefetch argument added here has to be documented in |
111 // chrome_switches.cc, below the kPrefetchArgument* constants. A constant | 115 // chrome_switches.cc, below the kPrefetchArgument* constants. A constant |
112 // can't be used here because crashpad can't depend on Chrome. | 116 // can't be used here because crashpad can't depend on Chrome. |
113 start_arguments.push_back("/prefetch:7"); | 117 start_arguments.push_back("/prefetch:7"); |
114 } else { | 118 } else { |
115 base::FilePath exe_dir = exe_file.DirName(); | 119 base::FilePath exe_dir = exe_file.DirName(); |
116 exe_file = exe_dir.Append(FILE_PATH_LITERAL("crashpad_handler.exe")); | 120 exe_file = exe_dir.Append(FILE_PATH_LITERAL("crashpad_handler.exe")); |
117 } | 121 } |
118 | 122 |
119 std::vector<std::string> arguments(start_arguments); | 123 std::vector<std::string> arguments(start_arguments); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
356 void __declspec(dllexport) __cdecl UnregisterNonABICompliantCodeRange( | 360 void __declspec(dllexport) __cdecl UnregisterNonABICompliantCodeRange( |
357 void* start) { | 361 void* start) { |
358 ExceptionHandlerRecord* record = | 362 ExceptionHandlerRecord* record = |
359 reinterpret_cast<ExceptionHandlerRecord*>(start); | 363 reinterpret_cast<ExceptionHandlerRecord*>(start); |
360 | 364 |
361 CHECK(RtlDeleteFunctionTable(&record->runtime_function)); | 365 CHECK(RtlDeleteFunctionTable(&record->runtime_function)); |
362 } | 366 } |
363 #endif // ARCH_CPU_X86_64 | 367 #endif // ARCH_CPU_X86_64 |
364 | 368 |
365 } // extern "C" | 369 } // extern "C" |
OLD | NEW |