Embedded Software Interview – Peripheral Section: The Process of Local and Remote Debugging with GDB

To support gdb debugging, you must add the -g parameter during compilation to enable debugging information.

1. Commands related to setting breakpoints:

  • break to set a breakpoint: break + the line number where the breakpoint is to be set.
  • clear to clear a breakpoint: clear + the line number of the breakpoint to be cleared.
  • delete command used to clear breakpoints and automatically displayed expressions.
  • disable temporarily disables the set breakpoints. If you want to disable multiple breakpoints, separate the numbers with spaces.
  • enable is the opposite of disable.

2. Starting method: gdb app

  • Input run to execute.
  • where to check where the problem might be.
  • list to view nearby code.
  • break + number to set a breakpoint at line number.
  • Input next to step through the code.
  • print to view the value of a variable.

3. Remote debugging with gdbserver

  • Run gdbserver: port app on the target board.
  • Then start arm-linux-gdb app on the host.
  • After starting on the host, connect to the target board via remote (gdb) target remote IP:port.
  • Then it will be similar to local gdb debugging.
  • To end debugging, input q.

Leave a Comment