在我的学校实验室中,我被要求使用arm-elf-gdb逐步调试程序(用汇编编写)。当我在_start设置断点然后运行程序并逐步执行它以显示寄存器的当前值。但是,当我尝试步进时,调试器不会显示寄存器的值。我使用“i r”来显示寄存器的最终值,但我需要逐步看到值的变化。知道为什么调试器没有显示值吗?
提前致谢。
汇编代码:
.text @ Executable code below
_start: .global _start @ "_start" is required by the linker
.global main @ "main" is the main program
b main @ Start the main program
main: @ Entry to function "main"
mov r0, #10
mov r1, #3
add r2, r1, r0 @ r2 = r1 + r0
sub r3, r0, r1 @ r3 = r1 - r0
mul r1, r0, r1 @ r1 = r0 * r1
swi 0x11 @ Software interrupt to terminate
.end
答案 0 :(得分:2)
您可以创建一个gdb宏来在每个步骤后显示寄存器:
(gdb) def z
Type commands for definition of "z".
End with a line saying just "end".
>si
>i r
>end
(gdb) z
r0 0x1 1
r1 0x69b6cae8 1773587176
r2 0x0 0
r3 0x69b6502c 1773555756
r4 0x620f14c0 1645155520
r5 0x68613870 1751201904
r6 0x0 0
r7 0x632aa214 1663738388
r8 0x699c5c50 1771854928
r9 0x632aa20c 1663738380
答案 1 :(得分:1)