user1014814
user1014814

Reputation: 101

How to generate program dependence graph for C program?

I want to generate a Program Dependence Graph (PDG) from C source code. I found papers that explain how do it, but all used the commercial CodeSurfer tool.

Are there any free tools that do this?

Upvotes: 10

Views: 16496

Answers (4)

Garfield
Garfield

Reputation: 21

If you use llvm to generate pdg, you can use this: https://bitbucket.org/psu_soslab/program-dependence-graph-in-llvm/src/master/

Upvotes: 0

Thomas Matthews
Thomas Matthews

Reputation: 57678

Doxygen can generate function caller and callee graphs, as well as all the functions used in your program. This may not be exactly what you are looking for, but it could provide some useful data.

SourceMonitor is a metrics tool that can show function and program complexity as well as complexity diagrams.

Both tools are free.

Upvotes: 1

thegreendroid
thegreendroid

Reputation: 3328

There's a promising new tool called cpp-depenencies.

It can generate component dependency diagrams (like below) as well as class hierarchy diagrams (by passing an option to treat each source file as a component).

enter image description here

Upvotes: 1

Pascal Cuoq
Pascal Cuoq

Reputation: 80255

Frama-C is an open-source static analysis framework that can compute a sound Program Dependency Graph for C programs. Its slicing plug-in uses the resulting PDG. The slicing and PDG computation were discussed in February 2010 on the mailing list (messages from jung, myung-jin and their answers).

You may also look at NIST's Unravel, or Georgia Tech's Aristotle. Both Valsoft at Karlsruhe University, and Loyola's Surgeon's Assistant, might also be worth looking into.

Upvotes: 11

Related Questions