I’m using gdb 6.3.50, the one that comes with Xcode 4.4.1. It seems to get confused by my attempts to call class on an object in the debugger.
(gdb) po [JSONObject class]
A syntax error in expression, near `]'.
I assume it’s getting tripped up by the word “class”, which must be some kind of reserved symbol, perhaps because I’m working in Objective-C++. Certainly, I can prod it into an error with identical wording if I try to use some other C keyword:
(gdb) po [JSONObject struct]
A syntax error in expression, near `]'.
There’s nothing wrong with the object itself, it seems, because gdb can call other methods on it:
(gdb) po [JSONObject objectForKey:@"UTIMESTAMP"]
<__NSCFArray 0x89c9b0>( ...(etc.>)
Is there some construct, or symbol, or something, that I can put in the command line, to force gdb to treat “class” as just a selector?
Try using the Objective-C messenger functions directly: