| 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 #ifndef CRASHPAD_UTIL_MACH_MACH_EXTENSIONS_H_ | 15 #ifndef CRASHPAD_UTIL_MACH_MACH_EXTENSIONS_H_ |
| 16 #define CRASHPAD_UTIL_MACH_MACH_EXTENSIONS_H_ | 16 #define CRASHPAD_UTIL_MACH_MACH_EXTENSIONS_H_ |
| 17 | 17 |
| 18 #include <mach/mach.h> | 18 #include <mach/mach.h> |
| 19 | 19 |
| 20 #include "base/mac/scoped_mach_port.h" |
| 21 |
| 20 namespace crashpad { | 22 namespace crashpad { |
| 21 | 23 |
| 22 //! \brief `MACH_PORT_NULL` with the correct type for a Mach port, | 24 //! \brief `MACH_PORT_NULL` with the correct type for a Mach port, |
| 23 //! `mach_port_t`. | 25 //! `mach_port_t`. |
| 24 //! | 26 //! |
| 25 //! For situations where implicit conversions between signed and unsigned types | 27 //! For situations where implicit conversions between signed and unsigned types |
| 26 //! are not performed, use kMachPortNull instead of an explicit `implicit_cast` | 28 //! are not performed, use kMachPortNull instead of an explicit `implicit_cast` |
| 27 //! of `MACH_PORT_NULL` to `mach_port_t`. This is useful for logging and testing | 29 //! of `MACH_PORT_NULL` to `mach_port_t`. This is useful for logging and testing |
| 28 //! assertions. | 30 //! assertions. |
| 29 const mach_port_t kMachPortNull = MACH_PORT_NULL; | 31 const mach_port_t kMachPortNull = MACH_PORT_NULL; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 //! `EXC_MASK_ALL`, and thus ExcMaskAll(), never includes the value of | 110 //! `EXC_MASK_ALL`, and thus ExcMaskAll(), never includes the value of |
| 109 //! `EXC_MASK_CRASH` or `EXC_MASK_CORPSE_NOTIFY`. For situations where an | 111 //! `EXC_MASK_CRASH` or `EXC_MASK_CORPSE_NOTIFY`. For situations where an |
| 110 //! exception mask corresponding to every possible exception understood by the | 112 //! exception mask corresponding to every possible exception understood by the |
| 111 //! running kernel is desired, use this function instead. | 113 //! running kernel is desired, use this function instead. |
| 112 //! | 114 //! |
| 113 //! Should new exception types be introduced in the future, this function will | 115 //! Should new exception types be introduced in the future, this function will |
| 114 //! be updated to include their bits in the returned mask value when run time | 116 //! be updated to include their bits in the returned mask value when run time |
| 115 //! support is present. | 117 //! support is present. |
| 116 exception_mask_t ExcMaskValid(); | 118 exception_mask_t ExcMaskValid(); |
| 117 | 119 |
| 120 //! \brief Obtains the system’s default Mach exception handler for crash-type |
| 121 //! exceptions. |
| 122 //! |
| 123 //! This is obtained by looking up `"com.apple.ReportCrash"` with the bootstrap |
| 124 //! server. The service name comes from the first launch agent loaded by |
| 125 //! `launchd` with a `MachServices` entry having `ExceptionServer` set. This |
| 126 //! launch agent is normally loaded from |
| 127 //! `/System/Library/LaunchAgents/com.apple.ReportCrash.plist`. |
| 128 //! |
| 129 //! \return On success, a send right to an `exception_handler_t` corresponding |
| 130 //! to the system’s default crash reporter. On failure, `MACH_PORT_NULL`, |
| 131 //! with a message logged. |
| 132 base::mac::ScopedMachSendRight SystemCrashReporterHandler(); |
| 133 |
| 118 } // namespace crashpad | 134 } // namespace crashpad |
| 119 | 135 |
| 120 #endif // CRASHPAD_UTIL_MACH_MACH_EXTENSIONS_H_ | 136 #endif // CRASHPAD_UTIL_MACH_MACH_EXTENSIONS_H_ |
| OLD | NEW |