Re: Memory watchpoints
Re: Memory watchpoints
- Subject: Re: Memory watchpoints
- From: Jim Ingham <email@hidden>
- Date: Thu, 12 Oct 2006 11:20:29 -0700
So first, you should be aware of the limitations of the watchpoint
support on Mac OS X. This is from the gdb release notes - i.e.
file:///Developer/ADC Reference Library/releasenotes/DeveloperTools/GDB.html
Hardware (page protection) watchpoint support
Hardware watchpoints are now supported, with a few limitations. They
are implemented using the page-protection mechanism of Mach, not
using the hardware watchpoint register. To insert a watchpoint, gdb
write-protects the entire page containing the memory address, then
traps for write faults to that page. Unfortunately, the Mach kernel
does not generate a write fault when a system call tries to write to
a protected page --- instead it returns error status to the calling
application. So, for example, if you try to read() from a file into
memory on any page that contains a watchpoint, read() will return
with EADDR, rather than triggering the watchpoint. Also, watchpoints
on stack addresses (local variables being the most likely example)
can sometimes cause unexpected results.
If this doesn't explain what you are seeing, then you are probably
running into some bug we don't know about yet. In that case, if you
can get us a reproducible test case, please file a bug and we will
take a look at it.
Jim
On Oct 12, 2006, at 11:04 AM, Mark Wagner wrote:
On 10/11/06, Chris Espinosa <email@hidden> wrote:
To save you having to ask the next 15 logical
questions, http://developer.apple.com/documentation/DeveloperTools/gdb/gdb/gdb_6.html
Thanks. I guess that means I should follow up with a non-obvious
question: Why is the watchpoint I set causing my program to crash?
I'm debugging file output. Without the watchpoint, the program
succeeds in outputting the file, but produces bad data. With the
watchpoint set, output fails, and shortly afterwards crashes with an
EXEC_BAD_INSTRUCTION error.
--
Mark Wagner
_______________________________________________
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
_______________________________________________
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