1. Create CPP file: Vim sourcefile.cpp
2. Generate executable file: g++-G sourcefile.cpp-o exename
------is said to be required to add the-g parameter, otherwise it cannot be debugged
3. Start Debugging: Enter GDB (Fuck it) into the GDB environment
4. Enter file EXEName (tell gdb to debug)
5. Enter the L (list) to view the code, enter repeat the previous command
6. Breakpoint Settings: B Main Adds a breakpoint to the main function entry
-------Break 5: Set a breakpoint on line 5th; I B (info break) View breakpoint information
7. Enter R (run) to start running code at the breakpoint
8. Enter the S (step) Single Step entry function
9. You can enter N: one-step debugging; Enter print var (abbreviation: P var) to see the value of the variable bar
------View Stack BT, down and up can be one print stack information. BT prints all stack information directly.
10. Debug end, Input C (continue) run to end
-----or Q (quit) exit
Question: What if the code is wrong and cannot generate the executable file??
GDB uses collation records under Linux