Re: Suppressing Crash Reporter dialogs for a task
Re: Suppressing Crash Reporter dialogs for a task
- Subject: Re: Suppressing Crash Reporter dialogs for a task
- From: Mark Woods <email@hidden>
- Date: Wed, 23 Sep 2009 09:51:53 +0100
Thanks Ken. The link you gave me was very helpful and the crash dialog
no longer appears using the code provided. I've verified that it works
on 10.5 and 10.6.
Thanks to everyone who posted.
Mark.
On Sep 23, 2009, at 5:57 AM, Ken Thomases wrote:
On Sep 22, 2009, at 2:27 PM, Alastair Houghton wrote:
If you was *your* process that crashed, on "normal" UNIX-like
systems you can use signal handlers to catch the crash and do
something about it. Likewise, on a normal UNIX-like platform you'd
get a SIGCHLD from the system and you could check the process exit
status. Or you could act as a debugger using the ptrace() API.
On OS X though, you can't (or couldn't, last I checked which was
some time ago) intercept the system crash reporter using signal-
related APIs because it's triggered by the lower-level Mach
exception port. Even if you somehow handle the signal (in the
parent or the child process), the crash reporter is still triggered
via the Mach exception port.
On Tiger and earlier, the CrashReporter would generate a crash
report for a Mach exception even if it was later delivered as a
signal and handled by the process. Since Leopard, though, a crash
report is only generated if the signal is not handled. So, handling
signals is sufficient to suppress crash reports these days.
That said, it's actually pretty simple to disconnect the
CrashReporter from your process using Mach routines. I had to do
this for Wine on Tiger because Wine routinely provokes exceptions
(and uses signal handlers to deal with the consequences) and the
CrashReporter was suspending the process while it generated its
report, slowing it _way_ down.
kern_return_t kret = task_set_exception_ports(
mach_task_self(),
EXC_MASK_BAD_ACCESS | EXC_MASK_BAD_INSTRUCTION |
EXC_MASK_ARITHMETIC,
MACH_PORT_NULL,
EXCEPTION_STATE_IDENTITY,
MACHINE_THREAD_STATE);
I went into it in more depth here: http://lists.apple.com/archives/unix-porting/2007/Mar/msg00009.html
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden