| 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 exception_port_tool - Show and change Mach exception ports | 21 exception_port_tool - Show and change Mach exception ports |
| 22 | 22 |
| 23 == Synopsis | 23 == Synopsis |
| 24 | 24 |
| 25 [verse] | 25 [verse] |
| 26 *exception_port_tool* ['OPTION…'] ['COMMAND' ['ARG…']] | 26 *exception_port_tool* ['OPTION…'] ['COMMAND' ['ARG…']] |
| 27 | 27 |
| 28 == Description | 28 == Description |
| 29 | 29 |
| 30 Shows Mach exception ports registered for a thread, task, or host target with a | 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 | 31 *--show-** option, changes Mach exception ports with *--set-handler*, shows |
| 32 changes with a *--show_new_** option, and executes 'COMMAND' along with any | 32 changes with a *--show-new-** option, and executes 'COMMAND' along with any |
| 33 arguments specified ('ARG…') with the changed exception ports in effect. | 33 arguments specified ('ARG…') with the changed exception ports in effect. |
| 34 | 34 |
| 35 == Options | 35 == Options |
| 36 *-s*, *--set_handler*='DESCRIPTION':: | 36 *-s*, *--set-handler*='DESCRIPTION':: |
| 37 Set an exception port to 'DESCRIPTION'. This option may appear zero, one, or | 37 Set an exception port to 'DESCRIPTION'. This option may appear zero, one, or |
| 38 more times. | 38 more times. |
| 39 + | 39 + |
| 40 'DESCRIPTION' is formatted as a comma-separated sequence of tokens, where each | 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 | 41 token consists of a key and value separated by an equals sign. These keys are |
| 42 recognized: | 42 recognized: |
| 43 + | 43 + |
| 44 *target*='TARGET'::: | 44 *target*='TARGET'::: |
| 45 'TARGET' defines which target’s exception ports to set: *host*, *task*, or | 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 | 46 *thread*. The default value of 'TARGET' is *task*. Operations on *host* are |
| (...skipping 25 matching lines...) Expand all Loading... |
| 72 *DEBUG32*, or *DEBUG64*. The default value of 'FLAVOR' is *NONE*, which is not | 72 *DEBUG32*, or *DEBUG64*. The default value of 'FLAVOR' is *NONE*, which is not |
| 73 valid for state-carrying values of 'BEHAVIOR'. | 73 valid for state-carrying values of 'BEHAVIOR'. |
| 74 + | 74 + |
| 75 *handler*='HANDLER'::: | 75 *handler*='HANDLER'::: |
| 76 'HANDLER' defines the exception handler. *NULL* indicates that any existing | 76 'HANDLER' defines the exception handler. *NULL* indicates that any existing |
| 77 exception port should be cleared. 'HANDLER' may also take the form | 77 exception port should be cleared. 'HANDLER' may also take the form |
| 78 *bootstrap*:__SERVICE__, which will look 'SERVICE' up with the bootstrap server | 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 | 79 and set that service as the exception handler. The default value of 'HANDLER' is |
| 80 *NULL*. | 80 *NULL*. |
| 81 | 81 |
| 82 *--show_bootstrap*='SERVICE':: | 82 *--show-bootstrap*='SERVICE':: |
| 83 Looks up 'SERVICE' with the bootstrap server and shows it. Normally, the handler | 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 | 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, | 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. | 86 it is possible to verify that they are set as intended. |
| 87 | 87 |
| 88 *-p*, *--pid*='PID':: | 88 *-p*, *--pid*='PID':: |
| 89 For operations on the task target, including *--set_handler* with 'TARGET' set | 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 | 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 | 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. | 92 this option is supplied, 'COMMAND' must not be specified. |
| 93 + | 93 + |
| 94 This option uses +task_for_pid()+ to access the process’ task port. This | 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 | 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 | 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 | 97 this option. It is possible to install this program as a setuid root executable |
| 98 to overcome this limitation. | 98 to overcome this limitation. |
| 99 | 99 |
| 100 *-h*, *--show_host*:: | 100 *-h*, *--show-host*:: |
| 101 Shows the original host exception ports before making any changes requested by | 101 Shows the original host exception ports before making any changes requested by |
| 102 *--set_handler*. This option is restricted to the superuser. | 102 *--set-handler*. This option is restricted to the superuser. |
| 103 | 103 |
| 104 *-t*, *--show_task*:: | 104 *-t*, *--show-task*:: |
| 105 Shows the original task exception ports before making any changes requested by | 105 Shows the original task exception ports before making any changes requested by |
| 106 *--set_handler*. | 106 *--set-handler*. |
| 107 | 107 |
| 108 *--show_thread*:: | 108 *--show-thread*:: |
| 109 Shows the original thread exception ports before making any changes requested by | 109 Shows the original thread exception ports before making any changes requested by |
| 110 *--set_handler*. | 110 *--set-handler*. |
| 111 | 111 |
| 112 *-H*, *--show_new_host*:: | 112 *-H*, *--show-new-host*:: |
| 113 Shows the modified host exception ports after making any changes requested by | 113 Shows the modified host exception ports after making any changes requested by |
| 114 *--set_handler*. This option is restricted to the superuser. | 114 *--set-handler*. This option is restricted to the superuser. |
| 115 | 115 |
| 116 *-T*, *--show_new_task*:: | 116 *-T*, *--show-new-task*:: |
| 117 Shows the modified task exception ports after making any changes requested by | 117 Shows the modified task exception ports after making any changes requested by |
| 118 *--set_handler*. | 118 *--set-handler*. |
| 119 | 119 |
| 120 *--show_new_thread*:: | 120 *--show-new-thread*:: |
| 121 Shows the modified thread exception ports after making any changes requested by | 121 Shows the modified thread exception ports after making any changes requested by |
| 122 *--set_handler*. | 122 *--set-handler*. |
| 123 | 123 |
| 124 *-n*, *--numeric*:: | 124 *-n*, *--numeric*:: |
| 125 For *--show_** options, all values will be displayed numerically only. The | 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. | 126 default is to decode numeric values and display them symbolically as well. |
| 127 | 127 |
| 128 *--help*:: | 128 *--help*:: |
| 129 Display help and exit. | 129 Display help and exit. |
| 130 | 130 |
| 131 *--version*:: | 131 *--version*:: |
| 132 Output version information and exit. | 132 Output version information and exit. |
| 133 | 133 |
| 134 == Examples | 134 == Examples |
| 135 | 135 |
| 136 Sets a new task-level exception handler for +EXC_CRASH+-type exceptions to the | 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 | 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 | 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. | 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. | 140 With the new task-level exception ports in effect, a program is run. |
| 141 [subs="quotes"] | 141 [subs="quotes"] |
| 142 ---- | 142 ---- |
| 143 $ *exception_port_tool --show_task --show_new_task \ | 143 $ *exception_port_tool --show-task --show-new-task \ |
| 144 --show_bootstrap=com.apple.ReportCrash --show_bootstrap=svc \ | 144 --show-bootstrap=com.apple.ReportCrash --show-bootstrap=svc \ |
| 145 --set_handler=behavior=DEFAULT,handler=bootstrap:svc crash* | 145 --set-handler=behavior=DEFAULT,handler=bootstrap:svc crash* |
| 146 service com.apple.ReportCrash 0xe03 | 146 service com.apple.ReportCrash 0xe03 |
| 147 service svc 0x1003 | 147 service svc 0x1003 |
| 148 task exception port 0, mask 0x400 (CRASH), port 0xe03, | 148 task exception port 0, mask 0x400 (CRASH), port 0xe03, |
| 149 behavior 0x80000003 (STATE_IDENTITY|MACH), flavor 7 (THREAD) | 149 behavior 0x80000003 (STATE_IDENTITY|MACH), flavor 7 (THREAD) |
| 150 new task exception port 0, mask 0x400 (CRASH), port 0x1003, | 150 new task exception port 0, mask 0x400 (CRASH), port 0x1003, |
| 151 behavior 0x1 (DEFAULT), flavor 13 (NONE) | 151 behavior 0x1 (DEFAULT), flavor 13 (NONE) |
| 152 Illegal instruction: 4 | 152 Illegal instruction: 4 |
| 153 ---- | 153 ---- |
| 154 | 154 |
| 155 Shows the task-level exception ports for the process with PID 1234. This | 155 Shows the task-level exception ports for the process with PID 1234. This |
| 156 requires superuser permissions or the approval of taskgated(8). | 156 requires superuser permissions or the approval of taskgated(8). |
| 157 [subs="quotes"] | 157 [subs="quotes"] |
| 158 ---- | 158 ---- |
| 159 # *exception_port_tool --pid=1234 --show_task* | 159 # *exception_port_tool --pid=1234 --show-task* |
| 160 task exception port 0, mask 0x4e | 160 task exception port 0, mask 0x4e |
| 161 (BAD_ACCESS|BAD_INSTRUCTION|ARITHMETIC|BREAKPOINT), port 0x1503, | 161 (BAD_ACCESS|BAD_INSTRUCTION|ARITHMETIC|BREAKPOINT), port 0x1503, |
| 162 behavior 0x1 (DEFAULT), flavor 13 (NONE) | 162 behavior 0x1 (DEFAULT), flavor 13 (NONE) |
| 163 task exception port 1, mask 0x1c00 (CRASH|RESOURCE|GUARD), | 163 task exception port 1, mask 0x1c00 (CRASH|RESOURCE|GUARD), |
| 164 port 0x1403, behavior 0x80000003 (STATE_IDENTITY|MACH), | 164 port 0x1403, behavior 0x80000003 (STATE_IDENTITY|MACH), |
| 165 flavor 7 (THREAD) | 165 flavor 7 (THREAD) |
| 166 ---- | 166 ---- |
| 167 | 167 |
| 168 == Exit Status | 168 == Exit Status |
| 169 | 169 |
| 170 *0*:: | 170 *0*:: |
| 171 Success. | 171 Success. |
| 172 | 172 |
| 173 *125*:: | 173 *125*:: |
| 174 Failure, with a message printed to the standard error stream. | 174 Failure, with a message printed to the standard error stream. |
| 175 | 175 |
| 176 *126*:: | 176 *126*:: |
| 177 The program specified by 'COMMAND' was found, but could not be invoked. | 177 The program specified by 'COMMAND' was found, but could not be invoked. |
| 178 | 178 |
| 179 *127*:: | 179 *127*:: |
| 180 The program specified by 'COMMAND' could not be found. | 180 The program specified by 'COMMAND' could not be found. |
| 181 | 181 |
| 182 == See Also | 182 == See Also |
| 183 | 183 |
| 184 catch_exception_tool(1), | 184 catch_exception_tool(1), |
| 185 on_demand_service_tool(1) | 185 on_demand_service_tool(1) |
| 186 | 186 |
| 187 include::man_footer.ad[] | 187 include::man_footer.ad[] |
| OLD | NEW |