@[John Calsbeek]
Then it complains about missing symbols.
(gdb) p (NSUInteger)[(NSObject*)$esi retainCount]
No symbol table is loaded. Use the "file" command.
(gdb) p [(NSArray *)$esi count]
No symbol "NSArray" in current context.
I tried to load the symbols for Foundation:
(gdb) add-symbol-file /System/Library/Frameworks/Foundation.framework/Foundation
add symbol table from file "/System/Library/Frameworks/Foundation.framework/Foundation"? (y or n) y
Reading symbols from /System/Library/Frameworks/Foundation.framework/Foundation...done.
but still no luck:
(gdb) p [(NSArray *)$esi count]
No symbol "NSArray" in current context.
Anyway, I don't think casting is the solution to this problem, you shouldn't have to know what kind of object it is, to be able to send messages to it.
The weird thing is that I found an NSCFArray I have no problems sending messages to:
(gdb) p $eax
$11 = 367589056
(gdb) po $eax
<NSCFArray 0x15e8f6c0>(
file://localhost/Users/ask/Documents/composing-fractals.pdf
)
(gdb) p (int)[$eax retainCount]
$12 = 1
so I guess there was a problem with the object I was investigating... or something.
Thanks for your help!