I am debugging a simple program using gdb, And I am getting unexpected behavior when I am running the instruction pop {r11,pc} The stack before the execution of the instruction is:
I expect the value of the pc after the execution of the instruction to be 0x42424243 but for some reason it is 0x42424242
Anyone has any suggestion about why this may happen?
The program is execute on a RPi
I tried multiple values and couldn't find any consistency in the last byte of the pc register
For all of the thumb capable cores cortex-m or full sized. The lsbit of a branch destination address or other documented mixed mode capable instructions (add pc,r0,r1), is used to indicate which mode to switch to or stay in. The lsbit is consumed by the instruction and placed in the T bit in the psr it does not go into the pc itself.
The instruction set would clearly be documented as such if this were valid, but simple experiments will show it is not the case. As you have demonstrated.