Difference between revisions of "Orchard gdb cheatsheet"

From Studio Kousagi Wiki
Jump to: navigation, search
(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...")
 
(Debugging with GDB)
Line 20: Line 20:
 
* 'mon reset' will reset the board
 
* 'mon reset' will reset the board
 
* 'b <function name>' will set a breakpoint at a given symbolic function name
 
* 'b <function name>' will set a breakpoint at a given symbolic function name
* 'step' will step one source line
+
* 'step' will step one source line, diving into functions
 +
* 'next' will step one source line, treating functions as a single source line
 
* 'info reg' will give you the register dump
 
* 'info reg' will give you the register dump
 
* 'info threads' will give you the status of all threads running on chibiOS
 
* 'info threads' will give you the status of all threads running on chibiOS

Revision as of 09:29, 28 May 2015

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, diving into functions
  • 'next' will step one source line, treating functions as a single 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