2014-10-17 11:01:48 -04:00
|
|
|
|
// Copyright 2014 The Crashpad Authors. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
|
//
|
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
//
|
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
|
|
:doctype: manpage
|
|
|
|
|
|
|
|
|
|
= catch_exception_tool(1)
|
|
|
|
|
|
|
|
|
|
== Name
|
|
|
|
|
|
|
|
|
|
catch_exception_tool - Catch Mach exceptions and display information about them
|
|
|
|
|
|
|
|
|
|
== Synopsis
|
|
|
|
|
|
|
|
|
|
[verse]
|
|
|
|
|
*catch_exception_tool* *-m* 'SERVICE' ['OPTION…']
|
|
|
|
|
|
|
|
|
|
== Description
|
|
|
|
|
|
|
|
|
|
Runs a Mach exception server registered with the bootstrap server under the name
|
|
|
|
|
'SERVICE'. The exception server is capable of receiving exceptions for
|
|
|
|
|
“behavior” values of +EXCEPTION_DEFAULT+, +EXCEPTION_STATE+, and
|
|
|
|
|
+EXCEPTION_STATE_IDENTITY+, with or without +MACH_EXCEPTION_CODES+ set.
|
|
|
|
|
|
|
|
|
|
== Options
|
|
|
|
|
|
|
|
|
|
*-f*, *--file*='FILE'::
|
|
|
|
|
Information about the exception will be appended to 'FILE' instead of the
|
|
|
|
|
standard output stream.
|
|
|
|
|
|
2014-12-04 16:46:12 -05:00
|
|
|
|
*-m*, *--mach-service*='SERVICE'::
|
2014-10-17 11:01:48 -04:00
|
|
|
|
Check in with the bootstrap server under the name 'SERVICE'. This service name
|
|
|
|
|
may already be reserved with the bootstrap server in cases where this tool is
|
|
|
|
|
started by launchd(8) as a result of a message being sent to a service declared
|
|
|
|
|
in a job’s +MachServices+ dictionary (see launchd.plist(5)). The service name
|
|
|
|
|
may also be completely unknown to the system.
|
|
|
|
|
|
|
|
|
|
*-p*, *--persistent*::
|
|
|
|
|
Continue processing exceptions after the first one. The default mode is
|
|
|
|
|
one-shot, where this tool exits after processing the first exception.
|
|
|
|
|
|
|
|
|
|
*-t*, *--timeout*='TIMEOUT'::
|
2014-12-10 11:11:21 -05:00
|
|
|
|
Run for a maximum of 'TIMEOUT' seconds. Specify +0+ to request non-blocking
|
|
|
|
|
operation, in which the tool exits immediately if no exception is received. In
|
|
|
|
|
*--persistent* mode, 'TIMEOUT' applies to the overall duration that this tool
|
|
|
|
|
will run, not to the processing of individual exceptions. When *--timeout* is
|
|
|
|
|
not specified, this tool will block indefinitely while waiting for an exception.
|
2014-10-17 11:01:48 -04:00
|
|
|
|
|
|
|
|
|
*--help*::
|
|
|
|
|
Display help and exit.
|
|
|
|
|
|
|
|
|
|
*--version*::
|
|
|
|
|
Output version information and exit.
|
|
|
|
|
|
|
|
|
|
== Examples
|
|
|
|
|
|
|
|
|
|
Run a one-shot blocking exception server registered with the bootstrap server
|
|
|
|
|
under the name +svc+:
|
|
|
|
|
[subs="quotes"]
|
|
|
|
|
----
|
2014-12-04 16:46:12 -05:00
|
|
|
|
$ *catch_exception_tool --mach-service=svc --file=out &*
|
2014-10-17 11:01:48 -04:00
|
|
|
|
[1] 1233
|
2014-12-04 16:46:12 -05:00
|
|
|
|
$ *exception_port_tool --set-handler=handler=bootstrap:svc crasher*
|
2014-10-17 11:01:48 -04:00
|
|
|
|
Illegal instruction: 4
|
2014-12-04 16:46:12 -05:00
|
|
|
|
[1]+ Done catch_exception_tool --mach-service=svc --file=out
|
2014-10-17 11:01:48 -04:00
|
|
|
|
$ *cat out*
|
|
|
|
|
catch_exception_tool:
|
|
|
|
|
behavior EXCEPTION_DEFAULT|MACH_EXCEPTION_CODES,
|
|
|
|
|
pid 1234, thread 56789, exception EXC_CRASH, codes[2] 0x4200001, 0,
|
|
|
|
|
original exception EXC_BAD_INSTRUCTION, original code[0] 1,
|
|
|
|
|
signal SIGILL
|
|
|
|
|
----
|
|
|
|
|
|
|
|
|
|
Run an on-demand exception server started by launchd(5) available via the
|
|
|
|
|
bootstrap server under the name +svc+:
|
|
|
|
|
[subs="quotes"]
|
|
|
|
|
----
|
|
|
|
|
$ *on_demand_service_tool --load --label=catch_exception \
|
2014-12-04 16:46:12 -05:00
|
|
|
|
--mach-service=svc \
|
|
|
|
|
$(which catch_exception_tool) --mach-service=svc \
|
2014-12-10 11:11:21 -05:00
|
|
|
|
--file=/tmp/out --persistent --timeout=0*
|
2014-12-04 16:46:12 -05:00
|
|
|
|
$ *exception_port_tool --set-handler=handler=bootstrap:svc crasher*
|
2014-10-17 11:01:48 -04:00
|
|
|
|
Illegal instruction: 4
|
|
|
|
|
$ *on_demand_service_tool --unload --label=catch_exception*
|
|
|
|
|
$ *cat /tmp/out*
|
|
|
|
|
catch_exception_tool:
|
|
|
|
|
behavior EXCEPTION_DEFAULT|MACH_EXCEPTION_CODES,
|
|
|
|
|
pid 2468, thread 13579, exception EXC_CRASH, codes[2] 0x4200001, 0,
|
|
|
|
|
original exception EXC_BAD_INSTRUCTION, original code[0] 1,
|
|
|
|
|
signal SIGILL
|
|
|
|
|
----
|
|
|
|
|
|
|
|
|
|
== Exit Status
|
|
|
|
|
|
|
|
|
|
*0*::
|
|
|
|
|
Success. In *--persistent* mode with a *--timeout* set, it is considered
|
|
|
|
|
successful if at least one exception was caught when the timer expires.
|
|
|
|
|
|
|
|
|
|
*1*::
|
|
|
|
|
Failure, with a message printed to the standard error stream.
|
|
|
|
|
|
|
|
|
|
== See Also
|
|
|
|
|
|
|
|
|
|
exception_port_tool(1),
|
|
|
|
|
on_demand_service_tool(1)
|
|
|
|
|
|
2015-03-18 17:10:12 -04:00
|
|
|
|
include::../../doc/man_footer.ad[]
|