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