| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 // exception handler for EXC_CRASH, EXC_RESOURCE, and EXC_GUARD. See 10.9.5 | 200 // exception handler for EXC_CRASH, EXC_RESOURCE, and EXC_GUARD. See 10.9.5 |
| 201 // launchd-842.92.1/src/core.c job_setup_exception_port(). Normally, this job | 201 // launchd-842.92.1/src/core.c job_setup_exception_port(). Normally, this job |
| 202 // is com.apple.ReportCrash.Root, the systemwide Apple Crash Reporter. Since | 202 // is com.apple.ReportCrash.Root, the systemwide Apple Crash Reporter. Since |
| 203 // it is impossible to receive EXC_RESOURCE and EXC_GUARD exceptions through | 203 // it is impossible to receive EXC_RESOURCE and EXC_GUARD exceptions through |
| 204 // the EXC_CRASH mechanism, an exception handler must be registered for them | 204 // the EXC_CRASH mechanism, an exception handler must be registered for them |
| 205 // by name if it is to receive these exception types. The default task-level | 205 // by name if it is to receive these exception types. The default task-level |
| 206 // handler for these exception types is set by launchd in a similar manner. | 206 // handler for these exception types is set by launchd in a similar manner. |
| 207 // | 207 // |
| 208 // EXC_MASK_RESOURCE and EXC_MASK_GUARD are not available on all systems, and | 208 // EXC_MASK_RESOURCE and EXC_MASK_GUARD are not available on all systems, and |
| 209 // the kernel will reject attempts to use them if it does not understand them, | 209 // the kernel will reject attempts to use them if it does not understand them, |
| 210 // so AND them with ExcMaskAll(). EXC_MASK_CRASH is not present in | 210 // so AND them with ExcMaskValid(). EXC_MASK_CRASH is always supported. |
| 211 // ExcMaskAll() but is always supported. See the documentation for | |
| 212 // ExcMaskAll(). | |
| 213 ExceptionPorts exception_ports(ExceptionPorts::kTargetTypeTask, TASK_NULL); | 211 ExceptionPorts exception_ports(ExceptionPorts::kTargetTypeTask, TASK_NULL); |
| 214 if (!exception_ports.SetExceptionPort( | 212 if (!exception_ports.SetExceptionPort( |
| 215 EXC_MASK_CRASH | | 213 (EXC_MASK_CRASH | EXC_MASK_RESOURCE | EXC_MASK_GUARD) & |
| 216 ((EXC_MASK_RESOURCE | EXC_MASK_GUARD) & ExcMaskAll()), | 214 ExcMaskValid(), |
| 217 exception_port_, | 215 exception_port_, |
| 218 EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES, | 216 EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES, |
| 219 MACHINE_THREAD_STATE)) { | 217 MACHINE_THREAD_STATE)) { |
| 220 return false; | 218 return false; |
| 221 } | 219 } |
| 222 | 220 |
| 223 return true; | 221 return true; |
| 224 } | 222 } |
| 225 | 223 |
| 226 } // namespace crashpad | 224 } // namespace crashpad |
| OLD | NEW |