I have been using eclipse for development in Linux. Vim IDE is also configured during this period, but it needs to be promoted and used in the project. It feels a little less productive.
Eclipse's Linux tools are also easy to use. Combined with some common plug-ins, such as SVN, these tools can meet most daily development needs.
1. gcov
CodeThe coverage test intuitively shows the execution of each line of code. The configuration steps are as follows:
Create an executable project --> right-click the project name --> properties --> setting --> Tool Setting tag --> debugging
Debug level: Maximum (-G3)
Other debugging flags:-ftest-coverage-fprofile-arcs
(GPROF settings are also checked in this label before generate GPROF information (-PG)
Tool Setting tag --> gcc C linker
Miscellanous
Linker flags:-ftest_coverage-fprofile-arcs
The following parameters are added during compilation and linking:-ftest-coverage and-fprofile-arcs. The-ftest-coverage parameter is not added during the link.
2. GPROF
The performance testing tool, through the sampling principle, can see which code is using system resources. This tool is mainly used to test the performance of the user space. You can use the time toolProgramIf the user space is relatively small, the tool may not be very helpful to the program. You can use other tools, such as oprofile and systemtap.
These two tools are generally provided by the system and do not need to be installed separately for ease of use. Grpof and gcov both need to run the program and exit normally, and the corresponding file can be generated. GPROF generates the following files: gmon. Out, And gcov generates many files. Each CPP file contains one file in two formats. Double-click these files in eclipse to view the relevant results intuitively. For long-running programs, special signals can be used to exit the program normally. For example, if the program stops running in eclipse, the sigterm signal is used to establish this signal processing function, and call exit. If you do not want to run the program, you can use splint and cppcheck. Cppcheck has the Eclipse plug-in, splint
I have seen it before, but I cannot find it later, and it is only for the C language.
3. valgrind
Valgrind provides a series of tools, among which memory leakage detection tools are commonly used. Eclipse provides calling interfaces. valgrind needs to be installed independently. The result display is more intuitive than text. You can double-click to locate the code line.