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 :doctype: manpage |
| 16 |
| 17 = exception_port_tool(1) |
| 18 |
| 19 == Name |
| 20 |
| 21 exception_port_tool - Show and change Mach exception ports |
| 22 |
| 23 == Synopsis |
| 24 |
| 25 [verse] |
| 26 *exception_port_tool* ['OPTION…'] ['COMMAND' ['ARG…']] |
| 27 |
| 28 == Description |
| 29 |
| 30 Shows Mach exception ports registered for a thread, task, or host target with a |
| 31 *--show_** option, changes Mach exception ports with *--set_handler*, shows |
| 32 changes with a *--show_new_** option, and executes 'COMMAND' along with any |
| 33 arguments specified ('ARG…') with the changed exception ports in effect. |
| 34 |
| 35 == Options |
| 36 *-s*, *--set_handler*='DESCRIPTION':: |
| 37 Set an exception port to 'DESCRIPTION'. This option may appear zero, one, or |
| 38 more times. |
| 39 + |
| 40 'DESCRIPTION' is formatted as a comma-separated sequence of tokens, where each |
| 41 token consists of a key and value separated by an equals sign. These keys are |
| 42 recognized: |
| 43 + |
| 44 *target*='TARGET'::: |
| 45 'TARGET' defines which target’s exception ports to set: *host*, *task*, or |
| 46 *thread*. The default value of 'TARGET' is *task*. Operations on *host* are |
| 47 restricted to the superuser. |
| 48 + |
| 49 *mask*='MASK'::: |
| 50 'MASK' defines the mask of exception types to handle, from |
| 51 +<mach/exception_types.h>+. This can be *BAD_ACCESS*, *BAD_INSTRUCTION*, |
| 52 *ARITHMETIC*, *EMULATION*, *SOFTWARE*, *BREAKPOINT*, *SYSCALL*, *MACH_SYSCALL*, |
| 53 *RPC_ALERT*, *CRASH*, *RESOURCE*, *GUARD*, or *CRASH*. Different exception types |
| 54 may be combined by combining them with pipe characters (*|*). The special value |
| 55 *ALL* includes each exception type except for *CRASH*. To truly specify all |
| 56 exception types including *CRASH*, use *ALL|CRASH*. The default value of 'MASK' |
| 57 is *CRASH*. |
| 58 + |
| 59 *behavior*='BEHAVIOR'::: |
| 60 'BEHAVIOR' defines the specific exception handler routine to be called when an |
| 61 exception occurs. This can be *DEFAULT*, *STATE*, or *STATE_IDENTITY*. *MACH* |
| 62 may also be specified by combining them with pipe characters (*|*). The most |
| 63 complete set of exception information is provided with *STATE_IDENTITY|MACH*. |
| 64 Not all exception servers implement all possible behaviors. The default value of |
| 65 'BEHAVIOR' is *DEFAULT|MACH*. |
| 66 + |
| 67 *flavor*='FLAVOR'::: |
| 68 For state-carrying values of 'BEHAVIOR' (those including *STATE* or |
| 69 *STATE_IDENTITY*), 'FLAVOR' specifies the architecture-specific thread state |
| 70 flavor to be provided to the exception handler. For the x86 family, this can be |
| 71 *THREAD*, *THREAD32*, *THREAD64*, *FLOAT*, *FLOAT32*, *FLOAT64*, *DEBUG*, |
| 72 *DEBUG32*, or *DEBUG64*. The default value of 'FLAVOR' is *NONE*, which is not |
| 73 valid for state-carrying values of 'BEHAVIOR'. |
| 74 + |
| 75 *handler*='HANDLER'::: |
| 76 'HANDLER' defines the exception handler. *NULL* indicates that any existing |
| 77 exception port should be cleared. 'HANDLER' may also take the form |
| 78 *bootstrap*:__SERVICE__, which will look 'SERVICE' up with the bootstrap server |
| 79 and set that service as the exception handler. The default value of 'HANDLER' is |
| 80 *NULL*. |
| 81 |
| 82 *--show_bootstrap*='SERVICE':: |
| 83 Looks up 'SERVICE' with the bootstrap server and shows it. Normally, the handler |
| 84 port values displayed by the other *--show_** options are meaningless |
| 85 handles, but by comparing them to the port values for known bootstrap services, |
| 86 it is possible to verify that they are set as intended. |
| 87 |
| 88 *-p*, *--pid*='PID':: |
| 89 For operations on the task target, including *--set_handler* with 'TARGET' set |
| 90 to *task*, *--show_task*, and *--show_new_task*, operates on the task associated |
| 91 with process id 'PID' instead of the current task associated with the tool. This |
| 92 option may be restricted to use by the superuser or processes permitted by |
| 93 taskgated(8) to use +task_for_pid()+. When this option is supplied, 'COMMAND' |
| 94 must not be specified. |
| 95 |
| 96 *-h*, *--show_host*:: |
| 97 Shows the original host exception ports before making any changes requested by |
| 98 *--set_handler*. This option is restricted to the superuser. |
| 99 |
| 100 *-t*, *--show_task*:: |
| 101 Shows the original task exception ports before making any changes requested by |
| 102 *--set_handler*. |
| 103 |
| 104 *--show_thread*:: |
| 105 Shows the original thread exception ports before making any changes requested by |
| 106 *--set_handler*. |
| 107 |
| 108 *-H*, *--show_new_host*:: |
| 109 Shows the modified host exception ports after making any changes requested by |
| 110 *--set_handler*. This option is restricted to the superuser. |
| 111 |
| 112 *-T*, *--show_new_task*:: |
| 113 Shows the modified task exception ports after making any changes requested by |
| 114 *--set_handler*. |
| 115 |
| 116 *--show_new_thread*:: |
| 117 Shows the modified thread exception ports after making any changes requested by |
| 118 *--set_handler*. |
| 119 |
| 120 *-n*, *--numeric*:: |
| 121 For *--show_** options, all values will be displayed numerically only. The |
| 122 default is to decode numeric values and display them symbolically as well. |
| 123 |
| 124 *--help*:: |
| 125 Display help and exit. |
| 126 |
| 127 *--version*:: |
| 128 Output version information and exit. |
| 129 |
| 130 == Examples |
| 131 |
| 132 Sets a new task-level exception handler for +EXC_CRASH+-type exceptions to the |
| 133 handler registered with the bootstrap server as +svc+, showing the task-level |
| 134 exception ports before and after the change. The old and new exception handlers |
| 135 are verified by their service names as registered with the bootstrap server. |
| 136 With the new task-level exception ports in effect, a program is run. |
| 137 [subs="quotes"] |
| 138 ---- |
| 139 $ *exception_port_tool --show_task --show_new_task \ |
| 140 --show_bootstrap=com.apple.ReportCrash --show_bootstrap=svc \ |
| 141 --set_handler=behavior=DEFAULT,handler=bootstrap:svc crash* |
| 142 service com.apple.ReportCrash 0xe03 |
| 143 service svc 0x1003 |
| 144 task exception port 0, mask 0x400 (CRASH), port 0xe03, |
| 145 behavior 0x80000003 (STATE_IDENTITY|MACH), flavor 7 (THREAD) |
| 146 new task exception port 0, mask 0x400 (CRASH), port 0x1003, |
| 147 behavior 0x1 (DEFAULT), flavor 13 (NONE) |
| 148 Illegal instruction: 4 |
| 149 ---- |
| 150 |
| 151 Shows the task-level exception ports for the process with PID 1234. This |
| 152 requires superuser permissions or the approval of taskgated(8). |
| 153 [subs="quotes"] |
| 154 ---- |
| 155 # *exception_port_tool --pid=1234 --show_task* |
| 156 task exception port 0, mask 0x4e |
| 157 (BAD_ACCESS|BAD_INSTRUCTION|ARITHMETIC|BREAKPOINT), port 0x1503, |
| 158 behavior 0x1 (DEFAULT), flavor 13 (NONE) |
| 159 task exception port 1, mask 0x1c00 (CRASH|RESOURCE|GUARD), |
| 160 port 0x1403, behavior 0x80000003 (STATE_IDENTITY|MACH), |
| 161 flavor 7 (THREAD) |
| 162 ---- |
| 163 |
| 164 == Exit Status |
| 165 |
| 166 *0*:: |
| 167 Success. |
| 168 |
| 169 *125*:: |
| 170 Failure, with a message printed to the standard error stream. |
| 171 |
| 172 *126*:: |
| 173 The program specified by 'COMMAND' was found, but could not be invoked. |
| 174 |
| 175 *127*:: |
| 176 The program specified by 'COMMAND' could not be found. |
| 177 |
| 178 == See Also |
| 179 |
| 180 exception_port_tool(1), |
| 181 on_demand_service_tool(1) |
| 182 |
| 183 include::man_footer.ad[] |
OLD | NEW |