Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 GDB 调试 ARMv7 二进制文件时,除了查看指令长度之外,有没有办法确定 CPU 当前处于哪种模式?(手臂,拇指)
我正在使用这个小 gdb 脚本来确定 CPSR 字段的当前状态,只需将其放入 ~/.gdbinit 文件中,并在需要时调用 arm_isa。
define arm_isa if ($cpsr & 0x20) printf "Using THUMB(2) ISA\n" else printf "Using ARM ISA\n" end end
它检查 cpsr 中的第 5 位,该位指示当前状态并输出使用的 ISA。