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

Side by Side Diff: chrome_frame/exception_barrier.cc

Issue 1748016: Avoid reporting crashes for exceptions that hit our SEH from calls to the ori... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome_frame/exception_barrier.h ('k') | chrome_frame/exception_barrier_lowlevel.asm » ('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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // A class to make it easy to tag exception propagation boundaries and 5 // A class to make it easy to tag exception propagation boundaries and
6 // get crash reports of exceptions that pass over same. 6 // get crash reports of exceptions that pass over same.
7 #include "chrome_frame/exception_barrier.h" 7 #include "chrome_frame/exception_barrier.h"
8 8
9 #include "chrome_frame/crash_reporting/vectored_handler-impl.h"
10 #include "chrome_frame/crash_reporting/crash_report.h"
11
9 enum { 12 enum {
10 // Flag set by exception handling machinery when unwinding 13 // Flag set by exception handling machinery when unwinding
11 EH_UNWINDING = 0x00000002 14 EH_UNWINDING = 0x00000002
12 }; 15 };
13 16
14 ExceptionBarrier::ExceptionHandler ExceptionBarrier::s_handler_ = NULL; 17 bool ExceptionBarrierConfig::s_enabled_ = false;
18
19 ExceptionBarrierCustomHandler::CustomExceptionHandler
20 ExceptionBarrierCustomHandler::s_custom_handler_ = NULL;
15 21
16 // This function must be extern "C" to match up with the SAFESEH 22 // This function must be extern "C" to match up with the SAFESEH
17 // declaration in our corresponding ASM file 23 // declaration in our corresponding ASM file
18 extern "C" EXCEPTION_DISPOSITION __cdecl 24 extern "C" EXCEPTION_DISPOSITION __cdecl
19 ExceptionBarrierHandler(struct _EXCEPTION_RECORD* exception_record, 25 ExceptionBarrierHandler(struct _EXCEPTION_RECORD* exception_record,
20 void* establisher_frame, 26 void* establisher_frame,
21 struct _CONTEXT* context, 27 struct _CONTEXT* context,
22 void* reserved) { 28 void* reserved) {
23 establisher_frame; // unreferenced formal parameter 29 // When the exception is really propagating through us, we'd like to be
24 reserved; 30 // called before the state of the program has been modified by the stack
25 if (!(exception_record->ExceptionFlags & EH_UNWINDING)) { 31 // unwinding. In the absence of an exception handler, the unhandled
26 // When the exception is really propagating through us, we'd like to be 32 // exception filter gets called between the first chance and the second
27 // called before the state of the program has been modified by the stack 33 // chance exceptions, so Windows pops either the JIT debugger or WER UI.
28 // unwinding. In the absence of an exception handler, the unhandled 34 // This is not desirable in most of the cases.
29 // exception filter gets called between the first chance and the second 35 EXCEPTION_POINTERS ptrs = { exception_record, context };
30 // chance exceptions, so Windows pops either the JIT debugger or WER UI. 36
31 // This is not desirable in most of the cases. 37 if (ExceptionBarrierConfig::enabled() &&
32 ExceptionBarrier::ExceptionHandler handler = ExceptionBarrier::handler(); 38 IS_DISPATCHING(exception_record->ExceptionFlags)) {
39 WriteMinidumpForException(&ptrs);
40 }
41
42 return ExceptionContinueSearch;
43 }
44
45 extern "C" EXCEPTION_DISPOSITION __cdecl
46 ExceptionBarrierReportOnlyModuleHandler(
47 struct _EXCEPTION_RECORD* exception_record,
48 void* establisher_frame,
49 struct _CONTEXT* context,
50 void* reserved) {
51 EXCEPTION_POINTERS ptrs = { exception_record, context };
52
53 if (ExceptionBarrierConfig::enabled() &&
54 IS_DISPATCHING(exception_record->ExceptionFlags)) {
55 CrashHandlerTraits traits;
stoyan 2010/04/30 22:44:00 you know I really don't like this. :)
56 traits.Init(0, 0, &WriteMinidumpForException);
57 if (traits.IsOurModule(exception_record->ExceptionAddress)) {
58 traits.WriteDump(&ptrs);
59 }
60 }
61
62 return ExceptionContinueSearch;
63 }
64
65 extern "C" EXCEPTION_DISPOSITION __cdecl
66 ExceptionBarrierCallCustomHandler(struct _EXCEPTION_RECORD* exception_record,
67 void* establisher_frame,
68 struct _CONTEXT* context,
69 void* reserved) {
70 if (ExceptionBarrierConfig::enabled() &&
71 IS_DISPATCHING(exception_record->ExceptionFlags)) {
72 ExceptionBarrierCustomHandler::CustomExceptionHandler handler =
73 ExceptionBarrierCustomHandler::custom_handler();
33 if (handler) { 74 if (handler) {
34 EXCEPTION_POINTERS ptrs = { exception_record, context }; 75 EXCEPTION_POINTERS ptrs = { exception_record, context };
35
36 handler(&ptrs); 76 handler(&ptrs);
37 } 77 }
38 } 78 }
39 79
40 return ExceptionContinueSearch; 80 return ExceptionContinueSearch;
41 } 81 }
OLDNEW
« no previous file with comments | « chrome_frame/exception_barrier.h ('k') | chrome_frame/exception_barrier_lowlevel.asm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698