Orchard gdb cheatsheet

From Studio Kousagi Wiki
Revision as of 09:52, 27 May 2015 by Bunnie (talk | contribs) (Created page with "If you're not familiar with gdb, here are some commands to get you started. ==Starting GDB== To start GDB with Orchard, use these commands: pi@raspberrypi ~/orchard-src/orc...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

If you're not familiar with gdb, here are some commands to get you started.

Starting GDB

To start GDB with Orchard, use these commands:

pi@raspberrypi ~/orchard-src/orchard $ gdb build/orchard.elf

Note that you're starting it in the same directory where you'd type make to build the executable.

Once GDB is started, you want to first execute

target remote localhost:3333

This establishes a connection between gdb and the orchard CPU.

Debugging with GDB

  • To stop execution, hit ctrl-c. This will break you to a prompt.
  • 'c' will continue execution
  • 'mon reset' will reset the board
  • 'b <function name>' will set a breakpoint at a given symbolic function name
  • 'step' will step one source line
  • 'info reg' will give you the register dump
  • 'info threads' will give you the status of all threads running on chibiOS
  • 'bt' will give you the current backtrace
  • 'l' will list the current source line that's running
  • 'disas' will show you the assembly code of the current code that's running
  • 'print <expression>' will print the value of a variable in the current stack frame