Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: util/mach/exception_ports.cc

Issue 584223002: ExceptionPorts test: accept a port of MACH_PORT_NULL as “no handler.” (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « util/mach/exception_ports.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 kern_return_t kr = get_exception_ports_( 93 kern_return_t kr = get_exception_ports_(
94 target_port_, mask, masks, &handler_count, ports, behaviors, flavors); 94 target_port_, mask, masks, &handler_count, ports, behaviors, flavors);
95 if (kr != KERN_SUCCESS) { 95 if (kr != KERN_SUCCESS) {
96 MACH_LOG(ERROR, kr) << TargetTypeName() << "_get_exception_ports"; 96 MACH_LOG(ERROR, kr) << TargetTypeName() << "_get_exception_ports";
97 return false; 97 return false;
98 } 98 }
99 99
100 handlers->clear(); 100 handlers->clear();
101 for (mach_msg_type_number_t index = 0; index < handler_count; ++index) { 101 for (mach_msg_type_number_t index = 0; index < handler_count; ++index) {
102 ExceptionHandler handler; 102 if (ports[index] != MACH_PORT_NULL) {
103 handler.mask = masks[index]; 103 ExceptionHandler handler;
104 handler.port = ports[index]; 104 handler.mask = masks[index];
105 handler.behavior = behaviors[index]; 105 handler.port = ports[index];
106 handler.flavor = flavors[index]; 106 handler.behavior = behaviors[index];
107 handlers->push_back(handler); 107 handler.flavor = flavors[index];
108 handlers->push_back(handler);
109 }
108 } 110 }
109 111
110 return true; 112 return true;
111 } 113 }
112 114
113 bool ExceptionPorts::SetExceptionPort(exception_mask_t mask, 115 bool ExceptionPorts::SetExceptionPort(exception_mask_t mask,
114 exception_handler_t port, 116 exception_handler_t port,
115 exception_behavior_t behavior, 117 exception_behavior_t behavior,
116 thread_state_flavor_t flavor) const { 118 thread_state_flavor_t flavor) const {
117 kern_return_t kr = 119 kern_return_t kr =
118 set_exception_ports_(target_port_, mask, port, behavior, flavor); 120 set_exception_ports_(target_port_, mask, port, behavior, flavor);
119 if (kr != KERN_SUCCESS) { 121 if (kr != KERN_SUCCESS) {
120 MACH_LOG(ERROR, kr) << TargetTypeName() << "_set_exception_ports"; 122 MACH_LOG(ERROR, kr) << TargetTypeName() << "_set_exception_ports";
121 return false; 123 return false;
122 } 124 }
123 125
124 return true; 126 return true;
125 } 127 }
126 128
127 const char* ExceptionPorts::TargetTypeName() const { 129 const char* ExceptionPorts::TargetTypeName() const {
128 return target_name_; 130 return target_name_;
129 } 131 }
130 132
131 } // namespace crashpad 133 } // namespace crashpad
OLDNEW
« no previous file with comments | « util/mach/exception_ports.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698