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

Side by Side Diff: client/crashpad_client_win.cc

Issue 1126413008: win: Implement exception snapshot (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: fixes2 Created 5 years, 4 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
« no previous file with comments | « no previous file | client/crashpad_info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // anything that might cause allocations, call into kernel mode, etc. So, we 49 // anything that might cause allocations, call into kernel mode, etc. So, we
50 // don't want to take a critical section here to avoid simultaneous access to 50 // don't want to take a critical section here to avoid simultaneous access to
51 // the global exception pointers in CrashpadInfo. Because the crash handler 51 // the global exception pointers in CrashpadInfo. Because the crash handler
52 // will record all threads, it's fine to simply have the second and subsequent 52 // will record all threads, it's fine to simply have the second and subsequent
53 // entrants block here. They will soon be suspended by the crash handler, and 53 // entrants block here. They will soon be suspended by the crash handler, and
54 // then the entire process will be terminated below. This means that we won't 54 // then the entire process will be terminated below. This means that we won't
55 // save the exception pointers from the second and further crashes, but 55 // save the exception pointers from the second and further crashes, but
56 // contention here is very unlikely, and we'll still have a stack that's 56 // contention here is very unlikely, and we'll still have a stack that's
57 // blocked at this location. 57 // blocked at this location.
58 if (base::subtle::Barrier_AtomicIncrement(&g_have_crashed, 1) > 1) { 58 if (base::subtle::Barrier_AtomicIncrement(&g_have_crashed, 1) > 1) {
59 SleepEx(false, INFINITE); 59 SleepEx(INFINITE, false);
60 } 60 }
61 61
62 // Otherwise, we're the first thread, so record the exception pointer and 62 // Otherwise, we're the first thread, so record the exception pointer and
63 // signal the crash handler. 63 // signal the crash handler.
64 crashpad::CrashpadInfo::GetCrashpadInfo()->set_thread_id(
65 GetCurrentThreadId());
64 crashpad::CrashpadInfo::GetCrashpadInfo()->set_exception_pointers( 66 crashpad::CrashpadInfo::GetCrashpadInfo()->set_exception_pointers(
65 exception_pointers); 67 exception_pointers);
66 DWORD rv = SignalObjectAndWait(g_signal_exception, 68 DWORD rv = SignalObjectAndWait(g_signal_exception,
67 g_wait_termination, 69 g_wait_termination,
68 kMillisecondsUntilTerminate, 70 kMillisecondsUntilTerminate,
69 FALSE); 71 false);
70 if (rv != WAIT_OBJECT_0) { 72 if (rv != WAIT_OBJECT_0) {
71 // Something went wrong. It is likely that a dump has not been created. 73 // Something went wrong. It is likely that a dump has not been created.
72 if (rv == WAIT_TIMEOUT) { 74 if (rv == WAIT_TIMEOUT) {
73 LOG(WARNING) << "SignalObjectAndWait timed out"; 75 LOG(WARNING) << "SignalObjectAndWait timed out";
74 } else { 76 } else {
75 PLOG(WARNING) << "SignalObjectAndWait error"; 77 PLOG(WARNING) << "SignalObjectAndWait error";
76 } 78 }
77 } 79 }
78 // We don't want to generate more exceptions, so we take the fast route. 80 // We don't want to generate more exceptions, so we take the fast route.
79 TerminateProcess(GetCurrentProcess(), kCrashExitCode); 81 TerminateProcess(GetCurrentProcess(), kCrashExitCode);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 return false; 168 return false;
167 if (!g_wait_termination) 169 if (!g_wait_termination)
168 return false; 170 return false;
169 // In theory we could store the previous handler but it is not clear what 171 // In theory we could store the previous handler but it is not clear what
170 // use we have for it. 172 // use we have for it.
171 SetUnhandledExceptionFilter(&UnhandledExceptionHandler); 173 SetUnhandledExceptionFilter(&UnhandledExceptionHandler);
172 return true; 174 return true;
173 } 175 }
174 176
175 } // namespace crashpad 177 } // namespace crashpad
OLDNEW
« no previous file with comments | « no previous file | client/crashpad_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698