Compile gcc-g-O2-o test with simple commands for gdb debugging. c. debug gdb filename gdb file filename. view the program list (l). Add the breakpoint break (B) to the function entry. The function name adds the breakpoint break (B) to the specified row) the row number adds the breakpoint break (B) file name to the specified row of the specified file: When the row number is true on a daily basis, the condition that the line number takes effect when the breakpoint occurs, for example: B 5 if I = 10 view all set breakpoint info break delete breakpoint number start run program run (r) one-step run program (do not enter the sub-function) next (n) run the program in one step (enter the sub-function) step (s) continue to run the program continue (c) to view the specified variable value print (p) to run the program, wait until the current function is finished. finish monitoring the specified variable. watch the variable name and exit gdb quit (q)