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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 mach_msg_type_number_t old_state_count, | 422 mach_msg_type_number_t old_state_count, |
423 thread_state_t new_state, | 423 thread_state_t new_state, |
424 mach_msg_type_number_t* new_state_count, | 424 mach_msg_type_number_t* new_state_count, |
425 bool* destroy_complex_request) override; | 425 bool* destroy_complex_request) override; |
426 | 426 |
427 private: | 427 private: |
428 internal::SimplifiedExcServer exc_server_; | 428 internal::SimplifiedExcServer exc_server_; |
429 internal::SimplifiedMachExcServer mach_exc_server_; | 429 internal::SimplifiedMachExcServer mach_exc_server_; |
430 }; | 430 }; |
431 | 431 |
| 432 //! \brief Recovers the original exception, first exception code, and signal |
| 433 //! from the encoded form of the first exception code delivered with |
| 434 //! `EXC_CRASH` exceptions. |
| 435 //! |
| 436 //! `EXC_CRASH` exceptions are generated when the kernel has committed to |
| 437 //! terminating a process as a result of a core-generating POSIX signal and, for |
| 438 //! hardware exceptions, an earlier Mach exception. Information about this |
| 439 //! earlier exception and signal is made available to the `EXC_CRASH` handler |
| 440 //! via its `code[0]` parameter. This function recovers the original exception, |
| 441 //! the value of `code[0]` from the original exception, and the value of the |
| 442 //! signal responsible for process termination. |
| 443 //! |
| 444 //! \param[in] code_0 The first exception code (`code[0]`) passed to a Mach |
| 445 //! exception handler in an `EXC_CRASH` exception. It is invalid to call |
| 446 //! this function with an exception code from any exception other than |
| 447 //! `EXC_CRASH`. |
| 448 //! \param[out] original_code_0 The first exception code (`code[0]`) passed to |
| 449 //! the Mach exception handler for a hardware exception that resulted in the |
| 450 //! generation of a POSIX signal that caused process termination. If the |
| 451 //! signal that caused termination was not sent as a result of a hardware |
| 452 //! exception, this will be `0`. Callers that do not need this value may |
| 453 //! pass `NULL`. |
| 454 //! \param[out] signal The POSIX signal that caused process termination. Callers |
| 455 //! that do not need this value may pass `NULL`. |
| 456 //! |
| 457 //! \return The original exception for a hardware exception that resulted in the |
| 458 //! generation of a POSIX signal that caused process termination. If the |
| 459 //! signal that caused termination was not sent as a result of a hardware |
| 460 //! exception, this will be `0`. |
| 461 exception_type_t ExcCrashRecoverOriginalException( |
| 462 mach_exception_data_type_t code_0, |
| 463 mach_exception_data_type_t* original_code_0, |
| 464 int* signal); |
| 465 |
432 //! \brief Computes an approriate successful return value for an exception | 466 //! \brief Computes an approriate successful return value for an exception |
433 //! handler function. | 467 //! handler function. |
434 //! | 468 //! |
435 //! For exception handlers that respond to state-carrying behaviors, when the | 469 //! For exception handlers that respond to state-carrying behaviors, when the |
436 //! handler is called by the kernel (as it is normally), the kernel will attempt | 470 //! handler is called by the kernel (as it is normally), the kernel will attempt |
437 //! to set a new thread state when the exception handler returns successfully. | 471 //! to set a new thread state when the exception handler returns successfully. |
438 //! Other code that mimics the kernel’s exception-delivery semantics may | 472 //! Other code that mimics the kernel’s exception-delivery semantics may |
439 //! implement the same or similar behavior. In some situations, it is | 473 //! implement the same or similar behavior. In some situations, it is |
440 //! undesirable to set a new thread state. If the exception handler were to | 474 //! undesirable to set a new thread state. If the exception handler were to |
441 //! return unsuccessfully, however, the kernel would continue searching for an | 475 //! return unsuccessfully, however, the kernel would continue searching for an |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 //! \a behavior is not a state-carrying behavior, or when it is a | 509 //! \a behavior is not a state-carrying behavior, or when it is a |
476 //! state-carrying behavior and \a set_thread_state is `true`. | 510 //! state-carrying behavior and \a set_thread_state is `true`. |
477 //! `MACH_RCV_PORT_DIED` is used when \a behavior is a state-carrying | 511 //! `MACH_RCV_PORT_DIED` is used when \a behavior is a state-carrying |
478 //! behavior and \a set_thread_state is `false`. | 512 //! behavior and \a set_thread_state is `false`. |
479 kern_return_t ExcServerSuccessfulReturnValue(exception_behavior_t behavior, | 513 kern_return_t ExcServerSuccessfulReturnValue(exception_behavior_t behavior, |
480 bool set_thread_state); | 514 bool set_thread_state); |
481 | 515 |
482 } // namespace crashpad | 516 } // namespace crashpad |
483 | 517 |
484 #endif // CRASHPAD_UTIL_MACH_EXC_SERVER_VARIANTS_H_ | 518 #endif // CRASHPAD_UTIL_MACH_EXC_SERVER_VARIANTS_H_ |
OLD | NEW |