OLD | NEW |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with 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 | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #ifndef CRASHPAD_SNAPSHOT_WIN_EXCEPTION_SNAPSHOT_WIN_H_ | 15 #ifndef CRASHPAD_SNAPSHOT_WIN_EXCEPTION_SNAPSHOT_WIN_H_ |
16 #define CRASHPAD_SNAPSHOT_WIN_EXCEPTION_SNAPSHOT_WIN_H_ | 16 #define CRASHPAD_SNAPSHOT_WIN_EXCEPTION_SNAPSHOT_WIN_H_ |
17 | 17 |
18 #include <stdint.h> | 18 #include <stdint.h> |
19 #include <windows.h> | 19 #include <windows.h> |
20 | 20 |
21 #include "base/basictypes.h" | 21 #include "base/basictypes.h" |
22 #include "build/build_config.h" | 22 #include "build/build_config.h" |
23 #include "snapshot/cpu_context.h" | 23 #include "snapshot/cpu_context.h" |
24 #include "snapshot/exception_snapshot.h" | 24 #include "snapshot/exception_snapshot.h" |
25 #include "util/misc/initialization_state_dcheck.h" | 25 #include "util/misc/initialization_state_dcheck.h" |
26 #include "util/win/address_types.h" | 26 #include "util/win/address_types.h" |
| 27 #include "util/win/process_structs.h" |
27 | 28 |
28 namespace crashpad { | 29 namespace crashpad { |
29 | 30 |
30 class ProcessReaderWin; | 31 class ProcessReaderWin; |
31 | 32 |
32 namespace internal { | 33 namespace internal { |
33 | 34 |
34 class ExceptionSnapshotWin final : public ExceptionSnapshot { | 35 class ExceptionSnapshotWin final : public ExceptionSnapshot { |
35 public: | 36 public: |
36 ExceptionSnapshotWin(); | 37 ExceptionSnapshotWin(); |
(...skipping 17 matching lines...) Expand all Loading... |
54 // ExceptionSnapshot: | 55 // ExceptionSnapshot: |
55 | 56 |
56 const CPUContext* Context() const override; | 57 const CPUContext* Context() const override; |
57 uint64_t ThreadID() const override; | 58 uint64_t ThreadID() const override; |
58 uint32_t Exception() const override; | 59 uint32_t Exception() const override; |
59 uint32_t ExceptionInfo() const override; | 60 uint32_t ExceptionInfo() const override; |
60 uint64_t ExceptionAddress() const override; | 61 uint64_t ExceptionAddress() const override; |
61 const std::vector<uint64_t>& Codes() const override; | 62 const std::vector<uint64_t>& Codes() const override; |
62 | 63 |
63 private: | 64 private: |
64 template <class ExceptionRecordType, class ContextType> | 65 template <class ExceptionRecordType, |
| 66 class ExceptionPointersType, |
| 67 class ContextType> |
65 bool InitializeFromExceptionPointers( | 68 bool InitializeFromExceptionPointers( |
66 const ProcessReaderWin& process_reader, | 69 const ProcessReaderWin& process_reader, |
67 const EXCEPTION_POINTERS& exception_pointers, | 70 const ExceptionPointersType& exception_pointers, |
68 ContextType* context_record); | 71 ContextType* context_record); |
69 | 72 |
| 73 template <class ContextRecordType> |
| 74 bool CommonX86Initialize( |
| 75 const ProcessReaderWin& process_reader, |
| 76 const process_types::EXCEPTION_POINTERS< |
| 77 process_types::internal::Traits32>& exception_pointers); |
| 78 |
| 79 template <class ExceptionPointersType> |
| 80 bool ReadExceptionPointers(const ProcessReaderWin& process_reader, |
| 81 WinVMAddress exception_pointers_address, |
| 82 ExceptionPointersType* exception_pointers); |
| 83 |
70 #if defined(ARCH_CPU_X86_FAMILY) | 84 #if defined(ARCH_CPU_X86_FAMILY) |
71 union { | 85 union { |
72 CPUContextX86 x86; | 86 CPUContextX86 x86; |
73 CPUContextX86_64 x86_64; | 87 CPUContextX86_64 x86_64; |
74 } context_union_; | 88 } context_union_; |
75 #endif | 89 #endif |
76 CPUContext context_; | 90 CPUContext context_; |
77 std::vector<uint64_t> codes_; | 91 std::vector<uint64_t> codes_; |
78 uint64_t thread_id_; | 92 uint64_t thread_id_; |
79 uint64_t exception_address_; | 93 uint64_t exception_address_; |
80 uint32_t exception_flags_; | 94 uint32_t exception_flags_; |
81 DWORD exception_code_; | 95 DWORD exception_code_; |
82 InitializationStateDcheck initialized_; | 96 InitializationStateDcheck initialized_; |
83 | 97 |
84 DISALLOW_COPY_AND_ASSIGN(ExceptionSnapshotWin); | 98 DISALLOW_COPY_AND_ASSIGN(ExceptionSnapshotWin); |
85 }; | 99 }; |
86 | 100 |
87 } // namespace internal | 101 } // namespace internal |
88 } // namespace crashpad | 102 } // namespace crashpad |
89 | 103 |
90 #endif // CRASHPAD_SNAPSHOT_WIN_EXCEPTION_SNAPSHOT_WIN_H_ | 104 #endif // CRASHPAD_SNAPSHOT_WIN_EXCEPTION_SNAPSHOT_WIN_H_ |
OLD | NEW |