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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 //! | 90 //! |
91 //! \param[in] target_type The type of target on which the exception ports are | 91 //! \param[in] target_type The type of target on which the exception ports are |
92 //! to be get or set: #kTargetTypeHost, #kTargetTypeTask, or or | 92 //! to be get or set: #kTargetTypeHost, #kTargetTypeTask, or or |
93 //! #kTargetTypeThread. The correct functions for | 93 //! #kTargetTypeThread. The correct functions for |
94 //! `*_get_exception_ports()` and `*_set_exception_ports()` will be used. | 94 //! `*_get_exception_ports()` and `*_set_exception_ports()` will be used. |
95 //! \param[in] target_port The target on which to call | 95 //! \param[in] target_port The target on which to call |
96 //! `*_get_exception_ports()` or `*_set_exception_ports()`. The target | 96 //! `*_get_exception_ports()` or `*_set_exception_ports()`. The target |
97 //! port must be a send right to a port of the type specified in \a | 97 //! port must be a send right to a port of the type specified in \a |
98 //! target_type. In this case, ownership of \a target_port is not given to | 98 //! target_type. In this case, ownership of \a target_port is not given to |
99 //! the new ExceptionPorts object. \a target_port may also be | 99 //! the new ExceptionPorts object. \a target_port may also be |
100 //! `MACH_PORT_NULL`, in which case `mach_host_self()`, | 100 //! `HOST_NULL`, `TASK_NULL`, or `THREAD_NULL`, in which case |
101 //! `mach_task_self()`, or `mach_thread_self()` will be used as the target | 101 //! `mach_host_self()`, `mach_task_self()`, or `mach_thread_self()` will |
102 //! port depending on the value of \a target_type. In this case, ownership | 102 //! be used as the target port depending on the value of \a target_type. |
103 //! of the target port will be managed appropriately for \a target_type. | 103 //! In this case, ownership of the target port will be managed |
| 104 //! appropriately for \a target_type. |
104 ExceptionPorts(TargetType target_type, mach_port_t target_port); | 105 ExceptionPorts(TargetType target_type, mach_port_t target_port); |
105 | 106 |
106 ~ExceptionPorts(); | 107 ~ExceptionPorts(); |
107 | 108 |
108 //! \brief Calls `*_get_exception_ports()` on the target. | 109 //! \brief Calls `*_get_exception_ports()` on the target. |
109 //! | 110 //! |
110 //! \param[in] mask The exception mask, containing the `EXC_MASK_*` values to | 111 //! \param[in] mask The exception mask, containing the `EXC_MASK_*` values to |
111 //! be looked up and returned in \a handlers. | 112 //! be looked up and returned in \a handlers. |
112 //! \param[out] handlers The exception handlers registered for \a target_port | 113 //! \param[out] handlers The exception handlers registered for \a target_port |
113 //! to handle exceptions indicated in \a mask. The caller must take | 114 //! to handle exceptions indicated in \a mask. The caller must take |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 exception_handler_t, | 166 exception_handler_t, |
166 exception_behavior_t, | 167 exception_behavior_t, |
167 thread_state_flavor_t); | 168 thread_state_flavor_t); |
168 | 169 |
169 GetExceptionPortsType get_exception_ports_; | 170 GetExceptionPortsType get_exception_ports_; |
170 SetExceptionPortsType set_exception_ports_; | 171 SetExceptionPortsType set_exception_ports_; |
171 const char* target_name_; | 172 const char* target_name_; |
172 mach_port_t target_port_; | 173 mach_port_t target_port_; |
173 | 174 |
174 // If true, target_port_ will be deallocated in the destructor. This will | 175 // If true, target_port_ will be deallocated in the destructor. This will |
175 // always be false when the user provides a non-MACH_PORT_NULL target_port to | 176 // always be false when the user provides a non-null target_port to the |
176 // the constructor. It will also be false when target_type is kTargetTypeTask, | 177 // constructor. It will also be false when target_type is kTargetTypeTask, |
177 // even with a MACH_PORT_NULL target_port, because it is incorrect to | 178 // even with a TASK_NULL target_port, because it is incorrect to deallocate |
178 // deallocate the result of mach_task_self(). | 179 // the result of mach_task_self(). |
179 bool dealloc_target_port_; | 180 bool dealloc_target_port_; |
180 | 181 |
181 DISALLOW_COPY_AND_ASSIGN(ExceptionPorts); | 182 DISALLOW_COPY_AND_ASSIGN(ExceptionPorts); |
182 }; | 183 }; |
183 | 184 |
184 } // namespace crashpad | 185 } // namespace crashpad |
185 | 186 |
186 #endif // CRASHPAD_UTIL_MACH_EXCEPTION_PORTS_H_ | 187 #endif // CRASHPAD_UTIL_MACH_EXCEPTION_PORTS_H_ |
OLD | NEW |