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

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

Issue 1126413008: win: Implement exception snapshot (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: . Created 5 years, 7 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
OLDNEW
1 // Copyright 2014 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_MAC_EXCEPTION_SNAPSHOT_MAC_H_ 15 #ifndef CRASHPAD_SNAPSHOT_WIN_EXCEPTION_SNAPSHOT_WIN_H_
16 #define CRASHPAD_SNAPSHOT_MAC_EXCEPTION_SNAPSHOT_MAC_H_ 16 #define CRASHPAD_SNAPSHOT_WIN_EXCEPTION_SNAPSHOT_WIN_H_
17 17
18 #include <mach/mach.h>
19 #include <stdint.h> 18 #include <stdint.h>
20 19 #include <windows.h>
21 #include <vector>
22 20
23 #include "base/basictypes.h" 21 #include "base/basictypes.h"
24 #include "build/build_config.h" 22 #include "build/build_config.h"
25 #include "snapshot/cpu_context.h" 23 #include "snapshot/cpu_context.h"
26 #include "snapshot/exception_snapshot.h" 24 #include "snapshot/exception_snapshot.h"
27 #include "util/mach/mach_extensions.h"
28 #include "util/misc/initialization_state_dcheck.h" 25 #include "util/misc/initialization_state_dcheck.h"
29 26
30 namespace crashpad { 27 namespace crashpad {
31 28
32 class ProcessReader; 29 class ProcessReaderWin;
33 30
34 namespace internal { 31 namespace internal {
35 32
36 //! \brief An ExceptionSnapshot of an exception sustained by a running (or 33 class ExceptionSnapshotWin final : public ExceptionSnapshot {
37 //! crashed) process on a Mac OS X system.
38 class ExceptionSnapshotMac final : public ExceptionSnapshot {
39 public: 34 public:
40 ExceptionSnapshotMac(); 35 ExceptionSnapshotWin();
41 ~ExceptionSnapshotMac() override; 36 ~ExceptionSnapshotWin() override;
42 37
43 //! \brief Initializes the object. 38 //! \brief Initializes the object.
44 //! 39 //!
45 //! Other than \a process_reader, the parameters may be passed directly
46 //! through from a Mach exception handler.
47 //!
48 //! \param[in] process_reader A ProcessReader for the task that sustained the 40 //! \param[in] process_reader A ProcessReader for the task that sustained the
49 //! exception. 41 //! exception.
42 //! \param[in] thread_handle Thread in which the exception occurred.
43 //! \param[in] exception_pointers Passed through from the exception handler.
50 //! 44 //!
51 //! \return `true` if the snapshot could be created, `false` otherwise with 45 //! \return `true` if the snapshot could be created, `false` otherwise with
52 //! an appropriate message logged. 46 //! an appropriate message logged.
53 bool Initialize(ProcessReader* process_reader, 47 bool Initialize(ProcessReaderWin* process_reader,
54 exception_behavior_t behavior, 48 HANDLE thread_handle,
55 thread_t exception_thread, 49 EXCEPTION_POINTERS* exception_pointers);
56 exception_type_t exception,
57 const mach_exception_data_type_t* code,
58 mach_msg_type_number_t code_count,
59 thread_state_flavor_t flavor,
60 ConstThreadState state,
61 mach_msg_type_number_t state_count);
62 50
63 // ExceptionSnapshot: 51 // ExceptionSnapshot:
64 52
65 const CPUContext* Context() const override; 53 const CPUContext* Context() const override;
66 uint64_t ThreadID() const override; 54 uint64_t ThreadID() const override;
67 uint32_t Exception() const override; 55 uint32_t Exception() const override;
68 uint32_t ExceptionInfo() const override; 56 uint32_t ExceptionInfo() const override;
69 uint64_t ExceptionAddress() const override; 57 uint64_t ExceptionAddress() const override;
70 const std::vector<uint64_t>& Codes() const override; 58 const std::vector<uint64_t>& Codes() const override;
71 59
72 private: 60 private:
73 #if defined(ARCH_CPU_X86_FAMILY) 61 #if defined(ARCH_CPU_X86_FAMILY)
74 union { 62 union {
75 CPUContextX86 x86; 63 CPUContextX86 x86;
76 CPUContextX86_64 x86_64; 64 CPUContextX86_64 x86_64;
77 } context_union_; 65 } context_union_;
78 #endif 66 #endif
79 CPUContext context_; 67 CPUContext context_;
80 std::vector<uint64_t> codes_; 68 std::vector<uint64_t> codes_;
81 uint64_t thread_id_; 69 uint64_t thread_id_;
82 uint64_t exception_address_; 70 uint64_t exception_address_;
83 exception_type_t exception_; 71 uint32_t exception_flags_;
84 uint32_t exception_code_0_; 72 DWORD exception_;
cpu_(ooo_6.6-7.5) 2015/05/15 01:24:13 I personally would call this the exception code si
scottmg 2015/08/18 05:08:40 Done.
85 InitializationStateDcheck initialized_; 73 InitializationStateDcheck initialized_;
86 74
87 DISALLOW_COPY_AND_ASSIGN(ExceptionSnapshotMac); 75 DISALLOW_COPY_AND_ASSIGN(ExceptionSnapshotWin);
88 }; 76 };
89 77
90 } // namespace internal 78 } // namespace internal
91 } // namespace crashpad 79 } // namespace crashpad
92 80
93 #endif // CRASHPAD_SNAPSHOT_MAC_EXCEPTION_SNAPSHOT_MAC_H_ 81 #endif // CRASHPAD_SNAPSHOT_WIN_EXCEPTION_SNAPSHOT_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698