GDB is a major debugging tool in Linux programming on a non-graphical interface. Therefore, it is very important to master the gdb debugging technology. Below are some of the main debugging options for GDB:
1. The compilation contains debugging information: gcc-g-o test. c
2. Run GDB: GDB
3. Load the executable file: file test
4. Display Source code : List, abbreviated as l
5. Add a breakpoint: Break <line number>, abbreviated as B
6. view the breakpoint information: info B
7. Run Code : Run, abbreviated as R, stops running to the breakpoint
8. view the variable value: Print X, abbreviated as P
9. Set the observation point: Watch X. When the X value changes, the values before and after the changes are displayed.
10. One-step execution without entering the function: Next, abbreviated as N
One-step execution to enter the function: Step, abbreviated as s
11. Program Continue execution: Continue, abbreviated as C
12. temporarily block breakpoints: Disable <breakpoint number>
Enable breakpoint: Enable <breakpoint number>
Delete breakpoint: Clear <row number>
Delete <breakpoint number>, abbreviated as d
13. Exit GDB: Quit or Ctrl + D, abbreviated as Q