| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 Thread(); | 57 Thread(); |
| 58 ~Thread() {} | 58 ~Thread() {} |
| 59 | 59 |
| 60 ThreadContext thread_context; | 60 ThreadContext thread_context; |
| 61 FloatContext float_context; | 61 FloatContext float_context; |
| 62 DebugContext debug_context; | 62 DebugContext debug_context; |
| 63 uint64_t id; | 63 uint64_t id; |
| 64 mach_vm_address_t stack_region_address; | 64 mach_vm_address_t stack_region_address; |
| 65 mach_vm_size_t stack_region_size; | 65 mach_vm_size_t stack_region_size; |
| 66 mach_vm_address_t thread_specific_data_address; | 66 mach_vm_address_t thread_specific_data_address; |
| 67 mach_port_t port; | 67 task_t port; |
| 68 int suspend_count; | 68 int suspend_count; |
| 69 int priority; | 69 int priority; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 //! \brief Contains information about a module loaded into a process. | 72 //! \brief Contains information about a module loaded into a process. |
| 73 struct Module { | 73 struct Module { |
| 74 Module(); | 74 Module(); |
| 75 ~Module(); | 75 ~Module(); |
| 76 | 76 |
| 77 //! \brief The pathname used to load the module from disk. | 77 //! \brief The pathname used to load the module from disk. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 94 | 94 |
| 95 //! \brief Initializes this object. This method must be called before any | 95 //! \brief Initializes this object. This method must be called before any |
| 96 //! other. | 96 //! other. |
| 97 //! | 97 //! |
| 98 //! \param[in] task A send right to the target task’s task port. This object | 98 //! \param[in] task A send right to the target task’s task port. This object |
| 99 //! does not take ownership of the send right. | 99 //! does not take ownership of the send right. |
| 100 //! | 100 //! |
| 101 //! \return `true` on success, indicating that this object will respond | 101 //! \return `true` on success, indicating that this object will respond |
| 102 //! validly to further method calls. `false` on failure. On failure, no | 102 //! validly to further method calls. `false` on failure. On failure, no |
| 103 //! further method calls should be made. | 103 //! further method calls should be made. |
| 104 bool Initialize(mach_port_t task); | 104 bool Initialize(task_t task); |
| 105 | 105 |
| 106 //! \return `true` if the target task is a 64-bit process. | 106 //! \return `true` if the target task is a 64-bit process. |
| 107 bool Is64Bit() const { return is_64_bit_; } | 107 bool Is64Bit() const { return is_64_bit_; } |
| 108 | 108 |
| 109 //! \return The target task’s process ID. | 109 //! \return The target task’s process ID. |
| 110 pid_t ProcessID() const { return kern_proc_info_.kp_proc.p_pid; } | 110 pid_t ProcessID() const { return kern_proc_info_.kp_proc.p_pid; } |
| 111 | 111 |
| 112 //! \return The target task’s parent process ID. | 112 //! \return The target task’s parent process ID. |
| 113 pid_t ParentProcessID() const { return kern_proc_info_.kp_eproc.e_ppid; } | 113 pid_t ParentProcessID() const { return kern_proc_info_.kp_eproc.e_ppid; } |
| 114 | 114 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 //! and the expanded region has the same user tag value. | 198 //! and the expanded region has the same user tag value. |
| 199 void LocateRedZone(mach_vm_address_t* start_address, | 199 void LocateRedZone(mach_vm_address_t* start_address, |
| 200 mach_vm_address_t* region_base, | 200 mach_vm_address_t* region_base, |
| 201 mach_vm_address_t* region_size, | 201 mach_vm_address_t* region_size, |
| 202 unsigned int user_tag); | 202 unsigned int user_tag); |
| 203 | 203 |
| 204 kinfo_proc kern_proc_info_; | 204 kinfo_proc kern_proc_info_; |
| 205 std::vector<Thread> threads_; // owns send rights | 205 std::vector<Thread> threads_; // owns send rights |
| 206 std::vector<Module> modules_; | 206 std::vector<Module> modules_; |
| 207 scoped_ptr<TaskMemory> task_memory_; | 207 scoped_ptr<TaskMemory> task_memory_; |
| 208 mach_port_t task_; // weak | 208 task_t task_; // weak |
| 209 InitializationStateDcheck initialized_; | 209 InitializationStateDcheck initialized_; |
| 210 | 210 |
| 211 // This shadows a bit in kern_proc_info_, but it’s accessed so frequently that | 211 // This shadows a bit in kern_proc_info_, but it’s accessed so frequently that |
| 212 // it’s given a first-class field to save a few bit operations on each access. | 212 // it’s given a first-class field to save a few bit operations on each access. |
| 213 bool is_64_bit_; | 213 bool is_64_bit_; |
| 214 | 214 |
| 215 bool initialized_threads_; | 215 bool initialized_threads_; |
| 216 bool initialized_modules_; | 216 bool initialized_modules_; |
| 217 | 217 |
| 218 DISALLOW_COPY_AND_ASSIGN(ProcessReader); | 218 DISALLOW_COPY_AND_ASSIGN(ProcessReader); |
| 219 }; | 219 }; |
| 220 | 220 |
| 221 } // namespace crashpad | 221 } // namespace crashpad |
| 222 | 222 |
| 223 #endif // CRASHPAD_UTIL_MAC_PROCESS_READER_H_ | 223 #endif // CRASHPAD_UTIL_MAC_PROCESS_READER_H_ |
| OLD | NEW |