In its default (ie, my) configuration, Xcode is somewhat unhelpful in its debugger window for variables, especially those of the common Objective-C collections variety.
The debugger seems to usually want to display the underlying Obj-C structure when I expand some object, so I'm looking at isa
s and the class hierarchy.
But what I almost always want here is something semantically meaningful for the object itself. E.g. for an NSDictionary
, I'd ideally want to see a list of keys/values. If those keys and values are, for example NSString
s, I just want to see the string values, not complex nested objects. Same goes for NSSet
s, NSArrays
, and the bytes inside an NSData
. And NSString
s, while usually getting their string representation in the Summary column, are impossible to look at when they're long (e.g. a pathname that's too long to fit in the column doesn't seem to scroll)-- when I double-click it, I get the display template string instead, so I can't select/copy it either.
I have recently spent time in Eclipse debugging Java, and for all its faults, Eclipse knows about all the Java collections, and has a simple one-line dump out of the contents of a string or collection or whatever when you find it in the debugger.
Is there a way to get this in Xcode? Am I missing something obvious, or should I be diving into the display templating system? I know there's some support there, as NSArrays seem to get a special kind of listy format, NSDictionaries get a "2 key/value pairs" summary, etc.
EDIT: It's possible to drop into GDB to get more data on objects. I'm disheartened that GDB's po
acting on an NSDictionary
gives the sort of awesomely useful output that I expect from a GUI debugger. Can this be replicated without context switching to the console?
I enjoy the Xcode environment so much, but the near-complete opaqueness of objects that I use all the time really stymies debugging time. Thanks.