Simple question on C program test coverage / dependence analysis

Hi all.

I am new to LLVM, and wondering are there any off-the-shelf tools for C programs
for measuring testing coverage and simple dependence analysis (within the LLVM framework).

Specifically, I would like to:

(1) measure which line is covered when executing a C program with specific input values.

It likes a testing coverage tool, but I hope to get the line number. are there off-the-shelf
tool (or LLVM extension) to do that?

(2) find control/data dependence between each statement

For example, given the following program:

  1. if(x) {
  2. f();
  3. }
  4. a = 1;
  5. b = a;

Line 2 is control-dependent on line 1, and line 5 is data-dependent on line 4 (with variable a)

I hope a tool can report this potential dependence information. It does not need to very
precise for alias (pointers). A conservative treatment should be fine.

I am also wondering is there an off-the-shelf tool can report such potential dependence?

Thanks a lot, any suggestion is highly appreciated.

-Sai

Hi all.

I am new to LLVM, and wondering are there any off-the-shelf tools for C
programs
for measuring testing coverage and simple dependence analysis (within the
LLVM framework).

Specifically, I would like to:

(1) measure which line is covered when executing a C program with specific
input values.

 It likes a testing coverage tool, but I hope to get the line number\.

are there off-the-shelf
tool (or LLVM extension) to do that?

LLVM+clang supports generating profile data which can be read with
gcov; pass --coverage to clang to turn it on.

(2) find control/data dependence between each statement

For example, given the following program:

1. if(x) {
2. f();
3. }
4. a = 1;
5. b = a;

Line 2 is control-dependent on line 1, and line 5 is data-dependent on line
4 (with variable a)

I hope a tool can report this potential dependence information. It does not
need to very
precise for alias (pointers). A conservative treatment should be fine.

I am also wondering is there an off-the-shelf tool can report such potential
dependence?

MemoryDependenceAnalysis provides some useful utilities for computing
dependencies for operations with side-effects on LLVM IR.
Alternatively, you could try building something with the clang static
analyzer framework. I think you'll have to write the code to actually
gather the data and output it in an appropriate format yourself,
though.

-Eli