Source Code Browsing
A co-worker recommended GNU Global for browsing source code a few days ago. It was pretty easy to set up. Install it and then go to the root of your source tree and type gtags
. Then you can run global on the command line and try it out. Try things like:
global funcName
global -x funcName
global -rx funcName
global -sx varName
That should give you the idea that it can find a function definition and all its references, or a variable name and all its references pretty quickly. Very handy.
There is an emacs interface as well. Load gtags.el (comes with global), open a file, and do M-x gtags-mode
. c-h m
will show you the commands gtags-mode provides for doing the same thing we just did on the command line.
I'm not sure if I'm going to switch to using global/gtags. I already use a combination of cscope and Exuberant ctags, both of which have their strengths, and both of which have emacs interfaces, naturally. They all seem to have troubles parsing out tags/symbols in my C++ code in various places, but for the most part they work well. My quick testing showed that GNU Globals did a little worse than what I'm already using using. You can see some issues it has here.
Overall, if you aren't already using a tool like this to help you browse your code (maybe you're using good ol' find and grep), I highly recommend picking up one (or more) of these tools. They are a lifesaver.
Comments
Katie.
http://qnacunningham.blogspot.com/
I only know one of those words! He he he