General steps used by the GDB debugger (constantly updated and perfected):
1, the compilation process to use the-G parameter to add debug symbols--GCC test.c-g;
2, gdb start executable file--gdb a.out;
3, the appearance of the GDB symbol indicates a successful start;
4, "L" (small L) command can see whether the current code is to execute the code;
5. Breakpoints
b line number/function name-function is the program execution will automatically pause at the breakpoint, waiting for instructions
Info b--View Breakpoint List
D Number--delete the breakpoint with the specified number
6. Execution procedure
R Enter--the program starts, executes to the first breakpoint at the code where it pauses
7. Single Step execution
N executes a statement, and if the next statement is a function, the skip function continues execution;
s executes a statement that, if the next statement is a function, enters into the function to step inside;
8. View variable values
P Variable name--view the value in the current variable
Change the current variable value set var variable name = new value
9. Exit the current debugging environment
Command "Q"
Linux Base 2--gdb Debugger