我想要发送信息到目标C中的对象库.

(gdb) p $esi
$2 = (void *) 0x1268160
(gdb) po $esi
<NSArray: 0x1359c0>
(gdb) po [$esi count]
Target does not respond to this message selector.

我不能送任何消息。我失去了一些东西?我真的需要的符号,或其他什么东西?

有帮助吗?

解决方案

如果你必须复盖广和发送信息的对象时它不会让你,你可以使用performSelector:

(gdb) print (int)[receivedData count]
Target does not respond to this message selector.

(gdb) print (int)[receivedData performSelector:@selector(count) ]
2008-09-15 00:46:35.854 Executable[1008:20b] *** -[NSConcreteMutableData count]:
unrecognized selector sent to instance 0x105f2e0

如果你需要通过一个参数使用们

(gdb) print (int)[receivedData performSelector:@selector(count) withObject:myObject ]

其他提示

可能是你需要转换 $esi?

p (NSUInteger)[(NSArray *)$esi count]

@[约翰Calsbeek]

然后它抱怨关于失踪的符号。

(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.

我试图载的符号为基础:

(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.

但仍然没有运气:

(gdb) p [(NSArray *)$esi count]
No symbol "NSArray" in current context.

无论如何,我不认为浇铸是解决这个问题,你不应该必须知道什么样的对象它是能够发送消息。奇怪的是,我发现一个NSCFArray我没有问题发送信息:

(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

所以我猜有问题的对象,我进行调查...或者什么的。

谢谢你的帮助!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top