Hi all!

I am working on a tool to analyze source code coverage for RTEMS.
Currently I am looking for a tool to annotate source code such that I can
extract information about statements and conditions that affect the control
flow of a program.
A similar tool exists for Ada programs. They call this information 'Source
Coverage Obligations'. Some information about SCOs can be found in [1].
I attached a program triangle.c which contains some if-statements. Each of
these statements contains two or more conditions. The second attached file
is the output of compiling triangle.c with
gcc -O1 -fdump-tree-cfg -o triangle triangle.c
This output is almost what I am looking for, but I think that there has to
be something better out there.

Does anybody of you know a tool which I can use to annotate source code?

Best,
Hermann

[1] http://docs.adacore.com/gnatcoverage-docs/html/cov_source.html
/*
 * =====================================================================================
 *
 *       Filename:  triangle.c
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  08/13/2015 08:00:17 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Hermann Felbinger (hf), hermann19...@gmail.com
 *   Organization:  
 *
 * =====================================================================================
 */

int check(int a, int b, int c)
{
    if (a <= 0 || b <= 0 || c <= 0)
    {
        return -1;
    }
    else 
    {
        if (c >= (a + b) || b >= (a + c) || a >= (b + c))
            return -1;
        else if (a == b && b == c)
            return 1;
        else if ((a == b && a != c) || (b == c && b != a) || (a == c && a != b))
            return 2;
        else 
            return 3;
    }
}

Attachment: triangle.c.012t.cfg
Description: Binary data

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to