-
Notifications
You must be signed in to change notification settings - Fork 1
GDB introduction & documentation
GDB is a debugger, a program that specializes in showing what your code “does” while executing and allows you to inspect it when it crashes, which is perfect for finding and fixing bugs. GDB is the go-to Linux debugger, it is included when you install the “build-essential” package.
You can launch the debugger from the terminal by typing:
gdb <path to executable file>
A list of useful commands are:
• Run. r Run the program to completion, GDB will notify if a crash occurs, as well as the error and the line where it happened.
• Step. s It executes one line of code, if the line is a function call, it will step into the function.
• Next. n It executes one line of code, if the line is a function call, it will run it without stepping into it.
• Breakpoint. b It sets a breakpoint at a line of your choice, can be a number, function call, etc. when running the program, the debugger will stop at the breakpoints.
• Continue. c Continues running the program.
• Enable. Enables a Breakpoint.
• Disable. Disables a Breakpoint.
• Backtrace. Used when an error occurs, it returns the methods called and their parameters.
• List. l Display the 10 lines of code around the current line.
• Print. p Used to display current variable values.
• At any point you can type quit q to exit the debugger.
Documentation: https://www.gnu.org/software/gdb/documentation/
- System
- Boards
- CAN
- STM
- HAL
- RTOS
- CMock
- GDB