Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(514)

Side by Side Diff: components/crash/content/app/crashpad_win.cc

Issue 2909623002: Change DumpProcessWithoutCrash to use load-time dynamic linking (Closed)
Patch Set: rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } else { 150 } else {
151 std::string pipe_name_utf8; 151 std::string pipe_name_utf8;
152 if (env->GetVar(kPipeNameVar, &pipe_name_utf8)) { 152 if (env->GetVar(kPipeNameVar, &pipe_name_utf8)) {
153 GetCrashpadClient().SetHandlerIPCPipe(base::UTF8ToUTF16(pipe_name_utf8)); 153 GetCrashpadClient().SetHandlerIPCPipe(base::UTF8ToUTF16(pipe_name_utf8));
154 } 154 }
155 } 155 }
156 156
157 return database_path; 157 return database_path;
158 } 158 }
159 159
160 // TODO(scottmg): http://crbug.com/546288 These exported functions are for
161 // compatibility with how Breakpad worked, but it seems like there's no need to
162 // do the CreateRemoteThread() dance with a minor extension of the Crashpad API
163 // (to just pass the pid we want a dump for). We should add that and then modify
164 // hang_crash_dump_win.cc to work in a more direct manner.
165
166 // Used for dumping a process state when there is no crash.
167 extern "C" void __declspec(dllexport) __cdecl DumpProcessWithoutCrash() {
168 CRASHPAD_SIMULATE_CRASH();
169 }
170
171 namespace { 160 namespace {
172 161
162 void DumpProcessWithoutCrash() {
163 CRASHPAD_SIMULATE_CRASH();
scottmg 2017/06/15 23:08:47 indent. ... In fact, we don't need this function a
Will Harris 2017/06/15 23:37:24 CRASHPAD_SIMULATE_CRASH calls code linked with chr
scottmg 2017/06/16 00:26:24 I'm not sure what you mean. We're calling it right
Will Harris 2017/06/21 14:31:26 only one function exists now.
164 }
165
173 // We need to prevent ICF from folding DumpProcessForHungInputThread(), 166 // We need to prevent ICF from folding DumpProcessForHungInputThread(),
174 // DumpProcessForHungInputNoCrashKeysThread() together, since that makes them 167 // DumpProcessForHungInputNoCrashKeysThread() together, since that makes them
175 // indistinguishable in crash dumps. We do this by making the function 168 // indistinguishable in crash dumps. We do this by making the function
176 // bodies unique, and prevent optimization from shuffling things around. 169 // bodies unique, and prevent optimization from shuffling things around.
177 MSVC_DISABLE_OPTIMIZE() 170 MSVC_DISABLE_OPTIMIZE()
178 MSVC_PUSH_DISABLE_WARNING(4748) 171 MSVC_PUSH_DISABLE_WARNING(4748)
179 172
180 // TODO(dtapuska): Remove when enough information is gathered where the crash 173 // TODO(dtapuska): Remove when enough information is gathered where the crash
181 // reports without crash keys come from. 174 // reports without crash keys come from.
182 DWORD WINAPI DumpProcessForHungInputThread(void* crash_keys_str) { 175 DWORD WINAPI DumpProcessForHungInputThread(void* crash_keys_str) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 void __declspec(dllexport) __cdecl UnregisterNonABICompliantCodeRange( 323 void __declspec(dllexport) __cdecl UnregisterNonABICompliantCodeRange(
331 void* start) { 324 void* start) {
332 ExceptionHandlerRecord* record = 325 ExceptionHandlerRecord* record =
333 reinterpret_cast<ExceptionHandlerRecord*>(start); 326 reinterpret_cast<ExceptionHandlerRecord*>(start);
334 327
335 CHECK(RtlDeleteFunctionTable(&record->runtime_function)); 328 CHECK(RtlDeleteFunctionTable(&record->runtime_function));
336 } 329 }
337 #endif // ARCH_CPU_X86_64 330 #endif // ARCH_CPU_X86_64
338 331
339 } // extern "C" 332 } // extern "C"
OLDNEW
« components/crash/content/app/crashpad.cc ('K') | « components/crash/content/app/crashpad.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698