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_MAC_PROCESS_SNAPSHOT_MAC_H_ | 15 #ifndef CRASHPAD_SNAPSHOT_MAC_PROCESS_SNAPSHOT_MAC_H_ |
16 #define CRASHPAD_SNAPSHOT_MAC_PROCESS_SNAPSHOT_MAC_H_ | 16 #define CRASHPAD_SNAPSHOT_MAC_PROCESS_SNAPSHOT_MAC_H_ |
17 | 17 |
18 #include <mach/mach.h> | 18 #include <mach/mach.h> |
19 #include <sys/time.h> | 19 #include <sys/time.h> |
20 #include <unistd.h> | 20 #include <unistd.h> |
21 | 21 |
| 22 #include <map> |
| 23 #include <string> |
22 #include <vector> | 24 #include <vector> |
23 | 25 |
24 #include "base/basictypes.h" | 26 #include "base/basictypes.h" |
25 #include "base/memory/scoped_ptr.h" | 27 #include "base/memory/scoped_ptr.h" |
26 #include "snapshot/exception_snapshot.h" | 28 #include "snapshot/exception_snapshot.h" |
27 #include "snapshot/mac/exception_snapshot_mac.h" | 29 #include "snapshot/mac/exception_snapshot_mac.h" |
28 #include "snapshot/mac/module_snapshot_mac.h" | 30 #include "snapshot/mac/module_snapshot_mac.h" |
29 #include "snapshot/mac/process_reader.h" | 31 #include "snapshot/mac/process_reader.h" |
30 #include "snapshot/mac/system_snapshot_mac.h" | 32 #include "snapshot/mac/system_snapshot_mac.h" |
31 #include "snapshot/mac/thread_snapshot_mac.h" | 33 #include "snapshot/mac/thread_snapshot_mac.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 //! otherwise with an appropriate message logged. When this method returns | 67 //! otherwise with an appropriate message logged. When this method returns |
66 //! `false`, the ProcessSnapshotMac object’s validity remains unchanged. | 68 //! `false`, the ProcessSnapshotMac object’s validity remains unchanged. |
67 bool InitializeException(thread_t exception_thread, | 69 bool InitializeException(thread_t exception_thread, |
68 exception_type_t exception, | 70 exception_type_t exception, |
69 const mach_exception_data_type_t* code, | 71 const mach_exception_data_type_t* code, |
70 mach_msg_type_number_t code_count, | 72 mach_msg_type_number_t code_count, |
71 thread_state_flavor_t flavor, | 73 thread_state_flavor_t flavor, |
72 const natural_t* state, | 74 const natural_t* state, |
73 mach_msg_type_number_t state_count); | 75 mach_msg_type_number_t state_count); |
74 | 76 |
| 77 //! \brief Sets the value to be returned by AnnotationsSimpleMap(). |
| 78 //! |
| 79 //! On Mac OS X, all process annotations are under the control of the snapshot |
| 80 //! producer, which may call this method to establish these annotations. |
| 81 //! Contrast this with module annotations, which are under the control of the |
| 82 //! process being snapshotted. |
| 83 void SetAnnotationsSimpleMap( |
| 84 const std::map<std::string, std::string>& annotations_simple_map) { |
| 85 annotations_simple_map_ = annotations_simple_map; |
| 86 } |
| 87 |
75 // ProcessSnapshot: | 88 // ProcessSnapshot: |
76 | 89 |
77 pid_t ProcessID() const override; | 90 pid_t ProcessID() const override; |
78 pid_t ParentProcessID() const override; | 91 pid_t ParentProcessID() const override; |
79 void SnapshotTime(timeval* snapshot_time) const override; | 92 void SnapshotTime(timeval* snapshot_time) const override; |
80 void ProcessStartTime(timeval* start_time) const override; | 93 void ProcessStartTime(timeval* start_time) const override; |
81 void ProcessCPUTimes(timeval* user_time, timeval* system_time) const override; | 94 void ProcessCPUTimes(timeval* user_time, timeval* system_time) const override; |
| 95 std::map<std::string, std::string> AnnotationsSimpleMap() const override; |
82 const SystemSnapshot* System() const override; | 96 const SystemSnapshot* System() const override; |
83 std::vector<const ThreadSnapshot*> Threads() const override; | 97 std::vector<const ThreadSnapshot*> Threads() const override; |
84 std::vector<const ModuleSnapshot*> Modules() const override; | 98 std::vector<const ModuleSnapshot*> Modules() const override; |
85 const ExceptionSnapshot* Exception() const override; | 99 const ExceptionSnapshot* Exception() const override; |
86 | 100 |
87 private: | 101 private: |
88 // Initializes threads_ on behalf of Initialize(). | 102 // Initializes threads_ on behalf of Initialize(). |
89 void InitializeThreads(); | 103 void InitializeThreads(); |
90 | 104 |
91 // Initializes modules_ on behalf of Initialize(). | 105 // Initializes modules_ on behalf of Initialize(). |
92 void InitializeModules(); | 106 void InitializeModules(); |
93 | 107 |
94 internal::SystemSnapshotMac system_; | 108 internal::SystemSnapshotMac system_; |
95 PointerVector<internal::ThreadSnapshotMac> threads_; | 109 PointerVector<internal::ThreadSnapshotMac> threads_; |
96 PointerVector<internal::ModuleSnapshotMac> modules_; | 110 PointerVector<internal::ModuleSnapshotMac> modules_; |
97 scoped_ptr<internal::ExceptionSnapshotMac> exception_; | 111 scoped_ptr<internal::ExceptionSnapshotMac> exception_; |
98 ProcessReader process_reader_; | 112 ProcessReader process_reader_; |
| 113 std::map<std::string, std::string> annotations_simple_map_; |
99 timeval snapshot_time_; | 114 timeval snapshot_time_; |
100 InitializationStateDcheck initialized_; | 115 InitializationStateDcheck initialized_; |
101 | 116 |
102 DISALLOW_COPY_AND_ASSIGN(ProcessSnapshotMac); | 117 DISALLOW_COPY_AND_ASSIGN(ProcessSnapshotMac); |
103 }; | 118 }; |
104 | 119 |
105 } // namespace crashpad | 120 } // namespace crashpad |
106 | 121 |
107 #endif // CRASHPAD_SNAPSHOT_MAC_PROCESS_SNAPSHOT_MAC_H_ | 122 #endif // CRASHPAD_SNAPSHOT_MAC_PROCESS_SNAPSHOT_MAC_H_ |
OLD | NEW |