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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 // chrome_switches.cc, below the kPrefetchArgument* constants. A constant | 113 // chrome_switches.cc, below the kPrefetchArgument* constants. A constant |
114 // can't be used here because crashpad can't depend on Chrome. | 114 // can't be used here because crashpad can't depend on Chrome. |
115 arguments.push_back("/prefetch:7"); | 115 arguments.push_back("/prefetch:7"); |
116 } else { | 116 } else { |
117 base::FilePath exe_dir = exe_file.DirName(); | 117 base::FilePath exe_dir = exe_file.DirName(); |
118 exe_file = exe_dir.Append(FILE_PATH_LITERAL("crashpad_handler.exe")); | 118 exe_file = exe_dir.Append(FILE_PATH_LITERAL("crashpad_handler.exe")); |
119 } | 119 } |
120 | 120 |
121 g_crashpad_client.Get().StartHandler( | 121 g_crashpad_client.Get().StartHandler( |
122 exe_file, database_path, metrics_path, url, process_annotations, | 122 exe_file, database_path, metrics_path, url, process_annotations, |
123 arguments, false, false); | 123 arguments, false, true); |
124 | 124 |
125 // If we're the browser, push the pipe name into the environment so child | 125 // If we're the browser, push the pipe name into the environment so child |
126 // processes can connect to it. If we inherited another crashpad_handler's | 126 // processes can connect to it. If we inherited another crashpad_handler's |
127 // pipe name, we'll overwrite it here. | 127 // pipe name, we'll overwrite it here. |
128 env->SetVar(kPipeNameVar, | 128 env->SetVar(kPipeNameVar, |
Mark Mentovai
2016/11/04 21:47:56
I thought that we’d be able to stick the wait in t
scottmg
2016/11/04 22:13:42
Yeah, we could make the call location of BlockUnti
| |
129 base::UTF16ToUTF8(g_crashpad_client.Get().GetHandlerIPCPipe())); | 129 base::UTF16ToUTF8(g_crashpad_client.Get().GetHandlerIPCPipe())); |
130 } else { | 130 } else { |
131 std::string pipe_name_utf8; | 131 std::string pipe_name_utf8; |
132 if (env->GetVar(kPipeNameVar, &pipe_name_utf8)) { | 132 if (env->GetVar(kPipeNameVar, &pipe_name_utf8)) { |
133 g_crashpad_client.Get().SetHandlerIPCPipe( | 133 g_crashpad_client.Get().SetHandlerIPCPipe( |
134 base::UTF8ToUTF16(pipe_name_utf8)); | 134 base::UTF8ToUTF16(pipe_name_utf8)); |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 return database_path; | 138 return database_path; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 VLOG(1) << "dumped for hang debugging"; | 183 VLOG(1) << "dumped for hang debugging"; |
184 return 0; | 184 return 0; |
185 } | 185 } |
186 | 186 |
187 MSVC_POP_WARNING() | 187 MSVC_POP_WARNING() |
188 MSVC_ENABLE_OPTIMIZE() | 188 MSVC_ENABLE_OPTIMIZE() |
189 | 189 |
190 } // namespace | 190 } // namespace |
191 | 191 |
192 } // namespace internal | 192 } // namespace internal |
193 | |
194 void BlockUntilHandlerStarted() { | |
195 if (!internal::g_crashpad_client.Get().WaitForHandlerStart()) { | |
Mark Mentovai
2016/11/04 21:47:56
This isn’t valid unless StartHandler() returned tr
scottmg
2016/11/04 22:13:41
Ah good point, I was only considering the async pa
| |
196 LOG(ERROR) << "Crashpad handler failed to start, crash reporting disabled"; | |
197 } | |
198 } | |
199 | |
193 } // namespace crash_reporter | 200 } // namespace crash_reporter |
194 | 201 |
195 extern "C" { | 202 extern "C" { |
196 | 203 |
197 // Crashes the process after generating a dump for the provided exception. Note | 204 // Crashes the process after generating a dump for the provided exception. Note |
198 // that the crash reporter should be initialized before calling this function | 205 // that the crash reporter should be initialized before calling this function |
199 // for it to do anything. | 206 // for it to do anything. |
200 // NOTE: This function is used by SyzyASAN to invoke a crash. If you change the | 207 // NOTE: This function is used by SyzyASAN to invoke a crash. If you change the |
201 // the name or signature of this function you will break SyzyASAN instrumented | 208 // the name or signature of this function you will break SyzyASAN instrumented |
202 // releases of Chrome. Please contact syzygy-team@chromium.org before doing so! | 209 // releases of Chrome. Please contact syzygy-team@chromium.org before doing so! |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
304 void __declspec(dllexport) __cdecl UnregisterNonABICompliantCodeRange( | 311 void __declspec(dllexport) __cdecl UnregisterNonABICompliantCodeRange( |
305 void* start) { | 312 void* start) { |
306 ExceptionHandlerRecord* record = | 313 ExceptionHandlerRecord* record = |
307 reinterpret_cast<ExceptionHandlerRecord*>(start); | 314 reinterpret_cast<ExceptionHandlerRecord*>(start); |
308 | 315 |
309 CHECK(RtlDeleteFunctionTable(&record->runtime_function)); | 316 CHECK(RtlDeleteFunctionTable(&record->runtime_function)); |
310 } | 317 } |
311 #endif // ARCH_CPU_X86_64 | 318 #endif // ARCH_CPU_X86_64 |
312 | 319 |
313 } // extern "C" | 320 } // extern "C" |
OLD | NEW |