
{"id":3455,"date":"2010-09-18T23:39:18","date_gmt":"2010-09-18T18:09:18","guid":{"rendered":"http:\/\/www.jeffrin.in\/?p=2923"},"modified":"2010-09-18T23:39:18","modified_gmt":"2010-09-18T18:09:18","slug":"gcov-code-coverage","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2010\/09\/18\/gcov-code-coverage\/","title":{"rendered":"gcov code coverage"},"content":{"rendered":"<p><a href=\"http:\/\/www.trueangle.org\/wp-content\/uploads\/2010\/10\/7f4d4-gcov-2.png\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.trueangle.org\/wp-content\/uploads\/2010\/10\/7f4d4-gcov-2.png?w=300\" alt=\"\" title=\"gcov\" width=\"300\" height=\"225\" class=\"alignnone size-medium wp-image-2928\" \/><\/a><br \/>\n<code><br \/>\n$vi hey.c<br \/>\n$gcc  -fprofile-arcs -ftest-coverage hey.c<br \/>\n$.\/a.out<br \/>\n Hey :)<br \/>\n$gcov hey.c<br \/>\nFile 'hey.c'<br \/>\nLines executed:100.00% of 3<br \/>\nhey.c:creating 'hey.c.gcov'<\/p>\n<p>$cat hey.c.gcov<br \/>\n        -:    0:Source:hey.c<br \/>\n        -:    0:Graph:hey.gcno<br \/>\n        -:    0:Data:hey.gcda<br \/>\n        -:    0:Runs:1<br \/>\n        -:    0:Programs:1<br \/>\n        -:    1:#include<br \/>\n        1:    2:main()<br \/>\n        -:    3:{<br \/>\n        1:    4:printf(\" Hey :) \\n\");<br \/>\n        1:    5:}<br \/>\n$<\/p>\n<p><\/code><br \/>\n<code><br \/>\nThe \".gcov\" files can be examined using a normal editor. The first<br \/>\ncolumn is the number of times that the line is executed. A decimal<br \/>\nnumber indicates the number of times that the line of code executes, a<br \/>\n'-' means that it is no code is generated for the line, and \"#####\"<br \/>\nindicates the generated code was not executed at all. To the right of<br \/>\nthe first ':' is line number the remainder of the line is the source<br \/>\ncode.<\/p>\n<p>Reference\/Source :<br \/>\nhttp:\/\/sourceware.org\/ml\/systemtap\/2006-q1\/msg00056.html<br \/>\nhttp:\/\/gcc.gnu.org\/onlinedocs\/gcc\/Invoking-Gcov.html#Invoking-Gcov<\/p>\n<p><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>$vi hey.c $gcc -fprofile-arcs -ftest-coverage hey.c $.\/a.out Hey \ud83d\ude42 $gcov hey.c File &#8216;hey.c&#8217; Lines executed:100.00% of 3 hey.c:creating &#8216;hey.c.gcov&#8217; $cat hey.c.gcov -: 0:Source:hey.c -: 0:Graph:hey.gcno -: 0:Data:hey.gcda -: 0:Runs:1 -: 0:Programs:1 -: 1:#include 1: 2:main() -: 3:{ 1: 4:printf(&#8221; Hey \ud83d\ude42 \\n&#8221;); 1: 5:} $ The &#8220;.gcov&#8221; files can be examined using a normal editor. &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2010\/09\/18\/gcov-code-coverage\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;gcov code coverage&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[552,596,810,1035,1623],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/3455"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=3455"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/3455\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=3455"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=3455"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=3455"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}