| 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, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 mach_port_t port; | 62 mach_port_t port; |
| 63 int suspend_count; | 63 int suspend_count; |
| 64 int priority; | 64 int priority; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 //! \brief Contains information about a module loaded into a process. | 67 //! \brief Contains information about a module loaded into a process. |
| 68 struct ProcessReaderModule { | 68 struct ProcessReaderModule { |
| 69 ProcessReaderModule(); | 69 ProcessReaderModule(); |
| 70 ~ProcessReaderModule(); | 70 ~ProcessReaderModule(); |
| 71 | 71 |
| 72 //! \brief The pathname used to load the module from disk. |
| 72 std::string name; | 73 std::string name; |
| 74 |
| 75 //! \brief The address where the base of the module is loaded in the remote |
| 76 //! process. |
| 73 mach_vm_address_t address; | 77 mach_vm_address_t address; |
| 78 |
| 79 //! \brief The module’s timestamp. |
| 80 //! |
| 81 //! This field will be `0` if its value cannot be determined. It can only be |
| 82 //! determined for images that are loaded by dyld, so it will be `0` for the |
| 83 //! main executable and for dyld itself. |
| 74 time_t timestamp; | 84 time_t timestamp; |
| 75 }; | 85 }; |
| 76 | 86 |
| 77 //! \brief Accesses information about another process, identified by a Mach | 87 //! \brief Accesses information about another process, identified by a Mach |
| 78 //! task. | 88 //! task. |
| 79 class ProcessReader { | 89 class ProcessReader { |
| 80 public: | 90 public: |
| 81 ProcessReader(); | 91 ProcessReader(); |
| 82 ~ProcessReader(); | 92 ~ProcessReader(); |
| 83 | 93 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 110 //! in system mode. | 120 //! in system mode. |
| 111 //! | 121 //! |
| 112 //! \return `true` on success, `false` on failure, with a warning logged. On | 122 //! \return `true` on success, `false` on failure, with a warning logged. On |
| 113 //! failure, \a user_time and \a system_time will be set to represent no | 123 //! failure, \a user_time and \a system_time will be set to represent no |
| 114 //! time spent executing code in user or system mode. | 124 //! time spent executing code in user or system mode. |
| 115 bool CPUTimes(timeval* user_time, timeval* system_time) const; | 125 bool CPUTimes(timeval* user_time, timeval* system_time) const; |
| 116 | 126 |
| 117 //! \return Accesses the memory of the target task. | 127 //! \return Accesses the memory of the target task. |
| 118 TaskMemory* Memory() { return task_memory_.get(); } | 128 TaskMemory* Memory() { return task_memory_.get(); } |
| 119 | 129 |
| 120 //! \return The threads that are in the task (process). | 130 //! \return The threads that are in the task (process). The first element (at |
| 131 //! index `0`) corresponds to the main thread. |
| 121 const std::vector<ProcessReaderThread>& Threads(); | 132 const std::vector<ProcessReaderThread>& Threads(); |
| 122 | 133 |
| 123 //! \return The modules loaded in the process. | 134 //! \return The modules loaded in the process. The first element (at index |
| 135 //! `0`) corresponds to the main executable, and the final element |
| 136 //! corresponds to the dynamic loader, dyld. |
| 124 const std::vector<ProcessReaderModule>& Modules(); | 137 const std::vector<ProcessReaderModule>& Modules(); |
| 125 | 138 |
| 126 private: | 139 private: |
| 127 //! Performs lazy initialization of the \a threads_ vector on behalf of | 140 //! Performs lazy initialization of the \a threads_ vector on behalf of |
| 128 //! Threads(). | 141 //! Threads(). |
| 129 void InitializeThreads(); | 142 void InitializeThreads(); |
| 130 | 143 |
| 131 //! Performs lazy initialization of the \a modules_ vector on behalf of | 144 //! Performs lazy initialization of the \a modules_ vector on behalf of |
| 132 //! Modules(). | 145 //! Modules(). |
| 133 void InitializeModules(); | 146 void InitializeModules(); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 213 |
| 201 bool initialized_threads_; | 214 bool initialized_threads_; |
| 202 bool initialized_modules_; | 215 bool initialized_modules_; |
| 203 | 216 |
| 204 DISALLOW_COPY_AND_ASSIGN(ProcessReader); | 217 DISALLOW_COPY_AND_ASSIGN(ProcessReader); |
| 205 }; | 218 }; |
| 206 | 219 |
| 207 } // namespace crashpad | 220 } // namespace crashpad |
| 208 | 221 |
| 209 #endif // CRASHPAD_UTIL_MAC_PROCESS_READER_H_ | 222 #endif // CRASHPAD_UTIL_MAC_PROCESS_READER_H_ |
| OLD | NEW |