Re: How to disable crash reporter temporarily
Re: How to disable crash reporter temporarily
- Subject: Re: How to disable crash reporter temporarily
- From: Ken Thomases <email@hidden>
- Date: Sun, 10 Mar 2013 11:12:30 -0500
On Mar 9, 2013, at 10:21 PM, David Mirabito wrote:
> I'm working on a application which links against some cocoa libs, so is a
> cocoa app although not wrapped in a bundle. (The lib takes care of all the
> cocoa-ishness internally so my app ends up being more or less cross
> platform).
>
> Whenever I get a crash the Apple Crash reporter pops up and claims some
> stuff is sent off to Apple.
>
> Now I don't really mind this - it's just annoying to have to click over to
> make it go away, so not like I am very concerned about sensitive info or
> anything. I never read the diag anyway, if the crash is non-obvious I just
> re-run it in gdb/lldb to see what's what. If apple want to get dozens of
> crash repports for 'davestestapp' then good for them.
>
> I've looked into ways to disable this, and so far I've found two ways:
> - "defaults write com.apple.CrashReporter DialogType none" Doesnt stop the
> dump from being written (or sent???) but at least stops the annoying diag.
> This appears to be permanant until I set it back to 'crashreport'
> - using launchctl to unload the reporter daemon all together. Setting
> survives until next login and requires a 'sudo' step.
>
> Now these can be made workable, but was wondering if there's a better way
> that isn't system wide or sticky beyond a development session - I can see
> myself forgetting to re-enable it. So is there an environment var or
> something else I can do on app launch to disable crash reporting for that
> instance? Do debuggers/XCode do anything special?
> Alternatively, is there something I can do in code - may I get around this
> by catching the signal and crashing in some other way, so as not to poke
> the reporter daemon, etc?
If you catch the signal using a signal handler, that will suppress the crash reporter.
Otherwise, you can reset the task exception ports:
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);
if (kret != KERN_SUCCESS)
fprintf(stderr, "Could not disable CrashReporter. Mach error code %d\n", (int)kret);
For more detail see: 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