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, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #include "util/mach/exc_server_variants.h" | 15 #include "util/mach/exc_server_variants.h" |
16 | 16 |
| 17 #include <AvailabilityMacros.h> |
17 #include <string.h> | 18 #include <string.h> |
18 | 19 |
19 #include <algorithm> | 20 #include <algorithm> |
20 #include <vector> | 21 #include <vector> |
21 | 22 |
22 #include "base/logging.h" | 23 #include "base/logging.h" |
| 24 #include "util/mac/mac_util.h" |
23 #include "util/mach/composite_mach_message_server.h" | 25 #include "util/mach/composite_mach_message_server.h" |
24 #include "util/mach/exc.h" | 26 #include "util/mach/exc.h" |
25 #include "util/mach/exception_behaviors.h" | 27 #include "util/mach/exception_behaviors.h" |
26 #include "util/mach/excServer.h" | 28 #include "util/mach/excServer.h" |
27 #include "util/mach/mach_exc.h" | 29 #include "util/mach/mach_exc.h" |
28 #include "util/mach/mach_excServer.h" | 30 #include "util/mach/mach_excServer.h" |
29 #include "util/mach/mach_message.h" | 31 #include "util/mach/mach_message.h" |
30 | 32 |
31 extern "C" { | 33 extern "C" { |
32 | 34 |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 } | 762 } |
761 | 763 |
762 mach_msg_size_t UniversalMachExcServer::MachMessageServerRequestSize() { | 764 mach_msg_size_t UniversalMachExcServer::MachMessageServerRequestSize() { |
763 return impl_->MachMessageServerRequestSize(); | 765 return impl_->MachMessageServerRequestSize(); |
764 } | 766 } |
765 | 767 |
766 mach_msg_size_t UniversalMachExcServer::MachMessageServerReplySize() { | 768 mach_msg_size_t UniversalMachExcServer::MachMessageServerReplySize() { |
767 return impl_->MachMessageServerReplySize(); | 769 return impl_->MachMessageServerReplySize(); |
768 } | 770 } |
769 | 771 |
770 kern_return_t ExcServerSuccessfulReturnValue(exception_behavior_t behavior, | 772 kern_return_t ExcServerSuccessfulReturnValue(exception_type_t exception, |
| 773 exception_behavior_t behavior, |
771 bool set_thread_state) { | 774 bool set_thread_state) { |
| 775 if (exception == EXC_CRASH |
| 776 #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_11 |
| 777 && MacOSXMinorVersion() >= 11 |
| 778 #endif |
| 779 ) { |
| 780 return KERN_SUCCESS; |
| 781 } |
| 782 |
772 if (!set_thread_state && ExceptionBehaviorHasState(behavior)) { | 783 if (!set_thread_state && ExceptionBehaviorHasState(behavior)) { |
773 return MACH_RCV_PORT_DIED; | 784 return MACH_RCV_PORT_DIED; |
774 } | 785 } |
775 | 786 |
776 return KERN_SUCCESS; | 787 return KERN_SUCCESS; |
777 } | 788 } |
778 | 789 |
779 void ExcServerCopyState(exception_behavior_t behavior, | 790 void ExcServerCopyState(exception_behavior_t behavior, |
780 ConstThreadState old_state, | 791 ConstThreadState old_state, |
781 mach_msg_type_number_t old_state_count, | 792 mach_msg_type_number_t old_state_count, |
782 thread_state_t new_state, | 793 thread_state_t new_state, |
783 mach_msg_type_number_t* new_state_count) { | 794 mach_msg_type_number_t* new_state_count) { |
784 if (ExceptionBehaviorHasState(behavior)) { | 795 if (ExceptionBehaviorHasState(behavior)) { |
785 *new_state_count = std::min(old_state_count, *new_state_count); | 796 *new_state_count = std::min(old_state_count, *new_state_count); |
786 memcpy(new_state, old_state, *new_state_count * sizeof(old_state[0])); | 797 memcpy(new_state, old_state, *new_state_count * sizeof(old_state[0])); |
787 } | 798 } |
788 } | 799 } |
789 | 800 |
790 } // namespace crashpad | 801 } // namespace crashpad |
OLD | NEW |