• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Debugging - Finding when a value changed
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Debugging - Finding when a value changed (From: David Newberry <email@hidden>)

  • Prev by Date: Re: Saving gdb user-defined commands
  • Next by Date: Re: Debugging - Finding when a value changed
  • Previous by thread: Debugging - Finding when a value changed
  • Next by thread: Re: Debugging - Finding when a value changed
  • Index(es):
    • Date
    • Thread