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_map_region_snapshot.h" |
29 #include "snapshot/memory_snapshot.h" | 30 #include "snapshot/memory_snapshot.h" |
30 #include "snapshot/module_snapshot.h" | 31 #include "snapshot/module_snapshot.h" |
31 #include "snapshot/process_snapshot.h" | 32 #include "snapshot/process_snapshot.h" |
32 #include "snapshot/system_snapshot.h" | 33 #include "snapshot/system_snapshot.h" |
33 #include "snapshot/thread_snapshot.h" | 34 #include "snapshot/thread_snapshot.h" |
34 #include "util/misc/uuid.h" | 35 #include "util/misc/uuid.h" |
35 #include "util/stdlib/pointer_container.h" | 36 #include "util/stdlib/pointer_container.h" |
36 | 37 |
37 namespace crashpad { | 38 namespace crashpad { |
38 namespace test { | 39 namespace test { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 } | 90 } |
90 | 91 |
91 //! \brief Sets the exception snapshot to be returned by Exception(). | 92 //! \brief Sets the exception snapshot to be returned by Exception(). |
92 //! | 93 //! |
93 //! \param[in] exception The exception snapshot that Exception() will return. | 94 //! \param[in] exception The exception snapshot that Exception() will return. |
94 //! The TestProcessSnapshot object takes ownership of \a exception. | 95 //! The TestProcessSnapshot object takes ownership of \a exception. |
95 void SetException(scoped_ptr<ExceptionSnapshot> exception) { | 96 void SetException(scoped_ptr<ExceptionSnapshot> exception) { |
96 exception_ = exception.Pass(); | 97 exception_ = exception.Pass(); |
97 } | 98 } |
98 | 99 |
| 100 //! \brief Adds a memory map region snapshot to be returned by MemoryMap(). |
| 101 //! |
| 102 //! \param[in] region The memory map region snapshot that will be included in |
| 103 //! MemoryMap(). The TestProcessSnapshot object takes ownership of \a |
| 104 //! region. |
| 105 void AddMemoryMapRegion(scoped_ptr<MemoryMapRegionSnapshot> region) { |
| 106 memory_map_.push_back(region.release()); |
| 107 } |
| 108 |
99 //! \brief Add a memory snapshot to be returned by ExtraMemory(). | 109 //! \brief Add a memory snapshot to be returned by ExtraMemory(). |
100 //! | 110 //! |
101 //! \param[in] extra_memory The memory snapshot that will be included in | 111 //! \param[in] extra_memory The memory snapshot that will be included in |
102 //! ExtraMemory(). The TestProcessSnapshot object takes ownership of \a | 112 //! ExtraMemory(). The TestProcessSnapshot object takes ownership of \a |
103 //! extra_memory. | 113 //! extra_memory. |
104 void AddExtraMemory(scoped_ptr<MemorySnapshot> extra_memory) { | 114 void AddExtraMemory(scoped_ptr<MemorySnapshot> extra_memory) { |
105 extra_memory_.push_back(extra_memory.release()); | 115 extra_memory_.push_back(extra_memory.release()); |
106 } | 116 } |
107 | 117 |
108 // ProcessSnapshot: | 118 // ProcessSnapshot: |
109 | 119 |
110 pid_t ProcessID() const override; | 120 pid_t ProcessID() const override; |
111 pid_t ParentProcessID() const override; | 121 pid_t ParentProcessID() const override; |
112 void SnapshotTime(timeval* snapshot_time) const override; | 122 void SnapshotTime(timeval* snapshot_time) const override; |
113 void ProcessStartTime(timeval* start_time) const override; | 123 void ProcessStartTime(timeval* start_time) const override; |
114 void ProcessCPUTimes(timeval* user_time, timeval* system_time) const override; | 124 void ProcessCPUTimes(timeval* user_time, timeval* system_time) const override; |
115 void ReportID(UUID* report_id) const override; | 125 void ReportID(UUID* report_id) const override; |
116 void ClientID(UUID* client_id) const override; | 126 void ClientID(UUID* client_id) const override; |
117 const std::map<std::string, std::string>& AnnotationsSimpleMap() | 127 const std::map<std::string, std::string>& AnnotationsSimpleMap() |
118 const override; | 128 const override; |
119 const SystemSnapshot* System() const override; | 129 const SystemSnapshot* System() const override; |
120 std::vector<const ThreadSnapshot*> Threads() const override; | 130 std::vector<const ThreadSnapshot*> Threads() const override; |
121 std::vector<const ModuleSnapshot*> Modules() const override; | 131 std::vector<const ModuleSnapshot*> Modules() const override; |
122 const ExceptionSnapshot* Exception() const override; | 132 const ExceptionSnapshot* Exception() const override; |
| 133 std::vector<const MemoryMapRegionSnapshot*> MemoryMap() const override; |
123 std::vector<const MemorySnapshot*> ExtraMemory() const override; | 134 std::vector<const MemorySnapshot*> ExtraMemory() const override; |
124 | 135 |
125 private: | 136 private: |
126 pid_t process_id_; | 137 pid_t process_id_; |
127 pid_t parent_process_id_; | 138 pid_t parent_process_id_; |
128 timeval snapshot_time_; | 139 timeval snapshot_time_; |
129 timeval process_start_time_; | 140 timeval process_start_time_; |
130 timeval process_cpu_user_time_; | 141 timeval process_cpu_user_time_; |
131 timeval process_cpu_system_time_; | 142 timeval process_cpu_system_time_; |
132 UUID report_id_; | 143 UUID report_id_; |
133 UUID client_id_; | 144 UUID client_id_; |
134 std::map<std::string, std::string> annotations_simple_map_; | 145 std::map<std::string, std::string> annotations_simple_map_; |
135 scoped_ptr<SystemSnapshot> system_; | 146 scoped_ptr<SystemSnapshot> system_; |
136 PointerVector<ThreadSnapshot> threads_; | 147 PointerVector<ThreadSnapshot> threads_; |
137 PointerVector<ModuleSnapshot> modules_; | 148 PointerVector<ModuleSnapshot> modules_; |
138 scoped_ptr<ExceptionSnapshot> exception_; | 149 scoped_ptr<ExceptionSnapshot> exception_; |
| 150 PointerVector<MemoryMapRegionSnapshot> memory_map_; |
139 PointerVector<MemorySnapshot> extra_memory_; | 151 PointerVector<MemorySnapshot> extra_memory_; |
140 | 152 |
141 DISALLOW_COPY_AND_ASSIGN(TestProcessSnapshot); | 153 DISALLOW_COPY_AND_ASSIGN(TestProcessSnapshot); |
142 }; | 154 }; |
143 | 155 |
144 } // namespace test | 156 } // namespace test |
145 } // namespace crashpad | 157 } // namespace crashpad |
146 | 158 |
147 #endif // CRASHPAD_SNAPSHOT_TEST_TEST_PROCESS_SNAPSHOT_H_ | 159 #endif // CRASHPAD_SNAPSHOT_TEST_TEST_PROCESS_SNAPSHOT_H_ |
OLD | NEW |