What is a good tool to aid in browsing/following C code?
I sometimes need to modify OSS code or other peoples' code (usually C-based, but sometimes C++/Java) and find myself "grep"ing headers for types, function declarations etc. as I follow code flow and try to understand the system. Is there a good tool that exists to aid in code browsing. I'd love to be able to click on a type and be taken to the declaration or click on a function name and be taken to it's implementation. I'm on a linux box, so replies like "just use Visual Studio" won't necessarily work for me. Thanks!
Read more... Read less...
I've heard amazing things about OpenGrok. I know another team at my place of employ uses it and they find it very handly. From its web site:
OpenGrok is a fast and usable source code search and cross reference engine. It helps you search, cross-reference and navigate your source tree. It can understand various program file formats and version control histories like Mercurial, Git, SCCS, RCS, CVS, Subversion, Teamware, ClearCase, Perforce and Bazaar. In other words it lets you grok (profoundly understand) the open source, hence the name OpenGrok. It is written in Java.
edit: Why has this been voted down? It is a valid answer. Eclipse with the C/C++ addon will allow the question author to do what he is wanting to do. I am not the only one to have suggested, yet the others have not been voted down. So why has this one been voted down?
I do a bit in the kernel space, and keep coming back the scope.
$ cd /usr/src/redhat/BUILD/kernel-version
$ cscope -R -p4
Find this C symbol: Find this function definition: Find functions called by this function: Find functions calling this function: Find this text string: Change this text string: Find this egrep pattern: Find this file: Find files #including this file:
I usually "live" in c-scope when working on someone elses project. I use this to open files with "gvim" (my IDE), edit things, then quit "back" to c-scope, It helps me keep task focused.
I believe that cscope can be configured to work with vim and emacs, although I've seen people use other editors also.
Best of luck to you.