should be for Noip to Noi-linux under the program, so forced to choose vim+gdb (mainly guide is too ugly).
Although the debugging function of the guide has dealt with most of the debugging, it is no harm to learn the use of gdb anyway.
1 generating Debug information
In order to debug a C + + program, first at compile time, we have to add debug information to the executable file. This can be done using the-g parameter of the compiler (cc/gcc/g++). Such as:
Gcc-g Hello.c-o Hello
g++-G Hello.cpp-o Hello
Without-G, you will not see the program's function name, variable name, instead of the memory address of the runtime. After you have added the debug information with-G and successfully compiled the target code, let's look at how to debug it with GDB.
2 start gdb
the method
Enter GDB program
Program is your execution file, typically in the current directory.
3 GDB
the basic commands
L or List:
View source, Ist can also be set to display the number of lines and specify the location
Such as:
(GDB) List
(GDB) List 10
(GDB) List 5,10
B or break: Set breakpoints
Such as:
(GDB) b func
(GDB) B *func
(GDB) b 10
Ps:func is the function name, * represents the previous entry, 10 is the line number
Dig a hole and fill it up later.
GDB Debug and Pat on Linux (Dig a hole first)