I. GDB program debugging: A program debugging tool
1. functions:
A) start the program to be debugged
B) stop the program to be debugged at the specified position.
C) when the program is stopped, you can check the program status.
2. Use:
A) Compile the program gcc with the debugable tool-g
B) Start gdb: gdb program name
1. Method 2: Start gdb first, and then run the file name
C) Check the program: list (l): 10 rows and 10 rows
D) set a breakpoint at main: B main
1. break (B) Function Name:
2. B row number:
3. B file name: row number
4. B row number if condition
5. View All Breakpoints: info break
6. delete a breakpoint: The delete breakpoint number.
E) run gdb: run (r ):
F) One-step operation: next: Do not enter the subfunction
1. View variable value: print variable name
G) One-step operation: step: Enter the sub-function
H) continue running: continue (c)
I) fully run: run the function finish until the current function ends.
J) monitoring variable: watch variable name
K) Exit: quit (q)