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, |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 #include "base/basictypes.h" | 25 #include "base/basictypes.h" |
26 #include "base/memory/scoped_ptr.h" | 26 #include "base/memory/scoped_ptr.h" |
27 #include "client/crashpad_info.h" | 27 #include "client/crashpad_info.h" |
28 #include "snapshot/crashpad_info_client_options.h" | 28 #include "snapshot/crashpad_info_client_options.h" |
29 #include "snapshot/exception_snapshot.h" | 29 #include "snapshot/exception_snapshot.h" |
30 #include "snapshot/module_snapshot.h" | 30 #include "snapshot/module_snapshot.h" |
31 #include "snapshot/process_snapshot.h" | 31 #include "snapshot/process_snapshot.h" |
32 #include "snapshot/system_snapshot.h" | 32 #include "snapshot/system_snapshot.h" |
33 #include "snapshot/thread_snapshot.h" | 33 #include "snapshot/thread_snapshot.h" |
| 34 #include "snapshot/win/exception_snapshot_win.h" |
34 #include "snapshot/win/module_snapshot_win.h" | 35 #include "snapshot/win/module_snapshot_win.h" |
35 #include "snapshot/win/system_snapshot_win.h" | 36 #include "snapshot/win/system_snapshot_win.h" |
36 #include "snapshot/win/thread_snapshot_win.h" | 37 #include "snapshot/win/thread_snapshot_win.h" |
37 #include "util/misc/initialization_state_dcheck.h" | 38 #include "util/misc/initialization_state_dcheck.h" |
38 #include "util/misc/uuid.h" | 39 #include "util/misc/uuid.h" |
| 40 #include "util/win/address_types.h" |
39 #include "util/stdlib/pointer_container.h" | 41 #include "util/stdlib/pointer_container.h" |
40 | 42 |
41 namespace crashpad { | 43 namespace crashpad { |
42 | 44 |
43 //! \brief A ProcessSnapshot of a running (or crashed) process running on a | 45 //! \brief A ProcessSnapshot of a running (or crashed) process running on a |
44 //! Windows system. | 46 //! Windows system. |
45 class ProcessSnapshotWin final : public ProcessSnapshot { | 47 class ProcessSnapshotWin final : public ProcessSnapshot { |
46 public: | 48 public: |
47 ProcessSnapshotWin(); | 49 ProcessSnapshotWin(); |
48 ~ProcessSnapshotWin() override; | 50 ~ProcessSnapshotWin() override; |
49 | 51 |
50 //! \brief Initializes the object. | 52 //! \brief Initializes the object. |
51 //! | 53 //! |
52 //! \param[in] process The handle to create a snapshot from. | 54 //! \param[in] process The handle to create a snapshot from. |
53 //! | 55 //! |
54 //! \return `true` if the snapshot could be created, `false` otherwise with | 56 //! \return `true` if the snapshot could be created, `false` otherwise with |
55 //! an appropriate message logged. | 57 //! an appropriate message logged. |
56 bool Initialize(HANDLE process); | 58 bool Initialize(HANDLE process); |
57 | 59 |
| 60 //! \brief Initializes the object's exception. |
| 61 //! |
| 62 //! This populates the data to be returned by Exception(). The parameters may |
| 63 //! be passed directly through from a Windows exception handler. |
| 64 //! |
| 65 //! This method must not be called until after a successful call to |
| 66 //! Initialize(). |
| 67 //! |
| 68 //! \return `true` if the exception information could be initialized, `false` |
| 69 //! otherwise with an appropriate message logged. When this method returns |
| 70 //! `false`, the ProcessSnapshotWin object's validity remains unchanged. |
| 71 bool InitializeException(DWORD thread_id, |
| 72 WinVMAddress exception_pointers); |
| 73 |
58 //! \brief Sets the value to be returned by ReportID(). | 74 //! \brief Sets the value to be returned by ReportID(). |
59 //! | 75 //! |
60 //! The crash report ID is under the control of the snapshot producer, which | 76 //! The crash report ID is under the control of the snapshot producer, which |
61 //! may call this method to set the report ID. If this is not done, ReportID() | 77 //! may call this method to set the report ID. If this is not done, ReportID() |
62 //! will return an identifier consisting entirely of zeroes. | 78 //! will return an identifier consisting entirely of zeroes. |
63 void SetReportID(const UUID& report_id) { report_id_ = report_id; } | 79 void SetReportID(const UUID& report_id) { report_id_ = report_id; } |
64 | 80 |
65 //! \brief Sets the value to be returned by ClientID(). | 81 //! \brief Sets the value to be returned by ClientID(). |
66 //! | 82 //! |
67 //! The client ID is under the control of the snapshot producer, which may | 83 //! The client ID is under the control of the snapshot producer, which may |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 private: | 122 private: |
107 // Initializes threads_ on behalf of Initialize(). | 123 // Initializes threads_ on behalf of Initialize(). |
108 void InitializeThreads(); | 124 void InitializeThreads(); |
109 | 125 |
110 // Initializes modules_ on behalf of Initialize(). | 126 // Initializes modules_ on behalf of Initialize(). |
111 void InitializeModules(); | 127 void InitializeModules(); |
112 | 128 |
113 internal::SystemSnapshotWin system_; | 129 internal::SystemSnapshotWin system_; |
114 PointerVector<internal::ThreadSnapshotWin> threads_; | 130 PointerVector<internal::ThreadSnapshotWin> threads_; |
115 PointerVector<internal::ModuleSnapshotWin> modules_; | 131 PointerVector<internal::ModuleSnapshotWin> modules_; |
116 // TODO(scottmg): scoped_ptr<internal::ExceptionSnapshotWin> exception_; | 132 scoped_ptr<internal::ExceptionSnapshotWin> exception_; |
117 ProcessReaderWin process_reader_; | 133 ProcessReaderWin process_reader_; |
118 UUID report_id_; | 134 UUID report_id_; |
119 UUID client_id_; | 135 UUID client_id_; |
120 std::map<std::string, std::string> annotations_simple_map_; | 136 std::map<std::string, std::string> annotations_simple_map_; |
121 timeval snapshot_time_; | 137 timeval snapshot_time_; |
122 InitializationStateDcheck initialized_; | 138 InitializationStateDcheck initialized_; |
123 | 139 |
124 DISALLOW_COPY_AND_ASSIGN(ProcessSnapshotWin); | 140 DISALLOW_COPY_AND_ASSIGN(ProcessSnapshotWin); |
125 }; | 141 }; |
126 | 142 |
127 } // namespace crashpad | 143 } // namespace crashpad |
128 | 144 |
129 #endif // CRASHPAD_SNAPSHOT_WIN_PROCESS_SNAPSHOT_WIN_H_ | 145 #endif // CRASHPAD_SNAPSHOT_WIN_PROCESS_SNAPSHOT_WIN_H_ |
OLD | NEW |