- Show Version: Displays GDB version information
- Info functions: List all the function names of the executable file
- Step (abbreviation s): Enter function (function must have debug information)
- Next (abbreviation N): Do not enter the function, GDB will wait for the function to finish, and then display the next line to execute the program code
- Finish: When stepping through a function, if you do not want to continue tracking, using finish, the function will continue to execute, and print the return value
- Return or return expression: command to specify the return value of a function
- Call or print: as called Func (), the command calls the function execution directly
- I frame: displaying information for function stack frames
- B *address: Break point on the program address
- B linenum: Break point in a line in the current file
- Save Breakpoints FileName: Saving breakpoints in bulk
- SOURCE FileName: Set breakpoints that were previously saved
- Tbreak (abbreviated TB): Breakpoint only takes effect once
- I B: View breakpoints
- Break ... if cond: If i==10, the breakpoint will be triggered only if the condition is met
- Ifnore bnum Count: Next count number Bnum breakpoint trigger will not cause the program to break, only the first count+1 breakpoint trigger will cause the program to break
- Watch: The command sets the observer point, which means that when a variable value changes, the program stops
- Set: Change the value of a string
- Set var variable=expr: command Sets the value of the variable, such as set Var i=8;
- Jump: When debugging a program, you may accidentally go through the wrong place and jump back
Some common debugging commands in GDB