| 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 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 code_count ? &mach_codes[0] : NULL, | 716 code_count ? &mach_codes[0] : NULL, |
| 717 code_count, | 717 code_count, |
| 718 flavor, | 718 flavor, |
| 719 old_state, | 719 old_state, |
| 720 old_state_count, | 720 old_state_count, |
| 721 new_state, | 721 new_state, |
| 722 new_state_count, | 722 new_state_count, |
| 723 destroy_complex_request); | 723 destroy_complex_request); |
| 724 } | 724 } |
| 725 | 725 |
| 726 exception_type_t ExcCrashRecoverOriginalException( |
| 727 mach_exception_data_type_t code_0, |
| 728 mach_exception_data_type_t* original_code_0, |
| 729 int* signal) { |
| 730 // 10.9.4 xnu-2422.110.17/bsd/kern/kern_exit.c proc_prepareexit() sets code[0] |
| 731 // based on the signal value, original exception type, and low 20 bits of the |
| 732 // original code[0] before calling xnu-2422.110.17/osfmk/kern/exception.c |
| 733 // task_exception_notify() to raise an EXC_CRASH. |
| 734 // |
| 735 // The list of core-generating signals (as used in proc_prepareexit()’s call |
| 736 // to hassigprop()) is in 10.9.4 xnu-2422.110.17/bsd/sys/signalvar.h sigprop: |
| 737 // entires with SA_CORE are in the set. These signals are SIGQUIT, SIGILL, |
| 738 // SIGTRAP, SIGABRT, SIGEMT, SIGFPE, SIGBUS, SIGSEGV, and SIGSYS. Processes |
| 739 // killed for code-signing reasons will be killed by SIGKILL and are also |
| 740 // eligible for EXC_CRASH handling, but processes killed by SIGKILL for other |
| 741 // reasons are not. |
| 742 if (signal) { |
| 743 *signal = (code_0 >> 24) & 0xff; |
| 744 } |
| 745 |
| 746 if (original_code_0) { |
| 747 *original_code_0 = code_0 & 0xfffff; |
| 748 } |
| 749 |
| 750 return (code_0 >> 20) & 0xf; |
| 751 } |
| 752 |
| 726 kern_return_t ExcServerSuccessfulReturnValue(exception_behavior_t behavior, | 753 kern_return_t ExcServerSuccessfulReturnValue(exception_behavior_t behavior, |
| 727 bool set_thread_state) { | 754 bool set_thread_state) { |
| 728 if (!set_thread_state && ExceptionBehaviorHasState(behavior)) { | 755 if (!set_thread_state && ExceptionBehaviorHasState(behavior)) { |
| 729 return MACH_RCV_PORT_DIED; | 756 return MACH_RCV_PORT_DIED; |
| 730 } | 757 } |
| 731 | 758 |
| 732 return KERN_SUCCESS; | 759 return KERN_SUCCESS; |
| 733 } | 760 } |
| 734 | 761 |
| 735 } // namespace crashpad | 762 } // namespace crashpad |
| OLD | NEW |