Using the gcc-g test.c-o test.out compiler, only the plus-G parameter supports GDB debugging;
Then gdb./test.out runs the executable file, enters gdb debug mode (GDB), and enters the command after the parentheses;
(GDB) Help: View command assistance
(GDB) Start: single-line execution
(GDB) L: View source program
(GDB) N: Executes the next line
(GDB) S: Inside the modulated function
(GDB) bt: view function Call stack
(GDB) p variable: Print variable Value
(GDB) F: Toggle function Stack Frame
(GDB) Run: Start the file again
(GDB) Finish: Ends the current function and returns to the function call point
(GDB) Q: Exit GDB
(GDB) Enter: Executes the previous command
To debug a core file:
Find out what's happening in the core first unknown: Find $HOME-name Core
Then go to the directory where the core occurs, and you can use File + directory assist to locate which executable is the report core
Then execute the GDB + executable file
(GDB) Where: you can see which line is wrong
GD debug command, gdb Debug Core file