Re: Xcode memory breakpoint - How?
Re: Xcode memory breakpoint - How?
- Subject: Re: Xcode memory breakpoint - How?
- From: Jonas Maebe <email@hidden>
- Date: Thu, 5 Jul 2007 10:37:52 +0200
On 04 Jul 2007, at 23:53, Yves Poissant wrote:
The simple version is: get the address of the value you want to
watch, and then set up a watch point on *(int*)<address> (or
whatever the size/type is of the entity you want to watch).
I did not think of that syntax. Makes sense. I tried "watch
<addr>". That seemed to work except after waiting for like 2 hours,
I decided on another strategy. Watching the variable in the memory
window and going through step by step on a coarse level first and
then entering each function that cause the change until I found the
troublemaker. Took like 30 min.
Maybe it is useless because without hardware watchpoint, the wait
is uselessly long.
There is hardware watchpoint support, but there are some caveats
because it is implemented by marking the page containing the watched
value as read-only, rather than just watching a single address. This
means that
* if a lot of other often-changed values lie on the same page, you
get a huge slowdown because of all the extra exceptions which gdb has
to process (check top -ud; if gdb is consuming a lot of cpu time,
you're likely to be in this case)
* if you attempt to change a value on this page in an atomic way,
then you'll get an endless loop, because the exception clears the
load/store reservation
Note that the above is for ppc (especially the second case). I don't
know how things are implemented on i386. It's quite sad, because the
PPC also has hardware support for watching individual addresses.
They're just not exposed to user space by the kernel, so gdb can't
use them (and given the move to x86, I guess they never will be...)
Jonas
_______________________________________________
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