Re: IsBadCodePtr in Cocoa or Unix?
Re: IsBadCodePtr in Cocoa or Unix?
- Subject: Re: IsBadCodePtr in Cocoa or Unix?
- From: Douglas Davidson <email@hidden>
- Date: Thu, 16 Apr 2009 11:36:32 -0700
On Apr 16, 2009, at 11:21 AM, Colin Cornaby wrote:
I would suggest reading Microsoft's own notes on that function,
which might tell you why it's a bad idea to use that function even
under Windows, and give you a clue on how to do something similar on
other platforms. You should probably look at catching a SIGSEGV,
which should be possible, and is still a ridiculously bad idea (if
the Microsoft warnings weren't enough).
As everyone has noted, there are good reasons why ordinary code should
not start examining pointers handed to it for validity. However,
there are occasionally debugging situations in which there are
legitimate reasons to want to know whether a particular range of
memory is mapped, and how. Typically one would use gdb and other
tools to examine the address space, but if for some reason you need to
do so programmatically, it is possible to find out all sorts of
information about the address space of a process via various Mach
APIs. This is pretty deep stuff, so I won't even start to explain it
in a mail message; if you want to do it, you had better understand it
thoroughly.
Douglas Davidson
_______________________________________________
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