Eclipse C ++ development tool series on Linux

Source: Internet
Author: User
Tags gcov valgrind

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.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.