Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
dt_openocd [2014/02/12 21:30] yusa |
dt_openocd [2014/02/16 22:25] yusa |
||
---|---|---|---|
Line 153: | Line 153: | ||
reg [NAME] [VALUE] | reg [NAME] [VALUE] | ||
</code> | </code> | ||
+ | |||
=== Debugging with gdb === | === Debugging with gdb === | ||
- | Follows soon... | + | If you want to debug your hardware more comfortable you are able to use gdb. |
+ | You should use the gdb provided by your Toolchain. For example mipsel-none-elf-gdb for a MIPS architecture. | ||
+ | |||
+ | <code> | ||
+ | mipsel-none-elf-gdb main.elf | ||
+ | </code> | ||
+ | |||
+ | |||
+ | Connect to the gdbserver on the local pc using port 3333. | ||
+ | |||
+ | <code> | ||
+ | (gdb) target remote localhost:3333 | ||
+ | </code> | ||
+ | |||
+ | Send commands to gdbserver using the monitor command | ||
+ | |||
+ | <code> | ||
+ | (gdb) monitor reset halt | ||
+ | </code> | ||
+ | |||
+ | Now the hardware performs a reset and halts directly. You can use gdb as normal: | ||
+ | |||
+ | You can list the source code: | ||
+ | |||
+ | <code> | ||
+ | (gdb) list | ||
+ | </code> | ||
+ | |||
+ | Set breakpoints (e.g. at line 27) | ||
+ | |||
+ | <code> | ||
+ | (gdb) br 27 | ||
+ | </code> | ||
+ | |||
+ | Run the program until the next breakpoint occurs. | ||
+ | |||
+ | <code> | ||
+ | (gdb) continue | ||
+ | </code> | ||
+ | |||
+ | Walk step by step through your source code | ||
+ | |||
+ | <code> | ||
+ | (gdb) next | ||
+ | </code> | ||
+ | |||
+ | or print variable content | ||
+ | |||
+ | <code> | ||
+ | (gdb) print [var] | ||
+ | </code> | ||