Re: can I catch an EXC_BAD_ACCESS?
Re: can I catch an EXC_BAD_ACCESS?
- Subject: Re: can I catch an EXC_BAD_ACCESS?
- From: Philip Ershler <email@hidden>
- Date: Sat, 24 Jun 2006 22:42:03 -0600
On Jun 24, 2006, at 10:17 PM, Ladd Van Tol wrote:
On Jun 24, 2006, at 4:13 PM, Cyrus Harmon wrote:
Or, the EXC_BAD_ACCESS/SIGBUS might signal a memory protection
violation, which might very well be the intended behavior of the
program in question. One can write a mach exception handler to
handle the EXC_BAD_ACCESS or, a bit more easily, a POSIX-style
(often referred to as a BSD-style) signal handler to handle the
SIGBUS. But then you'll run into problems trying to debug this
because gdb doesn't properly step over them, or ignore them if
trying to do handle pass noprint. It would be nice if Apple would
unbreak gdb such that one could debug programs that rely on
functioning memory protection as part of their strategy for
handling memory management.
It would seem to me that writing code that relies on being able to
catch memory protection violations is incorrect. It's not portable,
and handling the exception is almost certainly not going to be
fast. Further, writing code that stomps on or reads memory that it
doesn't own is generally considered to be bad programming practice.
I totally agree. Memory protection is intended to keep poorly written
and/or debugged programs from crashing other programs (including
numerous system processes). It was never intended to protect a
program from itself.
Phil
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden