Debugging Firmware with GDB
Here are some of the most useful GDB commands that you can use for debugging your application:
The first command you should be aware of is the help command. For example, let’s run help for the “breakpoint” command:
The Breakpoint command is used to set a breakpoint at a location telling the debugger to halt the application when the program reaches that line of code. Here’s what the output of backtrace looks like when adding the “full” option to show all the local variables as well:
If you want to make it look “pretty” with some basic formatting, you could use the following command:
Here’s a screenshot showing the difference between the output with “pretty” being on or off:
The Step command is used to step through and execute your source code during debugging.
Source: interrupt.memfault.com