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 10 matching lines...) Expand all Loading... |
21 | 21 |
22 //! \brief `MACH_PORT_NULL` with the correct type for a Mach port, | 22 //! \brief `MACH_PORT_NULL` with the correct type for a Mach port, |
23 //! `mach_port_t`. | 23 //! `mach_port_t`. |
24 //! | 24 //! |
25 //! For situations where implicit conversions between signed and unsigned types | 25 //! For situations where implicit conversions between signed and unsigned types |
26 //! are not performed, use kMachPortNull instead of an explicit `static_cast` of | 26 //! are not performed, use kMachPortNull instead of an explicit `static_cast` of |
27 //! `MACH_PORT_NULL` to `mach_port_t`. This is useful for logging and testing | 27 //! `MACH_PORT_NULL` to `mach_port_t`. This is useful for logging and testing |
28 //! assertions. | 28 //! assertions. |
29 const mach_port_t kMachPortNull = MACH_PORT_NULL; | 29 const mach_port_t kMachPortNull = MACH_PORT_NULL; |
30 | 30 |
| 31 //! \brief `MACH_EXCEPTION_CODES` with the correct type for a Mach exception |
| 32 //! behavior, `exception_behavior_t`. |
| 33 //! |
| 34 //! Signedness problems can occur when ORing `MACH_EXCEPTION_CODES` as a signed |
| 35 //! integer, because a signed integer overflow results. This constant can be |
| 36 //! used instead of `MACH_EXCEPTION_CODES` in such cases. |
| 37 const exception_behavior_t kMachExceptionCodes = MACH_EXCEPTION_CODES; |
| 38 |
31 // Because exception_mask_t is an int and has one bit for each defined | 39 // Because exception_mask_t is an int and has one bit for each defined |
32 // exception_type_t, it’s reasonable to assume that there cannot be any | 40 // exception_type_t, it’s reasonable to assume that there cannot be any |
33 // officially-defined exception_type_t values higher than 31. | 41 // officially-defined exception_type_t values higher than 31. |
34 // kMachExceptionSimulated uses a value well outside this range because it does | 42 // kMachExceptionSimulated uses a value well outside this range because it does |
35 // not require a corresponding mask value. Simulated exceptions are delivered to | 43 // not require a corresponding mask value. Simulated exceptions are delivered to |
36 // the exception handler registered for EXC_CRASH exceptions using | 44 // the exception handler registered for EXC_CRASH exceptions using |
37 // EXC_MASK_CRASH. | 45 // EXC_MASK_CRASH. |
38 | 46 |
39 //! \brief An exception type to use for simulated exceptions. | 47 //! \brief An exception type to use for simulated exceptions. |
40 const exception_type_t kMachExceptionSimulated = 'CPsx'; | 48 const exception_type_t kMachExceptionSimulated = 'CPsx'; |
41 | 49 |
42 } // namespace crashpad | 50 } // namespace crashpad |
43 | 51 |
44 #endif // CRASHPAD_UTIL_MACH_MACH_EXTENSIONS_H_ | 52 #endif // CRASHPAD_UTIL_MACH_MACH_EXTENSIONS_H_ |
OLD | NEW |