使用Hopper无法看到block内部的逻辑


#1

问题:

  • 1.如何看到Block中的逻辑?
  • 2.听说和看sub_route逻辑相同,但是我获取到了地址,但是在hoper中找到了内存地址,获取的汇编代码和逻辑无关

各位前辈,我现在在处理一个block,我看到论坛的一些关于block的文章,并且也获取到了他的参数和返回值(都是void)。所以要请教各位一下.

ViewA中有一个ViewB按钮(已经封装了,有一个block的参数,点击使用,在ViewA中设置的),点击ViewB,执行block.


步骤:

(lldb) po $x2
<__NSStackBlock__: 0x16fd8e330>

(lldb) image list -o -f
[  0] 0x0000000000070000 /Users/wangxin/Library/Developer/Xcode/DeriveXX

(lldb) memory read --size 8 --format x 0x16fd8e330
0x16fd8e330: 0x00000001a9399298 0x00000000c2000000
0x16fd8e340: 0x000000010009198c 0x000000010184c400
0x16fd8e350: 0x000000017106b500 0x000000017106b500
0x16fd8e360: 0x00000001702b5000 0x00000001924dbf8a
(lldb) 
  • 3.通过公式计算出block的实际位置并且通过计算,获取block的返回值和参数都是void
block的基址地址:0x000000010009198c - 0x0000000000070000 = 0x0010002198C

麻烦各位大神不吝赐教,谢谢


#2

这是个什么进程?你把完整的控制台输出发上来看看


#4
(lldb) image list -o -f
[  0] 0x00000000000e8000 /Users/wangxin/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos/DiSpecialDriver.app/DiSpecialDriver
[  1] 0x0000000102010000 /Users/wangxin/Library/Developer/Xcode/iOS DeviceSupport/10.1.1 (14B100)/Symbols/usr/lib/dyld
[  2] 0x0000000002c70000 /Users/wangxin/Library/Developer/Xcode/iOS DeviceSupport/10.1.1 (14B100)/Symbols/usr/lib/libc++.1.dylib
[  3] 0x0000000002c70000 /Users/wangxin/Library/Developer/Xcode/iOS DeviceSupport/10.1.1 (14B100)/Symbols/usr/lib/libresolv.9.dylib
[  4] 0x0000000002c70000 /Users/wangxin/Library/Developer/Xcode/iOS DeviceSupport/10.1.1 (14B100)/Symbols/usr/lib/libsqlite3.dylib
[  5] 0x0000000002c70000 /Users/wangxin/Library/Developer/Xcode/iOS DeviceSupport/10.1.1 (14B100)/Symbols/usr/lib/libstdc++.6.dylib
[  6] 0x0000000002c70000 /Users/wangxin/Library/Developer/Xcode/iOS DeviceSupport/10.1.1 (14B100)/Symbols/usr/lib/libz.1.dylib
[  7] 0x0000000002c70000 /Users/wangxin/Library/Developer/Xcode/iOS DeviceSupport/10.1.1 (14B100)/Symbols/System/Library/Frameworks/AVFoundation.framework/AVFoundation
[  8] 0x0000000002c70000 /Users/wangxin/Library/Developer/Xcode/iOS DeviceSupport/10.1.1 (14B100)/Symbols/System/Library/Frameworks/Accelerate.framework/Accelerate
[  9] 0x0000000002c70000 /Users/wangxin/Library/Developer/Xcode/iOS DeviceSupport/10.1.1 (14B100)/Symbols/System/Library/Frameworks/AdSupport.framework/AdSupport
.....

大大,我刚才看了一下,好像是控制器C给viewA设置了block,然后viewA将这个block传递了ViewB,好像我找的还还差一点,我再去看看,这个帖子您先不用管我,我一会有问题, 再来请教你。


#5

已经发现自己的错误,并且已经阅读到了block汇编代码,非常感谢大大,给你添麻烦了~~


#6

你好,我也遇到了类似问题,请问是什么原因啊?


#7

计算的不对,你按照大大的帖子来,一步一步的,千万不要按照惯性来。就不会出错了