Reputation: 427
In my school lab I've been asked to debug a program (written in assembly) step by step using arm-elf-gdb. When I set a break point at _start and then run the program and step through it to display the registers' current values. However, when I try to step, the debugger doesn't show the values of the registers. I used "i r" to display the final values of the registers but I need to see the values changing step by step. Any idea why the debugger isn't displaying the values?
Thanks in advance.
The assembly code:
.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
Upvotes: 2
Views: 703
Reputation: 9466
You could use gdb's display command. But you do need to add all registers manually.
display $r0
display $r1
...
You can save some typing by using gdb startup script (-x parameter).
Upvotes: 1
Reputation: 29547
You could create a gdb macro to show the registers after every step:
(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
Upvotes: 2