在gdb中调试Objective-C时向对象发送消息,不带符号

ask*_*sol 11 debugging macos gdb reversing objective-c

我正在尝试向gdb中的Objective-C对象发送消息.

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

我无法发送任何消息.我错过了什么吗?我真的需要符号或其他东西吗?

Ken*_*ner 10

如果必须覆盖gdb并在不允许的情况下向对象发送消息,则可以使用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
Run Code Online (Sandbox Code Playgroud)

如果需要传递参数,请使用withObject:

(gdb) print (int)[receivedData performSelector:@selector(count) withObject:myObject ]
Run Code Online (Sandbox Code Playgroud)