I am working with a very large code in C/C++. Indexing and referencing is a must in this environment. What tools would you recommend for viewing/browsing the code? Preferably open source. I tried CDT for indexing but it is useless. Other tools I've tried is cscope, but it does not work well with C++...
Doxygen. It parses all files, generates nice HTML you can browse easily. I used it to crack some really large codebases - from scratch. Once you start using it a lot, it helps to format comments in your code, so doxygen can create documentation.
It can also create class dependency diagrams.
It's open source under GPL license.
What environment? Windows/VisualStudio? Linux?
For Windows/VisualStudio we've bought VisualAssists. Worth every cent. And all of us disabled IntelliSense right away.
If you use emacs, you could use etags to index your code and then the tag table facilities to navigate through your source code. There is an help page for Tags in the info windows of Emacs.
If it's possible to pull the code into a Visual Studio solution, then there are some great features for browsing around the code.
If that isn't possible, Doxygen is a great way to go once you get your configuration file set up. I've used it successfully on fairly large codebases (hundreds of files, 100K+ lines of code).
- I like opengrok.
- "exuberant Ctags", which opengrok use, is a lightweight solution.
Vor vim lovers, you should try the pair exuberant-ctags and OmniCppComplete (http://www.vim.org/scripts/script.php?script_id=1520).
Ctags works pretty fine when running with the following options:
--languages=C,C++ --c++-kinds=+plx --fields=+iaS --extra=+q -I__THROW,__NTH+,__wur,__warnattr, __nonnull, __attribute_malloc__, __attribute_pure__, __attribute_used__, __attribute_noinline__, __attribute_deprecated__, __attribute_format_arg__, __attribute_format_strfmon__, __attribute_warn_unused_result__, __always_inline,__extern_inline, __extension__, __restrict
I use Eclipse Ganymede which is "equipped" with CDT 5 - I find that there is a big progress since CDT 4 and source indexing works fine for me. I work on a big (and pretty messy) project which builds on both Linux and Windows and I found that CDT 5 indexes it better than VS2005/2008.
Probably you should play around with source location settings, preprocessor directives for indexer, etc.
Source insight.... it rocks with beautiful browsing shortcuts.. I never use mouse....
Another good tool - and there's a free version - is Understand for C++. See this link for more info.
I've used it a lot in the past, and it was a real help in getting up the learnign curve for a large source base.
Source Insight or Understand for C++, although both are not freewares. Trial versions of each are available lasting 30 and 15 days respectively.
Source Insight does indexing on the fly, I mean you edit the code and its indexed. Whereas we need to tell Understand for C++ to re-parse the code when its edited. Understand generates exhaustive report of the source base, which could be used for static analysis. We mainly focus on reducing Cyclomatic complexity.
In earlier days, I used to use browse info capability in MS Visual C++ 6.0.
Source Insight. Yes it costs a few hundred bucks, but you only buy it one time. And the manufacturer spends that money well designing a simple, elegant editor that does THE 3 things anyone could want, in an EDITOR, not just a browser:
- Real time generation of the tree of your code
- Full syntax highlighting for 10s of languages (and you can add your own)
- An interface to external tools that works all the time (unlike, forgive me, VS6,8,9)
I cannot figure out why the company is so quiet, and why more people haven't picked up on it.
My colleagues swear by Glimpse (the non-'web' part of WebGlimpse, and the engine underlying LXR).
Our language-sensitive source code search engine can be found at SD Source Code Search Engine. It can handle many languages at the same time. Searches can be performed for patterns in a specific langauge, or patterns across languages (such as "find identifiers involving TAX"). By being sensitive to langauge tokens, the number of false positives is reduced, saving time for the user. It understands C, C++, C#, COBOL, Java, ECMAScript, Java, XML, Verilog, VHDL, and a number of other languages.
Sourceinsight is the best!!! It is a great tool for C/C++/Java reverse engineering, source code indexing and large scale source code browsing. I am using it for 5 years to browse large source projects over 1 million lines of code.