Skip to content

Instantly share code, notes, and snippets.

@adrianlshaw
Last active May 26, 2021 18:12
Show Gist options
  • Save adrianlshaw/fe3685da041ac1da1f1536acbb4e297b to your computer and use it in GitHub Desktop.
Save adrianlshaw/fe3685da041ac1da1f1536acbb4e297b to your computer and use it in GitHub Desktop.

I've recently returned to the world of software development for a research role, and as expected, I've been handed a big codebase to get to grips with.

To save time I often reach out to graphing tools to get an understanding of how the source code is really structured. There are plenty of complex tools but I just use Doxygen with Graphviz. Unfortunately, even that's not a terribly useable tool, so I'm writing down the steps I use here.

Go into your project and run:

doxygen -g Doxyfile

Edit the Doxyfile and make sure the following variables are set:

EXTRACT_ALL = YES
RECURSIVE = YES
CALL_GRAPH = YES
OPTIMIZE_OUTPUT_FOR_C = YES
HAVE_DOT               = YES
EXTRACT_ALL            = YES
EXTRACT_PRIVATE        = YES
EXTRACT_STATIC         = YES
CALL_GRAPH             = YES
CALLER_GRAPH           = YES
DISABLE_INDEX          = YES 
GENERATE_TREEVIEW      = YES
RECURSIVE              = YES

NCC is another nice tool but the Ubuntu package doesn't seem to include everything but the C compiler itself. It does have a linker, C++ compiler, though. Something for me to look into at some point in the future.

There is also cflow which is quite nice. However, it only generates POSIX flow graphs. For actual pictures like PNG, use mycflow2dot

pip install pycflow2dot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment