Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: snapshot/win/exception_snapshot_win.h

Issue 1533183002: win: Capture some memory pointed at by context (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: mac Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « snapshot/win/end_to_end_test.py ('k') | snapshot/win/exception_snapshot_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <windows.h> 18 #include <windows.h>
19 #include <stdint.h> 19 #include <stdint.h>
20 20
21 #include "base/macros.h" 21 #include "base/macros.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/stdlib/pointer_container.h"
26 #include "util/win/address_types.h" 27 #include "util/win/address_types.h"
27 #include "util/win/process_structs.h" 28 #include "util/win/process_structs.h"
28 29
29 namespace crashpad { 30 namespace crashpad {
30 31
31 class ProcessReaderWin; 32 class ProcessReaderWin;
32 33
33 namespace internal { 34 namespace internal {
34 35
36 class MemorySnapshotWin;
37
35 class ExceptionSnapshotWin final : public ExceptionSnapshot { 38 class ExceptionSnapshotWin final : public ExceptionSnapshot {
36 public: 39 public:
37 ExceptionSnapshotWin(); 40 ExceptionSnapshotWin();
38 ~ExceptionSnapshotWin() override; 41 ~ExceptionSnapshotWin() override;
39 42
40 //! \brief Initializes the object. 43 //! \brief Initializes the object.
41 //! 44 //!
42 //! \param[in] process_reader A ProcessReader for the process that sustained 45 //! \param[in] process_reader A ProcessReader for the process that sustained
43 //! the exception. 46 //! the exception.
44 //! \param[in] thread_id The thread ID in which the exception occurred. 47 //! \param[in] thread_id The thread ID in which the exception occurred.
45 //! \param[in] exception_pointers_address The address of an 48 //! \param[in] exception_pointers_address The address of an
46 //! `EXCEPTION_POINTERS` record in the target process, passed through from 49 //! `EXCEPTION_POINTERS` record in the target process, passed through from
47 //! the exception handler. 50 //! the exception handler.
48 //! 51 //!
49 //! \return `true` if the snapshot could be created, `false` otherwise with 52 //! \return `true` if the snapshot could be created, `false` otherwise with
50 //! an appropriate message logged. 53 //! an appropriate message logged.
51 bool Initialize(ProcessReaderWin* process_reader, 54 bool Initialize(ProcessReaderWin* process_reader,
52 DWORD thread_id, 55 DWORD thread_id,
53 WinVMAddress exception_pointers); 56 WinVMAddress exception_pointers);
54 57
55 // ExceptionSnapshot: 58 // ExceptionSnapshot:
56 59
57 const CPUContext* Context() const override; 60 const CPUContext* Context() const override;
58 uint64_t ThreadID() const override; 61 uint64_t ThreadID() const override;
59 uint32_t Exception() const override; 62 uint32_t Exception() const override;
60 uint32_t ExceptionInfo() const override; 63 uint32_t ExceptionInfo() const override;
61 uint64_t ExceptionAddress() const override; 64 uint64_t ExceptionAddress() const override;
62 const std::vector<uint64_t>& Codes() const override; 65 const std::vector<uint64_t>& Codes() const override;
66 std::vector<const MemorySnapshot*> ExtraMemory() const override;
63 67
64 private: 68 private:
65 template <class ExceptionRecordType, 69 template <class ExceptionRecordType,
66 class ExceptionPointersType, 70 class ExceptionPointersType,
67 class ContextType> 71 class ContextType>
68 bool InitializeFromExceptionPointers(const ProcessReaderWin& process_reader, 72 bool InitializeFromExceptionPointers(const ProcessReaderWin& process_reader,
69 WinVMAddress exception_pointers_address, 73 WinVMAddress exception_pointers_address,
70 ContextType* context_record); 74 ContextType* context_record);
71 75
72 #if defined(ARCH_CPU_X86_FAMILY) 76 #if defined(ARCH_CPU_X86_FAMILY)
73 union { 77 union {
74 CPUContextX86 x86; 78 CPUContextX86 x86;
75 CPUContextX86_64 x86_64; 79 CPUContextX86_64 x86_64;
76 } context_union_; 80 } context_union_;
77 #endif 81 #endif
78 CPUContext context_; 82 CPUContext context_;
79 std::vector<uint64_t> codes_; 83 std::vector<uint64_t> codes_;
84 PointerVector<internal::MemorySnapshotWin> extra_memory_;
80 uint64_t thread_id_; 85 uint64_t thread_id_;
81 uint64_t exception_address_; 86 uint64_t exception_address_;
82 uint32_t exception_flags_; 87 uint32_t exception_flags_;
83 DWORD exception_code_; 88 DWORD exception_code_;
84 InitializationStateDcheck initialized_; 89 InitializationStateDcheck initialized_;
85 90
86 DISALLOW_COPY_AND_ASSIGN(ExceptionSnapshotWin); 91 DISALLOW_COPY_AND_ASSIGN(ExceptionSnapshotWin);
87 }; 92 };
88 93
89 } // namespace internal 94 } // namespace internal
90 } // namespace crashpad 95 } // namespace crashpad
91 96
92 #endif // CRASHPAD_SNAPSHOT_WIN_EXCEPTION_SNAPSHOT_WIN_H_ 97 #endif // CRASHPAD_SNAPSHOT_WIN_EXCEPTION_SNAPSHOT_WIN_H_
OLDNEW
« no previous file with comments | « snapshot/win/end_to_end_test.py ('k') | snapshot/win/exception_snapshot_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698