OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 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_TEST_TEST_PROCESS_SNAPSHOT_H_ | 15 #ifndef CRASHPAD_SNAPSHOT_TEST_TEST_PROCESS_SNAPSHOT_H_ |
16 #define CRASHPAD_SNAPSHOT_TEST_TEST_PROCESS_SNAPSHOT_H_ | 16 #define CRASHPAD_SNAPSHOT_TEST_TEST_PROCESS_SNAPSHOT_H_ |
17 | 17 |
18 #include <stdint.h> | 18 #include <stdint.h> |
19 #include <sys/time.h> | 19 #include <sys/time.h> |
20 #include <sys/types.h> | 20 #include <sys/types.h> |
21 | 21 |
22 #include <map> | 22 #include <map> |
23 #include <string> | 23 #include <string> |
24 #include <vector> | 24 #include <vector> |
25 | 25 |
26 #include "base/basictypes.h" | 26 #include "base/basictypes.h" |
27 #include "base/memory/scoped_ptr.h" | 27 #include "base/memory/scoped_ptr.h" |
28 #include "snapshot/exception_snapshot.h" | 28 #include "snapshot/exception_snapshot.h" |
| 29 #include "snapshot/memory_snapshot.h" |
29 #include "snapshot/module_snapshot.h" | 30 #include "snapshot/module_snapshot.h" |
30 #include "snapshot/process_snapshot.h" | 31 #include "snapshot/process_snapshot.h" |
31 #include "snapshot/system_snapshot.h" | 32 #include "snapshot/system_snapshot.h" |
32 #include "snapshot/thread_snapshot.h" | 33 #include "snapshot/thread_snapshot.h" |
33 #include "util/misc/uuid.h" | 34 #include "util/misc/uuid.h" |
34 #include "util/stdlib/pointer_container.h" | 35 #include "util/stdlib/pointer_container.h" |
35 | 36 |
36 namespace crashpad { | 37 namespace crashpad { |
37 namespace test { | 38 namespace test { |
38 | 39 |
(...skipping 25 matching lines...) Expand all Loading... |
64 const std::map<std::string, std::string>& annotations_simple_map) { | 65 const std::map<std::string, std::string>& annotations_simple_map) { |
65 annotations_simple_map_ = annotations_simple_map; | 66 annotations_simple_map_ = annotations_simple_map; |
66 } | 67 } |
67 | 68 |
68 //! \brief Sets the system snapshot to be returned by System(). | 69 //! \brief Sets the system snapshot to be returned by System(). |
69 //! | 70 //! |
70 //! \param[in] system The system snapshot that System() will return. The | 71 //! \param[in] system The system snapshot that System() will return. The |
71 //! TestProcessSnapshot object takes ownership of \a system. | 72 //! TestProcessSnapshot object takes ownership of \a system. |
72 void SetSystem(scoped_ptr<SystemSnapshot> system) { system_ = system.Pass(); } | 73 void SetSystem(scoped_ptr<SystemSnapshot> system) { system_ = system.Pass(); } |
73 | 74 |
| 75 //! \brief Sets the PEB snapshot to be returned by Peb(). |
| 76 //! |
| 77 //! \param[in] peb The PEB snapshot that Peb() will return. The |
| 78 //! TestProcessSnapshot object takes ownership of \a peb. |
| 79 void SetPeb(scoped_ptr<MemorySnapshot> peb) { peb_ = peb.Pass(); } |
| 80 |
74 //! \brief Adds a thread snapshot to be returned by Threads(). | 81 //! \brief Adds a thread snapshot to be returned by Threads(). |
75 //! | 82 //! |
76 //! \param[in] thread The thread snapshot that will be included in Threads(). | 83 //! \param[in] thread The thread snapshot that will be included in Threads(). |
77 //! The TestProcessSnapshot object takes ownership of \a thread. | 84 //! The TestProcessSnapshot object takes ownership of \a thread. |
78 void AddThread(scoped_ptr<ThreadSnapshot> thread) { | 85 void AddThread(scoped_ptr<ThreadSnapshot> thread) { |
79 threads_.push_back(thread.release()); | 86 threads_.push_back(thread.release()); |
80 } | 87 } |
81 | 88 |
82 //! \brief Adds a module snapshot to be returned by Modules(). | 89 //! \brief Adds a module snapshot to be returned by Modules(). |
83 //! | 90 //! |
(...skipping 16 matching lines...) Expand all Loading... |
100 pid_t ProcessID() const override; | 107 pid_t ProcessID() const override; |
101 pid_t ParentProcessID() const override; | 108 pid_t ParentProcessID() const override; |
102 void SnapshotTime(timeval* snapshot_time) const override; | 109 void SnapshotTime(timeval* snapshot_time) const override; |
103 void ProcessStartTime(timeval* start_time) const override; | 110 void ProcessStartTime(timeval* start_time) const override; |
104 void ProcessCPUTimes(timeval* user_time, timeval* system_time) const override; | 111 void ProcessCPUTimes(timeval* user_time, timeval* system_time) const override; |
105 void ReportID(UUID* report_id) const override; | 112 void ReportID(UUID* report_id) const override; |
106 void ClientID(UUID* client_id) const override; | 113 void ClientID(UUID* client_id) const override; |
107 const std::map<std::string, std::string>& AnnotationsSimpleMap() | 114 const std::map<std::string, std::string>& AnnotationsSimpleMap() |
108 const override; | 115 const override; |
109 const SystemSnapshot* System() const override; | 116 const SystemSnapshot* System() const override; |
| 117 const MemorySnapshot* Peb() const override; |
110 std::vector<const ThreadSnapshot*> Threads() const override; | 118 std::vector<const ThreadSnapshot*> Threads() const override; |
111 std::vector<const ModuleSnapshot*> Modules() const override; | 119 std::vector<const ModuleSnapshot*> Modules() const override; |
112 const ExceptionSnapshot* Exception() const override; | 120 const ExceptionSnapshot* Exception() const override; |
113 | 121 |
114 private: | 122 private: |
115 pid_t process_id_; | 123 pid_t process_id_; |
116 pid_t parent_process_id_; | 124 pid_t parent_process_id_; |
117 timeval snapshot_time_; | 125 timeval snapshot_time_; |
118 timeval process_start_time_; | 126 timeval process_start_time_; |
119 timeval process_cpu_user_time_; | 127 timeval process_cpu_user_time_; |
120 timeval process_cpu_system_time_; | 128 timeval process_cpu_system_time_; |
121 UUID report_id_; | 129 UUID report_id_; |
122 UUID client_id_; | 130 UUID client_id_; |
123 std::map<std::string, std::string> annotations_simple_map_; | 131 std::map<std::string, std::string> annotations_simple_map_; |
124 scoped_ptr<SystemSnapshot> system_; | 132 scoped_ptr<SystemSnapshot> system_; |
| 133 scoped_ptr<MemorySnapshot> peb_; |
125 PointerVector<ThreadSnapshot> threads_; | 134 PointerVector<ThreadSnapshot> threads_; |
126 PointerVector<ModuleSnapshot> modules_; | 135 PointerVector<ModuleSnapshot> modules_; |
127 scoped_ptr<ExceptionSnapshot> exception_; | 136 scoped_ptr<ExceptionSnapshot> exception_; |
128 | 137 |
129 DISALLOW_COPY_AND_ASSIGN(TestProcessSnapshot); | 138 DISALLOW_COPY_AND_ASSIGN(TestProcessSnapshot); |
130 }; | 139 }; |
131 | 140 |
132 } // namespace test | 141 } // namespace test |
133 } // namespace crashpad | 142 } // namespace crashpad |
134 | 143 |
135 #endif // CRASHPAD_SNAPSHOT_TEST_TEST_PROCESS_SNAPSHOT_H_ | 144 #endif // CRASHPAD_SNAPSHOT_TEST_TEST_PROCESS_SNAPSHOT_H_ |
OLD | NEW |