Re: Debugging - Finding when a value changed
Re: Debugging - Finding when a value changed
- Subject: Re: Debugging - Finding when a value changed
- From: "Timothy J. Wood" <email@hidden>
- Date: Mon, 22 Jul 2002 08:52:47 -0700
On Monday, July 22, 2002, at 12:32 AM, David Newberry wrote:
I'm having trouble tracking down a bug. I have an object with an
instance variable, and that variable has the correct value when the
object is created. However, later on in the program, the value has
changed, and I cannot for the life of me figure out where it changes.
Is there any way to say to PB, "Watch this variable, and drop into the
debugger when it changes"? Any other suggestions are also welcome. :)
Yes -- in fact the command is called 'watch'. In the Apr 2002 Dev
Tools, it is even hardware accelerated (although it can still be pretty
slow since any write to the VM page containing the address has to be
examined to see if it overwrites your watch point).
Basically, you say 'watch foo' and gdb should stop when the value of
foo changes. I typically will get the address I'm interested in
checking:
(gdb) p &someStruct.member
....
(gdb) watch *0xaddress
-tim
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.