| 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 *CORPSE_NOTIFY*. Different | |
| 54 exception types may be combined by combining them with pipe characters (*|*). | |
| 55 The special value *ALL* includes each exception type except for *CRASH*. To | |
| 56 truly specify all exception types including *CRASH*, use *ALL|CRASH*. The | |
| 57 default value of 'MASK' 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. When | |
| 92 this option is supplied, 'COMMAND' must not be specified. | |
| 93 + | |
| 94 This option uses +task_for_pid()+ to access the process’ task port. This | |
| 95 operation may be restricted to use by the superuser, executables signed by an | |
| 96 authority trusted by the system, and processes otherwise permitted by | |
| 97 taskgated(8). Consequently, this program must normally either be signed or be | |
| 98 invoked by root to use this option. It is possible to install this program as a | |
| 99 setuid root executable to overcome this limitation. | |
| 100 | |
| 101 *-h*, *--show-host*:: | |
| 102 Shows the original host exception ports before making any changes requested by | |
| 103 *--set-handler*. This option is restricted to the superuser. | |
| 104 | |
| 105 *-t*, *--show-task*:: | |
| 106 Shows the original task exception ports before making any changes requested by | |
| 107 *--set-handler*. | |
| 108 | |
| 109 *--show-thread*:: | |
| 110 Shows the original thread exception ports before making any changes requested by | |
| 111 *--set-handler*. | |
| 112 | |
| 113 *-H*, *--show-new-host*:: | |
| 114 Shows the modified host exception ports after making any changes requested by | |
| 115 *--set-handler*. This option is restricted to the superuser. | |
| 116 | |
| 117 *-T*, *--show-new-task*:: | |
| 118 Shows the modified task exception ports after making any changes requested by | |
| 119 *--set-handler*. | |
| 120 | |
| 121 *--show-new-thread*:: | |
| 122 Shows the modified thread exception ports after making any changes requested by | |
| 123 *--set-handler*. | |
| 124 | |
| 125 *-n*, *--numeric*:: | |
| 126 For *--show-** options, all values will be displayed numerically only. The | |
| 127 default is to decode numeric values and display them symbolically as well. | |
| 128 | |
| 129 *--help*:: | |
| 130 Display help and exit. | |
| 131 | |
| 132 *--version*:: | |
| 133 Output version information and exit. | |
| 134 | |
| 135 == Examples | |
| 136 | |
| 137 Sets a new task-level exception handler for +EXC_CRASH+-type exceptions to the | |
| 138 handler registered with the bootstrap server as +svc+, showing the task-level | |
| 139 exception ports before and after the change. The old and new exception handlers | |
| 140 are verified by their service names as registered with the bootstrap server. | |
| 141 With the new task-level exception ports in effect, a program is run. | |
| 142 [subs="quotes"] | |
| 143 ---- | |
| 144 $ *exception_port_tool --show-task --show-new-task \ | |
| 145 --show-bootstrap=com.apple.ReportCrash --show-bootstrap=svc \ | |
| 146 --set-handler=behavior=DEFAULT,handler=bootstrap:svc crash* | |
| 147 service com.apple.ReportCrash 0xe03 | |
| 148 service svc 0x1003 | |
| 149 task exception port 0, mask 0x400 (CRASH), port 0xe03, | |
| 150 behavior 0x80000003 (STATE_IDENTITY|MACH), flavor 7 (THREAD) | |
| 151 new task exception port 0, mask 0x400 (CRASH), port 0x1003, | |
| 152 behavior 0x1 (DEFAULT), flavor 13 (NONE) | |
| 153 Illegal instruction: 4 | |
| 154 ---- | |
| 155 | |
| 156 Shows the task-level exception ports for the process with PID 1234. This | |
| 157 requires superuser permissions or the approval of taskgated(8). | |
| 158 [subs="quotes"] | |
| 159 ---- | |
| 160 # *exception_port_tool --pid=1234 --show-task* | |
| 161 task exception port 0, mask 0x4e | |
| 162 (BAD_ACCESS|BAD_INSTRUCTION|ARITHMETIC|BREAKPOINT), port 0x1503, | |
| 163 behavior 0x1 (DEFAULT), flavor 13 (NONE) | |
| 164 task exception port 1, mask 0x1c00 (CRASH|RESOURCE|GUARD), | |
| 165 port 0x1403, behavior 0x80000003 (STATE_IDENTITY|MACH), | |
| 166 flavor 7 (THREAD) | |
| 167 ---- | |
| 168 | |
| 169 == Exit Status | |
| 170 | |
| 171 *0*:: | |
| 172 Success. | |
| 173 | |
| 174 *125*:: | |
| 175 Failure, with a message printed to the standard error stream. | |
| 176 | |
| 177 *126*:: | |
| 178 The program specified by 'COMMAND' was found, but could not be invoked. | |
| 179 | |
| 180 *127*:: | |
| 181 The program specified by 'COMMAND' could not be found. | |
| 182 | |
| 183 == See Also | |
| 184 | |
| 185 man_link:catch_exception_tool[1], | |
| 186 man_link:on_demand_service_tool[1] | |
| 187 | |
| 188 include::../../doc/support/man_footer.ad[] | |
| OLD | NEW |