Tuesday, March 14, 2006


Static analysis of K&R C code

I've got a body of C code (mostly K&R) that I'd like to quickly dip into. It would be great if there was a tool that could visualise the (Static) call relationships between functions - I don't expect the tool to be able to meaningfully interpret function pointers, so it would not have to do anything smart with the following code:
int foo( int x ) { return x + 1; }
int bar( int x ) { return x + x; }

int baz( int (*qux)(int), int x )
  return qux( x );

int main( int argc, char ** argv )
  return baz( 1 == argc ? foo : bar );
But the tool should be able to identify that main() calls baz(), and that baz() invokes a function pointer. It would be absolutely fantastic if it identified that baz() calls either foo() or bar(), but I won't hold my breath waiting for this functionality.

Do you know of any tools like this?

A quick search on google did not find any tools like this. I did find:

Links to this post:

Create a Link

<< Home

This page is powered by Blogger. Isn't yours?