从otool对ARMv7错误的方法实现的地址? [英] Wrong method implementation address from otool for armv7?
问题描述
我经常收到1字节由所示方法的实现地址otool。
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工作正常,我不明白,实施的一些方面。
如何跨preT输出?
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内核有两种类型的指令集。原来一个叫手臂
模式下,每个指令是四个字节长,更新的一个名为 thumb2
(你可以猜它已经通过某些迭代),其中指令可以是两个或四个字节长(引进的原因是code密度)。
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指令将PTED为手臂
模式间$ P $,如果是1,他们将PTED为间$ P $拇指
模式。
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对ARMv7错误的方法实现的地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!