我想发送消息到gdb中的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.
我无法发送任何消息给它。我错过了什么吗?我真的需要符号,还是其他什么?
我想发送消息到gdb中的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.
我无法发送任何消息给它。我错过了什么吗?我真的需要符号,还是其他什么?
如果您必须覆盖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
如果你需要传递一个参数,使用withObject:
(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
,所以我想有一个与我研究的对象......什么的问题。
感谢您的帮助!
注意:[reversing]标签不能用于描述逆向工程主题;改用[反向工程] – user1354557 2016-06-22 15:59:02