| OLD | NEW |
| 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 #ifndef CHROME_FRAME_VECTORED_HANDLER_IMPL_H_ | 5 #ifndef CHROME_FRAME_CRASH_REPORTING_VECTORED_HANDLER_IMPL_H_ |
| 6 #define CHROME_FRAME_VECTORED_HANDLER_IMPL_H_ | 6 #define CHROME_FRAME_CRASH_REPORTING_VECTORED_HANDLER_IMPL_H_ |
| 7 #include "chrome_frame/vectored_handler.h" | 7 #include "chrome_frame/crash_reporting/vectored_handler.h" |
| 8 | 8 |
| 9 #if defined(_M_IX86) | 9 #if defined(_M_IX86) |
| 10 typedef struct _EXCEPTION_REGISTRATION_RECORD { | 10 typedef struct _EXCEPTION_REGISTRATION_RECORD { |
| 11 struct _EXCEPTION_REGISTRATION_RECORD* Next; | 11 struct _EXCEPTION_REGISTRATION_RECORD* Next; |
| 12 PVOID Handler; | 12 PVOID Handler; |
| 13 } EXCEPTION_REGISTRATION_RECORD; | 13 } EXCEPTION_REGISTRATION_RECORD; |
| 14 #define EXCEPTION_CHAIN_END ((struct _EXCEPTION_REGISTRATION_RECORD*)-1) | 14 #define EXCEPTION_CHAIN_END ((struct _EXCEPTION_REGISTRATION_RECORD*)-1) |
| 15 #else | 15 #else |
| 16 #error only x86 is supported for now. | 16 #error only x86 is supported for now. |
| 17 #endif | 17 #endif |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 return ExceptionContinueSearch; | 68 return ExceptionContinueSearch; |
| 69 | 69 |
| 70 if (E::IsOurModule(exceptionInfo->ExceptionRecord->ExceptionAddress)) { | 70 if (E::IsOurModule(exceptionInfo->ExceptionRecord->ExceptionAddress)) { |
| 71 E::WriteDump(exceptionInfo); | 71 E::WriteDump(exceptionInfo); |
| 72 return ExceptionContinueSearch; | 72 return ExceptionContinueSearch; |
| 73 } | 73 } |
| 74 | 74 |
| 75 // See whether our module is somewhere in the call stack. | 75 // See whether our module is somewhere in the call stack. |
| 76 void* back_trace[max_back_trace] = {0}; | 76 void* back_trace[max_back_trace] = {0}; |
| 77 // Skip RtlCaptureStackBackTrace and VectoredHandler itself. | 77 // Skip RtlCaptureStackBackTrace and VectoredHandler itself. |
| 78 DWORD captured = E::RtlCaptureStackBackTrace(2, max_back_trace - 2, | 78 DWORD captured = E::RtlCaptureStackBackTrace(2, max_back_trace - 2, |
| 79 &back_trace[0], NULL); | 79 &back_trace[0], NULL); |
| 80 for (DWORD i = 0; i < captured; ++i) { | 80 for (DWORD i = 0; i < captured; ++i) { |
| 81 if (E::IsOurModule(back_trace[i])) { | 81 if (E::IsOurModule(back_trace[i])) { |
| 82 E::WriteDump(exceptionInfo); | 82 E::WriteDump(exceptionInfo); |
| 83 return ExceptionContinueSearch; | 83 return ExceptionContinueSearch; |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 return ExceptionContinueSearch; | 88 return ExceptionContinueSearch; |
| 89 } | 89 } |
| 90 | 90 |
| 91 template <class E> | 91 template <class E> |
| 92 BOOL VectoredHandlerT<E>::ModuleHasInstalledSEHFilter() { | 92 BOOL VectoredHandlerT<E>::ModuleHasInstalledSEHFilter() { |
| 93 EXCEPTION_REGISTRATION_RECORD* RegistrationFrame = E::RtlpGetExceptionList(); | 93 EXCEPTION_REGISTRATION_RECORD* RegistrationFrame = E::RtlpGetExceptionList(); |
| 94 // TODO(stoyan): Add the stack limits check and some sanity checks like | 94 // TODO(stoyan): Add the stack limits check and some sanity checks like |
| 95 // decreasing addresses of registration records | 95 // decreasing addresses of registration records |
| 96 while (RegistrationFrame != EXCEPTION_CHAIN_END) { | 96 while (RegistrationFrame != EXCEPTION_CHAIN_END) { |
| 97 if (E::IsOurModule(RegistrationFrame->Handler)) { | 97 if (E::IsOurModule(RegistrationFrame->Handler)) { |
| 98 return TRUE; | 98 return TRUE; |
| 99 } | 99 } |
| 100 | 100 |
| 101 RegistrationFrame = RegistrationFrame->Next; | 101 RegistrationFrame = RegistrationFrame->Next; |
| 102 } | 102 } |
| 103 | 103 |
| 104 return FALSE; | 104 return FALSE; |
| 105 } | 105 } |
| 106 #endif // CHROME_FRAME_VECTORED_HANDLER_IMPL_H_ | 106 #endif // CHROME_FRAME_CRASH_REPORTING_VECTORED_HANDLER_IMPL_H_ |
| OLD | NEW |