Tuesday, June 10, 2014

Code coverity using GCC gcov



Create a cpp source file with main function and name it main.cpp

Build source with gcov enabled
g++ -Wall -fprofile-arcs -ftest-coverage main.cpp
                It will generate main.gcno file
Run binary
                ./a.out
                It will generate main.gcda file
Run gcov for the source file
                gcov main.cpp
                it will generate main.cpp.gcov file
Open main.cpp.gcov and analyse ##### lines for un tested code lines.

5 comments:

  1. This is a great post. I like this topic.This site has lots of advantage.I found many interesting things from this site. It helps me in many ways.Thanks for posting this again.

    Hadoop Training in Chennai

    ReplyDelete
  2. thank you for sharing such a nice and interesting blog with us. hope it might be much useful for us. keep on updating...
    SEO Company In Chennai

    ReplyDelete
  3. I am expecting more interesting topics from you. And this was nice content and definitely it will be useful for many people.

    Email Marketing Chennai

    ReplyDelete