Summary of Common commands for GDB debugging in Linux, and Common commands for gdb
Prepared by: longshike
Email: longshike2010@163.com
2016-01-05
Gdb is the default debugging tool in Linux. When compiling a program file, such as debug. c. To use gdb for debugging, you must add cc-g or gcc-g before the terminal command to compile debug. c can be obtained using the following command:
gcc -g -o debug debug.c
Enter gdb to the debugging environment.
Help displays help information.
Run to start running the program.
Backtrace supports stack tracing. When backtrace n or bt n is a positive integer, information of the Top n layers of the stack is printed. When n is a negative integer, information of the bottom n layers of the stack is printed.
Print can check the value of the current variable
List can display the current program content.
The break n is the row number. You can set the breakpoint.
Info breakpoints displays all breakpoints.
Delet breakpoints n can delete breakpoints.
Disable/enable breakpoints n can be disabled or breakpoint Enabled
Step [count]: If no count is specified, the program continues to be executed until the source file is different from the current source file. If count is specified, the process is repeated for count.
Next [count]. If no count is specified, the next program is executed. If count is specified, the next program is executed.
Continue [ignore-count] wakes up the program and continues until the next breakpoint or program ends. If ignore-count is specified, the ignore-count breakpoint is ignored.