summaryrefslogtreecommitdiffstats
path: root/chrome_frame/crash_reporting
diff options
context:
space:
mode:
authorrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-01 02:10:06 +0000
committerrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-01 02:10:06 +0000
commit72354315dd3c9682370ee2eea62446b7e5539990 (patch)
tree4f8be23e6d8ec76c7d537ca693815a7405cf2f02 /chrome_frame/crash_reporting
parentc96c3c973c12f552ed6abd565fd326c32c227a5f (diff)
downloadchromium_src-72354315dd3c9682370ee2eea62446b7e5539990.zip
chromium_src-72354315dd3c9682370ee2eea62446b7e5539990.tar.gz
chromium_src-72354315dd3c9682370ee2eea62446b7e5539990.tar.bz2
Avoid reporting crashes for exceptions that hit our SEH from calls to the original implementation of BindToStorage() when we do not wrap the bind status callback.
BUG=42660 TEST=Induce exception in code called under original IMoniker::BindToStorage implementation when we don't wrap the callback and notice that no crash is reported. Review URL: http://codereview.chromium.org/1748016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46176 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/crash_reporting')
-rw-r--r--chrome_frame/crash_reporting/crash_report.cc39
-rw-r--r--chrome_frame/crash_reporting/vectored_handler-impl.h42
2 files changed, 48 insertions, 33 deletions
diff --git a/chrome_frame/crash_reporting/crash_report.cc b/chrome_frame/crash_reporting/crash_report.cc
index cfb4e95..4589bab 100644
--- a/chrome_frame/crash_reporting/crash_report.cc
+++ b/chrome_frame/crash_reporting/crash_report.cc
@@ -47,36 +47,6 @@ static void veh_segment_end() {}
#pragma code_seg(push, ".text$vm")
#include "chrome_frame/crash_reporting/vectored_handler-impl.h"
-// Use Win32 API; use breakpad for dumps; checks for single (current) module.
-class CrashHandlerTraits : public Win32VEHTraits,
- public ModuleOfInterestWithExcludedRegion {
- public:
- CrashHandlerTraits() {}
-
- // Note that breakpad_lock must be held when this is called.
- void Init(google_breakpad::ExceptionHandler* breakpad, Lock* breakpad_lock) {
- DCHECK(breakpad);
- DCHECK(breakpad_lock);
- breakpad_lock->AssertAcquired();
-
- Win32VEHTraits::InitializeIgnoredBlocks();
- ModuleOfInterestWithExcludedRegion::SetCurrentModule();
- // Pointers to static (non-extern) functions take the address of the
- // function's first byte, as opposed to an entry in the compiler generated
- // JMP table. In release builds /OPT:REF wipes away the JMP table, but debug
- // builds are not so lucky.
- ModuleOfInterestWithExcludedRegion::SetExcludedRegion(&veh_segment_start,
- &veh_segment_end);
- }
-
- void Shutdown() {
- }
-
- inline bool WriteDump(EXCEPTION_POINTERS* p) {
- return WriteMinidumpForException(p);
- }
-};
-
class CrashHandler {
public:
CrashHandler() : veh_id_(NULL), handler_(&crash_api_) {}
@@ -115,14 +85,17 @@ bool CrashHandler::Init(google_breakpad::ExceptionHandler* breakpad,
if (veh_id_)
return true;
+ crash_api_.Init(&veh_segment_start, &veh_segment_end,
+ &WriteMinidumpForException);
+
void* id = ::AddVectoredExceptionHandler(FALSE, &VectoredHandlerEntryPoint);
if (id != NULL) {
veh_id_ = id;
- crash_api_.Init(breakpad, breakpad_lock);
return true;
+ } else {
+ crash_api_.Shutdown();
+ return false;
}
-
- return false;
}
void CrashHandler::Shutdown() {
diff --git a/chrome_frame/crash_reporting/vectored_handler-impl.h b/chrome_frame/crash_reporting/vectored_handler-impl.h
index 641522f..175e496 100644
--- a/chrome_frame/crash_reporting/vectored_handler-impl.h
+++ b/chrome_frame/crash_reporting/vectored_handler-impl.h
@@ -4,6 +4,8 @@
#ifndef CHROME_FRAME_CRASH_REPORTING_VECTORED_HANDLER_IMPL_H_
#define CHROME_FRAME_CRASH_REPORTING_VECTORED_HANDLER_IMPL_H_
+
+#include "base/logging.h"
#include "chrome_frame/crash_reporting/vectored_handler.h"
#include "chrome_frame/crash_reporting/nt_loader.h"
@@ -262,4 +264,44 @@ Win32VEHTraits::IgnoreExceptions[kIgnoreEntries] = {
{ "kernel32.dll", "IsBadStringPtrW", 0, 100, NULL },
};
+// Use Win32 API; checks for single (current) module. Will call a specified
+// CrashHandlerTraits::DumpHandler when taking a dump.
+class CrashHandlerTraits : public Win32VEHTraits,
+ public ModuleOfInterestWithExcludedRegion {
+ public:
+
+ typedef bool (*DumpHandler)(EXCEPTION_POINTERS* p);
+
+ CrashHandlerTraits() : dump_handler_(NULL) {}
+
+ // Note that breakpad_lock must be held when this is called.
+ void Init(const void* veh_segment_start, const void* veh_segment_end,
+ DumpHandler dump_handler) {
+ DCHECK(dump_handler);
+ dump_handler_ = dump_handler;
+ Win32VEHTraits::InitializeIgnoredBlocks();
+ ModuleOfInterestWithExcludedRegion::SetCurrentModule();
+ // Pointers to static (non-extern) functions take the address of the
+ // function's first byte, as opposed to an entry in the compiler generated
+ // JMP table. In release builds /OPT:REF wipes away the JMP table, but debug
+ // builds are not so lucky.
+ ModuleOfInterestWithExcludedRegion::SetExcludedRegion(veh_segment_start,
+ veh_segment_end);
+ }
+
+ void Shutdown() {
+ }
+
+ inline bool WriteDump(EXCEPTION_POINTERS* p) {
+ if (dump_handler_) {
+ return dump_handler_(p);
+ } else {
+ return false;
+ }
+ }
+
+ private:
+ DumpHandler dump_handler_;
+};
+
#endif // CHROME_FRAME_CRASH_REPORTING_VECTORED_HANDLER_IMPL_H_