10

I am working on an academic research regarding some very long functions in the Linux kernel (link, link).

For that research, I would like to use some code flow visualization tool, that would be able to plot a graph in which each vertex is a decision point and each edge is a piece of code which runs in a consequent way.

Do you know of any good, open source project that can visualize C code?

Community
  • 1
  • 1
Adam Matan
  • 117,979
  • 135
  • 375
  • 532

4 Answers4

10

Perhaps a tool like KCacheGrind would be of help. It generates call graphs based on actual calls and cannot pre-generate a call graph without actually running the program, which may not suit your needs, but then it again it may.

KCacheGrind Call Graph

Glorfindel
  • 20,880
  • 13
  • 75
  • 99
Duncan Beevers
  • 1,830
  • 11
  • 17
1

History flow's are very neat for changes/diff across multiple versions.

Codeplex has a project, Dependency Visualizer which does support C also.

Gprof2Dot can render oprofile, this would get you dynamic info also.

CodeViz also (static tool) would work.

If your using gcc, gcc-xml has an introspector plugin also todo this.

RandomNickName42
  • 5,817
  • 1
  • 34
  • 34
1

You appears to want to acquire a flowchart of C source code ("decisions", "code blocks").
Something like this C flowchart?

To do this correctly, esp. for Linux kernal code, I'd expect you to have to preprocess the code first to get rid of macros and conditionals. I would assume that GCC would construct such a graph internally and that you ought to be able to get your hands on that graph.

Ira Baxter
  • 91,210
  • 21
  • 166
  • 327
0

Doxygen does some amount of 'visualization',
but you need to work on the code a bit for it to be usable.


Another interesting thing to check would be lxr

Linux Cross Referencer is a software toolset for indexing and presenting source code repositories. LXR was initially targeted at the Linux source code, but has proved usable for a wide range of software projects. lxr.linux.no is currently running an experimental fork of the LXR software.

albert
  • 7,283
  • 3
  • 16
  • 31
nik
  • 12,838
  • 3
  • 40
  • 56