Gcov: Difference between revisions

From ASCEND
Jump to navigation Jump to search
No edit summary
No edit summary
Line 15: Line 15:
vim ascend#compiler#merginst.c.gcov
vim ascend#compiler#merginst.c.gcov
</source>
</source>
Important notes
* You don't get complete gcov data if a program exits or aborts prematurely. You can possibly call __gcov_flush(), see [https://www.osadl.org/Dumping-gcov-data-at-runtime-simple-ex.online-coverage-analysis.0.html#Example_hello.c this page].
* GCOV shows results one file at a time. Tools like gcov, lcov, gcovr can give some aggregated coveraged data, create GUI/HTML output, and convert to 'cobertura' output format for use with other tools.
* See also gprof if you want information about time spent in different functions.


== ggcov ==
== ggcov ==

Revision as of 07:02, 2 October 2012

We can do coverage testing of ASCEND using the 'gcov' tool. To do this, build ASCEND using 'scons GCOV=1' (see building ASCEND for more details) and the coverage 'instrumentation' will be added.

To get coverage information in plaintext form, for a single code file, you can use the gcov command, eg

Invalid language.

You need to specify a language like this: <source lang="html">...</source>

Supported languages for syntax highlighting:

a4c, abap, abc, abnf, actionscript, ada, agda, alan, algol, ampl, amtrix, applescript, arc, arm, as400cl, ascend, asciidoc, asp, aspect, assembler, ats, autohotkey, autoit, avenue, awk, ballerina, bat, bbcode, bcpl, bibtex, biferno, bison, blitzbasic, bms, bnf, boo, c, carbon, ceylon, charmm, chill, chpl, clean, clearbasic, clipper, clojure, clp, cmake, cobol, coffeescript, coldfusion, conf, cpp2, critic, crk, crystal, cs_block_regex, csharp, css, d, dart, delphi, diff, dockerfile, dts, dylan, ebnf, ebnf2, eiffel, elixir, elm, email, erb, erlang, euphoria, exapunks, excel, express, factor, fame, fasm, felix, fish, fortran77, fortran90, frink, fsharp, fstab, fx, gambas, gdb, gdscript, go, graphviz, haml, hare, haskell, haxe, hcl, html, httpd, hugo, icon, idl, idlang, inc_luatex, informix, ini, innosetup, interlis, io, jam, jasmin, java, javascript, js_regex, json, jsp, jsx, julia, kotlin, ldif, less, lhs, lilypond, limbo, lindenscript, lisp, logtalk, lotos, lotus, lua, luban, makefile, maple, markdown, matlab, maya, mercury, meson, miranda, mod2, mod3, modelica, moon, ms, msl, mssql, mxml, n3, nasal, nbc, nemerle, netrexx, nginx, nice, nim, nix, nsis, nxc, oberon, objc, ocaml, octave, oorexx, org, os, oz, paradox, pas, pdf, perl, php, pike, pl1, plperl, plpython, pltcl, po, polygen, pony, pov, powershell, pro, progress, ps, psl, pure, purebasic, purescript, pyrex, python, q, qmake, qml, qu, r, rebol, rego, rexx, rnc, rpg, rpl, rst, ruby, rust, s, sam, sas, scad, scala, scilab, scss, shellscript, slim, small, smalltalk, sml, snmp, snobol, solidity, spec, spn, sql, squirrel, styl, svg, swift, sybase, tcl, tcsh, terraform, tex, toml, tsql, tsx, ttcn3, txt, typescript, upc, vala, vb, verilog, vhd, vimscript, vue, wat, whiley, wren, xml, xpp, yaiff, yaml, yaml_ansible, yang, zig, znn

Important notes

  • You don't get complete gcov data if a program exits or aborts prematurely. You can possibly call __gcov_flush(), see this page.
  • GCOV shows results one file at a time. Tools like gcov, lcov, gcovr can give some aggregated coveraged data, create GUI/HTML output, and convert to 'cobertura' output format for use with other tools.
  • See also gprof if you want information about time spent in different functions.

ggcov

This article is about planned development or proposed functionality. Comments welcome.

A GUI for 'gcov' exists, ggcov, see also this presentation for details. The following process can be used on Ubuntu 12.04:

  1. download ggcov 0.8.4 from here
  2. install libglade2-dev, libgnomeui-dev via Synaptic or apt-get.
  3. ./configure --prefix=/usr/local
  4. make -j4

Then ggcov test/test... but it really doesn't seem to work quite right. With version 0.8.4, there are numerous errors like

/home/john/ascend/ascend/compiler/mathinst.c: WARNING: could not find or read matching object file; the contents of the Calls, Call Butterfly and Call Graph windows may be inaccurate or incomplete.
/home/john/ascend/ascend/compiler/mergeinst.c: WARNING: could not find or read matching object file; the contents of the Calls, Call Butterfly and Call Graph windows may be inaccurate or incomplete.
/home/john/ascend/ascend/compiler/module.c: WARNING: could not find or read matching object file; the contents of the Calls, Call Butterfly and Call Graph windows may be inaccurate or incomplete.

being reported.