Wrong method implementation address from otool for armv7?(otool for armv7 的方法实现地址错误?)
问题描述
'otool' 显示的方法的实现地址不断得到 1 个字节的偏移量.
I'm constantly getting 1 byte offset for implementation address of method shown by 'otool'.
例如,'otool -o' 给出 0xe99d5,但 'otool -tvV' 给出:
For an example 'otool -o' gives 0xe99d5 but 'otool -tvV' gives:
+[NSError(SomeCategory) someMethod]:
000e99d4 b590 push {r4, r7, lr}
000e99d6 f6441184 movw r1, 0x4984
000e99da af01 add r7, sp, #4
000e99dc f2c0010a movt r1, 0xa
所以方法从 0xe99d4 开始.0xe99d5 看起来不对,未对齐.我相信otool"工作正常,我不了解实施的某些方面.如何解释输出?
So method starts at 0xe99d4. 0xe99d5 looks wrong, not aligned. I believe that 'otool' works fine and I don't understand some aspects of implementation. How to interpret the output ?
推荐答案
现代 ARM 内核有两种类型的指令集.原始的一种称为 arm 模式,其中每条指令长四个字节,而较新的一种称为 thumb2 (您可以猜到它已经通过了一些迭代),其中指令可以是两条或者四个字节长(引入的原因是代码密度).
Modern ARM cores has two types of instruction sets. Original one is called arm mode where each instruction is four bytes long and newer one is called thumb2 (as you can guess it has already passed some iterations) where instructions can be two or four bytes long (the reason for the introduction is code density).
CPU 在进行分支时可以改变模式,通知 CPU 使用的指令集的方法是设置要跳转的指令地址中的最低有效位.如果为0指令将被解释为arm模式,如果为1则被解释为thumb模式.
CPU can change modes when it is making a branch and the way to notify CPU about instruction set used is by setting the least significant bit in address of the instruction to be jumped. If it is 0 instruction will be interpreted as arm mode, if it is 1 they will be interpreted as thumb mode.
所以您看到的是您的函数处于 thumb2 模式,我们可以通过看到它包含两个和四个字节长的指令来验证它.
So what you are seeing is your function is in thumb2 mode which we can verify by seeing it consist of two and four byte long instructions.
这篇关于otool for armv7 的方法实现地址错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:otool for armv7 的方法实现地址错误?
基础教程推荐
- Xcode UIView.init(frame:) 只能在主线程中使用 2022-01-01
- 如何将图像从一项活动发送到另一项活动? 2022-01-01
- iOS - UINavigationController 添加多个正确的项目? 2022-01-01
- 如何比较两个 NSDate:哪个是最近的? 2022-01-01
- Android Volley - 如何动画图像加载? 2022-01-01
- UIImage 在开始时不适合 UIScrollView 2022-01-01
- SwiftUI-ScrollViewReader的ScrollTo不滚动 2022-01-01
- Play 商店的设备兼容性问题 2022-01-01
- 为什么姜饼模拟器方向卡在应用程序中? 2022-01-01
- navigationItem.backBarButtonItem 不工作?为什么上一个菜单仍然显示为按钮? 2022-01-01
