OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
| 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at |
| 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. |
| 14 |
| 15 #ifndef CRASHPAD_SNAPSHOT_WIN_EXCEPTION_SNAPSHOT_WIN_H_ |
| 16 #define CRASHPAD_SNAPSHOT_WIN_EXCEPTION_SNAPSHOT_WIN_H_ |
| 17 |
| 18 #include <stdint.h> |
| 19 #include <windows.h> |
| 20 |
| 21 #include "base/basictypes.h" |
| 22 #include "build/build_config.h" |
| 23 #include "snapshot/cpu_context.h" |
| 24 #include "snapshot/exception_snapshot.h" |
| 25 #include "util/misc/initialization_state_dcheck.h" |
| 26 #include "util/win/address_types.h" |
| 27 |
| 28 namespace crashpad { |
| 29 |
| 30 class ProcessReaderWin; |
| 31 |
| 32 namespace internal { |
| 33 |
| 34 class ExceptionSnapshotWin final : public ExceptionSnapshot { |
| 35 public: |
| 36 ExceptionSnapshotWin(); |
| 37 ~ExceptionSnapshotWin() override; |
| 38 |
| 39 //! \brief Initializes the object. |
| 40 //! |
| 41 //! \param[in] process_reader A ProcessReader for the process that sustained |
| 42 //! the exception. |
| 43 //! \param[in] thread_id The thread ID in which the exception occurred. |
| 44 //! \param[in] exception_pointers_address The address of an |
| 45 //! `EXCEPTION_POINTERS` record in the target process, passed through from |
| 46 //! the exception handler. |
| 47 //! |
| 48 //! \return `true` if the snapshot could be created, `false` otherwise with |
| 49 //! an appropriate message logged. |
| 50 bool Initialize(ProcessReaderWin* process_reader, |
| 51 DWORD thread_id, |
| 52 WinVMAddress exception_pointers); |
| 53 |
| 54 // ExceptionSnapshot: |
| 55 |
| 56 const CPUContext* Context() const override; |
| 57 uint64_t ThreadID() const override; |
| 58 uint32_t Exception() const override; |
| 59 uint32_t ExceptionInfo() const override; |
| 60 uint64_t ExceptionAddress() const override; |
| 61 const std::vector<uint64_t>& Codes() const override; |
| 62 |
| 63 private: |
| 64 #if defined(ARCH_CPU_X86_FAMILY) |
| 65 union { |
| 66 CPUContextX86 x86; |
| 67 CPUContextX86_64 x86_64; |
| 68 } context_union_; |
| 69 #endif |
| 70 CPUContext context_; |
| 71 std::vector<uint64_t> codes_; |
| 72 uint64_t thread_id_; |
| 73 uint64_t exception_address_; |
| 74 uint32_t exception_flags_; |
| 75 DWORD exception_code_; |
| 76 InitializationStateDcheck initialized_; |
| 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(ExceptionSnapshotWin); |
| 79 }; |
| 80 |
| 81 } // namespace internal |
| 82 } // namespace crashpad |
| 83 |
| 84 #endif // CRASHPAD_SNAPSHOT_WIN_EXCEPTION_SNAPSHOT_WIN_H_ |
OLD | NEW |