Source code analysis and exploration tools for C and C++ seem to be sorely lacking.
Are there any tools which I can use to gather information about C and/or C++ source files? cscope does part of what I would need, Doxygen looks closer.
At a minimum list of all function, callers, callees, variable references etc.
Perhaps Doxygen's xml output would work.
Ideally gcc or llvm could be hooked for this purpose but I have yet to find a convenient way to do so.
Any suggestions?
There is the clang static analyzer which is part of the clang front end for llvm, but I don't know how well it works for C/C++. It seems most of their effort is going towards Objective-C.
http://clang-analyzer.llvm.org/
Doxygen is good for call graphs, you'll want to have GraphViz installed and use doxywizard to select the Call graphs and Called by graphs tick boxes in the Diagrams section (CALL_GRAPH and CALLER_GRAPH in the expert mode Dot section.)
You might find SourceMonitor helpful for more statistical analysis for code, plus its free :)
Try Klocwork. It has every gory detail you could ever need about C/C++ source code plus much much more.
Our DMS Software Reengineering Toolkit with its C front end and C++ Front End can provide a lot of information about C and C++ programs.
DMS with the C front end can parse large sets of C source files, build complete ASTs (even capturing comments) and symbol tables, and provide control and data flow analysis, with points-to analysis and call graphs. The C++ front end builds ASTs and full symbol tables, but does not yet provide all the flow analysis information.
DMS provides facilities to invoke the parsers/flow analyzers; you provide some custom code to extract the information you want.
It has the additional capability of modifying the ASTs and regenerating compilable source code.
I think you'll find that no tools for which you can extract precise custom data are "easy" to use; the very nature of the questions you ask and the answers have lots of complications caused by the complex language semantics.
You can try CppDepend based on CLang. It is a good tool.
It gives 60 metrics (including of course the functions you need : list of functions/classes, callers, callees, dependency graph,...).
Sonar is a really good Java projects analyzer. It now supports some other languages, including .Net. At the end of this blog post, you can see that a C plugin will be released soon...
The Polyspace static analysis tool can display functions, callers, callees, variable references, global variable reads/writes. You have the ability to drill down into data structures to determine where the access occurs. Information is displayed in both text and graphical format. Variable range information is also determined. More information in the online user guide. Link to one of the sections given below:
http://www.mathworks.com/help/toolbox/polyspace/c_ug/brz384r-12.html#brz384r-17
Disclaimer: I work for MathWorks, the makers of the Polyspace static analysis tool.