diff options
author | robertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-28 00:45:08 +0000 |
---|---|---|
committer | robertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-28 00:45:08 +0000 |
commit | 219d1a6b592cfcb4028b4ff58bb3b4bb4e1684ec (patch) | |
tree | aee53daa006731931e148338f5fdcdc06db2ed24 /chrome_frame/exception_barrier.cc | |
parent | f24cd4f823335a899eba16aafe28d56f907f4b33 (diff) | |
download | chromium_src-219d1a6b592cfcb4028b4ff58bb3b4bb4e1684ec.zip chromium_src-219d1a6b592cfcb4028b4ff58bb3b4bb4e1684ec.tar.gz chromium_src-219d1a6b592cfcb4028b4ff58bb3b4bb4e1684ec.tar.bz2 |
Add an ExceptionBarrier around outbound calls to patched methods in IE. In so doing, we have an SEH present in the SEH chain and so the VEH won't erroneously report crashes that occur in other modules when we happen to be on the stack.
BUG=42660
TEST=Less false positives in the crash reports.
Review URL: http://codereview.chromium.org/1733021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45764 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/exception_barrier.cc')
-rw-r--r-- | chrome_frame/exception_barrier.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/chrome_frame/exception_barrier.cc b/chrome_frame/exception_barrier.cc new file mode 100644 index 0000000..95c12f3 --- /dev/null +++ b/chrome_frame/exception_barrier.cc @@ -0,0 +1,41 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// A class to make it easy to tag exception propagation boundaries and +// get crash reports of exceptions that pass over same. +#include "chrome_frame/exception_barrier.h" + +enum { + // Flag set by exception handling machinery when unwinding + EH_UNWINDING = 0x00000002 +}; + +ExceptionBarrier::ExceptionHandler ExceptionBarrier::s_handler_ = NULL; + +// This function must be extern "C" to match up with the SAFESEH +// declaration in our corresponding ASM file +extern "C" EXCEPTION_DISPOSITION __cdecl +ExceptionBarrierHandler(struct _EXCEPTION_RECORD *exception_record, + void * establisher_frame, + struct _CONTEXT *context, + void * reserved) { + establisher_frame; // unreferenced formal parameter + reserved; + if (!(exception_record->ExceptionFlags & EH_UNWINDING)) { + // When the exception is really propagating through us, we'd like to be + // called before the state of the program has been modified by the stack + // unwinding. In the absence of an exception handler, the unhandled + // exception filter gets called between the first chance and the second + // chance exceptions, so Windows pops either the JIT debugger or WER UI. + // This is not desirable in most of the cases. + ExceptionBarrier::ExceptionHandler handler = ExceptionBarrier::handler(); + if (handler) { + EXCEPTION_POINTERS ptrs = { exception_record, context }; + + handler(&ptrs); + } + } + + return ExceptionContinueSearch; +} |