On Aug 21, 2012, at 1:20 PM, Jens Alfke wrote:
On Aug 21, 2012, at 5:16 AM, Alex Zavatone <
email@hidden> wrote:
It shows the variable types and memory addresses, but never the things that I actually care about, the values. The "summary" is always empty.
Summaries of object-valued ivars, you mean? The summary is only shown for some known Foundation classes like NSString and NSArray. (I think there may be a way to customize it?) If you want to see the state of an object-valued ivar, flip it open too. It's exactly the kind of recursive inspector you're asking for, I think.
That never works. That's my point.
Where I would expect a value to be displayed there is empty space and even in the tooltip, the summaries often do not display the values for all or 1/2 of the variables. Classes never get their values printed to the screen.
If it matters, I'm doing iOS dev.
It's stuff like this that make me go WTF, Apple, WTF? Back in 1996, we had features like this in Director and I even wrote my own recursive object inspector
Watch out, you're sounding like an Old Fart. (And I think I'm older than you, so I can say that ;-) Watch out or I'll start waving my walker and ranting about what we used to be able to do in the Smalltalk-80 debugger; and then the other Old Farts will get riled up about ALGOL and the Burroughs B5000 and we'll never get anything done again.
Well, my MPW scripts to remux video streams for the 3DO no longer work in Xcode! And that return to BASIC from 6502 assembly on my Apple ][ no longer works either. How I miss 3d0g.
By the way, I actually have the original Smalltalk manuals somewhere.
The point is that occasionally, people care about the values of their vars, whether they are in a class, an array, a dict, or whatever. If we're at V 4 of the app development app, I'd expect that this wouldn't even be an issue at this point.
Anyway. I would guess that one reason -description doesn't do this is because GDB's 'print' command already does it by default (if you dereference the pointer, that is.) -description is intended to be more of a compact single-line summary (except of course for collections where it makes sense for it to describe each member.)
Well, so far, the only option that I've seen to actually get the values of my in scope vars in a class is write a description method. Of course this bites if you ever add or remove variables from your classes. Hopefully, 4.4 will be better in this respect.
Testing ...
Actually no. 4.4 is just as bad.
(Person *) $1 = 0x0683c680 <Person: 0x683c680>
(lldb) po person
(Person *) $2 = 0x0683c680 <Person: 0x683c680>
(lldb) print person
(Person *) $3 = 0x0683c680
Compared to a simple description method:
po person
email: (null)
fullname: (null)
jobCode: (null)
accountCountry: (null)
jobFamily: (null)
phone: (null)
accountID: (null)
accountDuns: (null)
origin: HP2
accountChannel: (null)
employeeID: (null)
accountCity: (null)
longAccountID: (null)
teamRole: (null)
isOwner_sort: (null)
So, it looks like print isn't using introspection to do much, as previously claimed.
However in 4.4, expanding the variable in the debugger actually displays the class's values which is very nice. In 4.2, this never works. I just tested it in fact and all I ever get is this:
person Person * 0xd528500
NSObject NSObject {...}
isa Class 0x30d5c
That's pretty useless.
In the debugger and the tooltip, the summary for a class is always empty. When you expand it, all you get are NSObject and isa.
Will test in 4.4.1 later on, but if po or print can't display a class's variables without a description method, this is a step in the right direction, but you still need a description method if you are going to use po on a breakpoint action, the solution is by no means complete.
If I have time later, I'll see if this can be scripted, but this functionality simply should already be built in in a modern IDE that is at version 4.