| 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_CRASH_REPORTING_VECTORED_HANDLER_IMPL_H_ | 5 #ifndef CHROME_FRAME_CRASH_REPORTING_VECTORED_HANDLER_IMPL_H_ |
| 6 #define CHROME_FRAME_CRASH_REPORTING_VECTORED_HANDLER_IMPL_H_ | 6 #define CHROME_FRAME_CRASH_REPORTING_VECTORED_HANDLER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome_frame/crash_reporting/vectored_handler.h" | 9 #include "chrome_frame/crash_reporting/vectored_handler.h" |
| 10 #include "chrome_frame/crash_reporting/nt_loader.h" | 10 #include "chrome_frame/crash_reporting/nt_loader.h" |
| 11 | 11 |
| 12 #if defined(_M_IX86) | 12 #if !defined(_M_IX86) |
| 13 #error only x86 is supported for now. |
| 14 #endif |
| 15 |
| 13 #ifndef EXCEPTION_CHAIN_END | 16 #ifndef EXCEPTION_CHAIN_END |
| 14 #define EXCEPTION_CHAIN_END ((struct _EXCEPTION_REGISTRATION_RECORD*)-1) | 17 #define EXCEPTION_CHAIN_END ((struct _EXCEPTION_REGISTRATION_RECORD*)-1) |
| 18 #if !defined(_WIN32_WINNT_WIN8) |
| 15 typedef struct _EXCEPTION_REGISTRATION_RECORD { | 19 typedef struct _EXCEPTION_REGISTRATION_RECORD { |
| 16 struct _EXCEPTION_REGISTRATION_RECORD* Next; | 20 struct _EXCEPTION_REGISTRATION_RECORD* Next; |
| 17 PVOID Handler; | 21 PVOID Handler; |
| 18 } EXCEPTION_REGISTRATION_RECORD; | 22 } EXCEPTION_REGISTRATION_RECORD; |
| 19 #endif // EXCEPTION_CHAIN_END | |
| 20 #else | |
| 21 #error only x86 is supported for now. | |
| 22 #endif | |
| 23 | |
| 24 // VEH handler flags settings. | 23 // VEH handler flags settings. |
| 25 // These are grabbed from winnt.h for PocketPC. | 24 // These are grabbed from winnt.h for PocketPC. |
| 26 // Only EXCEPTION_NONCONTINUABLE in defined in "regular" winnt.h | 25 // Only EXCEPTION_NONCONTINUABLE in defined in "regular" winnt.h |
| 27 // #define EXCEPTION_NONCONTINUABLE 0x1 // Noncontinuable exception | 26 // #define EXCEPTION_NONCONTINUABLE 0x1 // Noncontinuable exception |
| 28 #define EXCEPTION_UNWINDING 0x2 // Unwind is in progress | 27 #define EXCEPTION_UNWINDING 0x2 // Unwind is in progress |
| 29 #define EXCEPTION_EXIT_UNWIND 0x4 // Exit unwind is in progress | 28 #define EXCEPTION_EXIT_UNWIND 0x4 // Exit unwind is in progress |
| 30 #define EXCEPTION_STACK_INVALID 0x8 // Stack out of limits or unaligned | 29 #define EXCEPTION_STACK_INVALID 0x8 // Stack out of limits or unaligned |
| 31 #define EXCEPTION_NESTED_CALL 0x10 // Nested exception handler call | 30 #define EXCEPTION_NESTED_CALL 0x10 // Nested exception handler call |
| 32 #define EXCEPTION_TARGET_UNWIND 0x20 // Target unwind in progress | 31 #define EXCEPTION_TARGET_UNWIND 0x20 // Target unwind in progress |
| 33 #define EXCEPTION_COLLIDED_UNWIND 0x40 // Collided exception handler call | 32 #define EXCEPTION_COLLIDED_UNWIND 0x40 // Collided exception handler call |
| 34 | 33 |
| 35 #define EXCEPTION_UNWIND (EXCEPTION_UNWINDING | EXCEPTION_EXIT_UNWIND | \ | 34 #define EXCEPTION_UNWIND (EXCEPTION_UNWINDING | EXCEPTION_EXIT_UNWIND | \ |
| 36 EXCEPTION_TARGET_UNWIND | EXCEPTION_COLLIDED_UNWIND) | 35 EXCEPTION_TARGET_UNWIND | EXCEPTION_COLLIDED_UNWIND) |
| 37 | 36 |
| 38 #define IS_UNWINDING(Flag) (((Flag) & EXCEPTION_UNWIND) != 0) | 37 #define IS_UNWINDING(Flag) (((Flag) & EXCEPTION_UNWIND) != 0) |
| 39 #define IS_DISPATCHING(Flag) (((Flag) & EXCEPTION_UNWIND) == 0) | 38 #define IS_DISPATCHING(Flag) (((Flag) & EXCEPTION_UNWIND) == 0) |
| 40 #define IS_TARGET_UNWIND(Flag) ((Flag) & EXCEPTION_TARGET_UNWIND) | 39 #define IS_TARGET_UNWIND(Flag) ((Flag) & EXCEPTION_TARGET_UNWIND) |
| 41 // End of grabbed section | 40 #endif // !defined(_WIN32_WINNT_WIN8) |
| 41 #endif // EXCEPTION_CHAIN_END |
| 42 | 42 |
| 43 template <typename E> | 43 template <typename E> |
| 44 VectoredHandlerT<E>::VectoredHandlerT(E* api) : exceptions_seen_(0), api_(api) { | 44 VectoredHandlerT<E>::VectoredHandlerT(E* api) : exceptions_seen_(0), api_(api) { |
| 45 } | 45 } |
| 46 | 46 |
| 47 template <typename E> | 47 template <typename E> |
| 48 VectoredHandlerT<E>::~VectoredHandlerT() { | 48 VectoredHandlerT<E>::~VectoredHandlerT() { |
| 49 } | 49 } |
| 50 | 50 |
| 51 template <typename E> | 51 template <typename E> |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 } else { | 280 } else { |
| 281 return false; | 281 return false; |
| 282 } | 282 } |
| 283 } | 283 } |
| 284 | 284 |
| 285 private: | 285 private: |
| 286 DumpHandler dump_handler_; | 286 DumpHandler dump_handler_; |
| 287 }; | 287 }; |
| 288 | 288 |
| 289 #endif // CHROME_FRAME_CRASH_REPORTING_VECTORED_HANDLER_IMPL_H_ | 289 #endif // CHROME_FRAME_CRASH_REPORTING_VECTORED_HANDLER_IMPL_H_ |
| OLD | NEW |