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: Cyrus Harmon <email@hidden>
- Date: Tue, 27 Jun 2006 16:53:55 -0700
And who said anything about not owning the memory? It's memory that
has been properly malloc'ed and mprotect'ed.
Cyrus
On Jun 24, 2006, at 9: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.
What situation are you thinking of?
- Ladd
_______________________________________________
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