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