OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (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 | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 | |
15 #ifndef CRASHPAD_UTIL_MACH_EXC_CLIENT_VARIANTS_H_ | |
16 #define CRASHPAD_UTIL_MACH_EXC_CLIENT_VARIANTS_H_ | |
17 | |
18 #include <mach/mach.h> | |
19 | |
20 namespace crashpad { | |
21 | |
22 //! \brief Calls the appropriate `*exception_raise*()` function for the | |
23 //! specified \a behavior. | |
24 //! | |
25 //! The function called will be `exception_raise()` for `EXCEPTION_DEFAULT`, | |
26 //! `exception_raise_state()` for `EXCEPTION_STATE`, or | |
27 //! `exception_raise_state_identity()` for `EXCEPTION_STATE_IDENTITY`. If | |
28 //! `MACH_EXCEPTION_CODES` is also set, the function called will instead be | |
29 //! `mach_exception_raise()`, `mach_exception_raise_state()` or | |
30 //! `mach_exception_raise_state_identity()`, respectively. | |
31 //! | |
32 //! This function does not fetch the existing thread state for \a behavior | |
33 //! values that require a thread state. The caller must provide the existing | |
34 //! thread state in the \a flavor, \a old_state, and \a old_state_count | |
35 //! parameters for \a behavior values that require a thread state. Thread states | |
36 //! may be obtained by calling `thread_get_state()` if needed. Similarly, this | |
37 //! function does not do anything with the new thread state returned for these | |
38 //! \a behavior values. Callers that wish to make use of the new thread state | |
39 //! may do so by using the returned \a flavor, \a new_state, and \a | |
40 //! new_state_count values. Thread states may be set by calling | |
41 //! `thread_set_state()` if needed. | |
42 //! | |
43 //! \a thread and \a task are only used when \a behavior indicates that the | |
44 //! exception message will carry identity information, when it has the value | |
45 //! value `EXCEPTION_DEFAULT` or `EXCEPTION_STATE_IDENTITY`, possibly with | |
46 //! `MACH_EXCEPTION_CODES` also set. In other cases, these parameters are unused | |
47 //! and may be set to `MACH_PORT_NULL`. | |
48 //! | |
49 //! \a flavor, \a old_state, \a old_state_count, \a new_state, and \a | |
50 //! new_state_count are only used when \a behavior indicates that the exception | |
51 //! message will carry thread state information, when it has the value | |
52 //! `EXCEPTION_STATE` or `EXCEPTION_STATE_IDENTITY`, possibly with | |
53 //! `MACH_EXCEPTION_CODES` also set. In other cases, these parameters are unused | |
54 //! and may be set to `0` (\a old_state_count) or `NULL` (the remaining | |
55 //! parameters). | |
56 //! | |
57 //! \param[in] behavior The exception behavior, which dictates which function | |
58 //! will be called. It is an error to call this function with an invalid | |
59 //! value for \a behavior. | |
60 //! \param[in] code If \behavior indicates a behavior without | |
61 //! `MACH_EXCEPTION_CODES`, the elements of \a code will be truncated in | |
62 //! order to be passed to the appropriate exception handler. | |
Robert Sesek
2014/09/15 20:55:43
I assume it's deliberate to not document all the o
| |
63 //! | |
64 //! \return The return value of the function called. | |
65 kern_return_t UniversalExceptionRaise(exception_behavior_t behavior, | |
66 exception_handler_t exception_port, | |
67 thread_t thread, | |
68 task_t task, | |
69 exception_type_t exception, | |
70 const mach_exception_data_type_t* code, | |
71 mach_msg_type_number_t code_count, | |
72 thread_state_flavor_t* flavor, | |
73 const natural_t* old_state, | |
74 mach_msg_type_number_t old_state_count, | |
75 thread_state_t new_state, | |
76 mach_msg_type_number_t* new_state_count); | |
77 | |
78 } // namespace crashpad | |
79 | |
80 #endif // CRASHPAD_UTIL_MACH_EXC_CLIENT_VARIANTS_H_ | |
OLD | NEW |