• 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: Displaying contents of NSArray and family in debugger
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Displaying contents of NSArray and family in debugger


  • Subject: Re: Displaying contents of NSArray and family in debugger
  • From: Chris Espinosa <email@hidden>
  • Date: Sun, 27 Jun 2004 10:33:15 -0700

On Jun 27, 2004, at 10:11 AM, Paul Sargent wrote:

> Does anybody know a way to display the contents of an NSArray in the
> XCode debugger?
>
> I'm just starting out doing some of the Cocoa code (Obj-C), and I was
> trying to work out if doing addObject to a NSMutableArray resulted in
> a reference to the object, or a reference to a copy of the object
> being added to the array. To do this I wrote a little code which added
> the same object to an array multiple times, and I'd thought I'd look
> in the debugger to see what happened.
>
> Now, although the data view will give me a nice summary of how many
> items there are in my array, I can't seem to find the items themselves
> (and I can consistently crash GDB by opening up the ivars part of the
> class).
>
> I managed to get something working by doing a 'print (char *)
> [[testarray description] cString]' in the console, but that seemed a
> bit obscure.
>
> Am I missing something obvious?

I'd recommend reading Technical Note 2032, Getting Started with GDB
(http://developer.apple.com/technotes/tn/tn2032.html) which notes:

	 	Cocoa and CoreFoundation opaque objects don't print very well using
the print command, because they are objects, not just pointers to data.
For these objects, use the po command (short for print object) to print
the object's description, or for CoreFoundation objects, you can also
call CFShow().

Chris
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.


References: 
 >Displaying contents of NSArray and family in debugger (From: Paul Sargent <email@hidden>)

  • Prev by Date: Re: Displaying contents of NSArray and family in debugger
  • Next by Date: Resizing NSButton doesn't clear previous size
  • Previous by thread: Re: Displaying contents of NSArray and family in debugger
  • Next by thread: Resizing NSButton doesn't clear previous size
  • Index(es):
    • Date
    • Thread