| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 std::set<mach_msg_id_t> MachMessageServerRequestIDs() override; | 109 std::set<mach_msg_id_t> MachMessageServerRequestIDs() override; |
| 110 mach_msg_size_t MachMessageServerRequestSize() override; | 110 mach_msg_size_t MachMessageServerRequestSize() override; |
| 111 mach_msg_size_t MachMessageServerReplySize() override; | 111 mach_msg_size_t MachMessageServerReplySize() override; |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 scoped_ptr<internal::UniversalMachExcServerImpl> impl_; | 114 scoped_ptr<internal::UniversalMachExcServerImpl> impl_; |
| 115 | 115 |
| 116 DISALLOW_COPY_AND_ASSIGN(UniversalMachExcServer); | 116 DISALLOW_COPY_AND_ASSIGN(UniversalMachExcServer); |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 //! \brief Recovers the original exception, first exception code, and signal | |
| 120 //! from the encoded form of the first exception code delivered with | |
| 121 //! `EXC_CRASH` exceptions. | |
| 122 //! | |
| 123 //! `EXC_CRASH` exceptions are generated when the kernel has committed to | |
| 124 //! terminating a process as a result of a core-generating POSIX signal and, for | |
| 125 //! hardware exceptions, an earlier Mach exception. Information about this | |
| 126 //! earlier exception and signal is made available to the `EXC_CRASH` handler | |
| 127 //! via its `code[0]` parameter. This function recovers the original exception, | |
| 128 //! the value of `code[0]` from the original exception, and the value of the | |
| 129 //! signal responsible for process termination. | |
| 130 //! | |
| 131 //! \param[in] code_0 The first exception code (`code[0]`) passed to a Mach | |
| 132 //! exception handler in an `EXC_CRASH` exception. It is invalid to call | |
| 133 //! this function with an exception code from any exception other than | |
| 134 //! `EXC_CRASH`. | |
| 135 //! \param[out] original_code_0 The first exception code (`code[0]`) passed to | |
| 136 //! the Mach exception handler for a hardware exception that resulted in the | |
| 137 //! generation of a POSIX signal that caused process termination. If the | |
| 138 //! signal that caused termination was not sent as a result of a hardware | |
| 139 //! exception, this will be `0`. Callers that do not need this value may | |
| 140 //! pass `nullptr`. | |
| 141 //! \param[out] signal The POSIX signal that caused process termination. Callers | |
| 142 //! that do not need this value may pass `nullptr`. | |
| 143 //! | |
| 144 //! \return The original exception for a hardware exception that resulted in the | |
| 145 //! generation of a POSIX signal that caused process termination. If the | |
| 146 //! signal that caused termination was not sent as a result of a hardware | |
| 147 //! exception, this will be `0`. | |
| 148 exception_type_t ExcCrashRecoverOriginalException( | |
| 149 mach_exception_code_t code_0, | |
| 150 mach_exception_code_t* original_code_0, | |
| 151 int* signal); | |
| 152 | |
| 153 //! \brief Computes an approriate successful return value for an exception | 119 //! \brief Computes an approriate successful return value for an exception |
| 154 //! handler function. | 120 //! handler function. |
| 155 //! | 121 //! |
| 156 //! For exception handlers that respond to state-carrying behaviors, when the | 122 //! For exception handlers that respond to state-carrying behaviors, when the |
| 157 //! handler is called by the kernel (as it is normally), the kernel will attempt | 123 //! handler is called by the kernel (as it is normally), the kernel will attempt |
| 158 //! to set a new thread state when the exception handler returns successfully. | 124 //! to set a new thread state when the exception handler returns successfully. |
| 159 //! Other code that mimics the kernel’s exception-delivery semantics may | 125 //! Other code that mimics the kernel’s exception-delivery semantics may |
| 160 //! implement the same or similar behavior. In some situations, it is | 126 //! implement the same or similar behavior. In some situations, it is |
| 161 //! undesirable to set a new thread state. If the exception handler were to | 127 //! undesirable to set a new thread state. If the exception handler were to |
| 162 //! return unsuccessfully, however, the kernel would continue searching for an | 128 //! return unsuccessfully, however, the kernel would continue searching for an |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 //! large as \a old_state_count. | 199 //! large as \a old_state_count. |
| 234 void ExcServerCopyState(exception_behavior_t behavior, | 200 void ExcServerCopyState(exception_behavior_t behavior, |
| 235 ConstThreadState old_state, | 201 ConstThreadState old_state, |
| 236 mach_msg_type_number_t old_state_count, | 202 mach_msg_type_number_t old_state_count, |
| 237 thread_state_t new_state, | 203 thread_state_t new_state, |
| 238 mach_msg_type_number_t* new_state_count); | 204 mach_msg_type_number_t* new_state_count); |
| 239 | 205 |
| 240 } // namespace crashpad | 206 } // namespace crashpad |
| 241 | 207 |
| 242 #endif // CRASHPAD_UTIL_MACH_EXC_SERVER_VARIANTS_H_ | 208 #endif // CRASHPAD_UTIL_MACH_EXC_SERVER_VARIANTS_H_ |
| OLD | NEW |