Code exploration in C with GNU GLOBAL

For a long time I’ve been getting by with using cscope at work. I’m not a great C programmer by any stretch, and I need to have multiple windows open and a note book by my side to get any sort of understanding of the code.

globals
GLOBAL’s HTML output

So I was happy to discover GNU GLOBAL recently. Getting it setup is a matter of running gtags on the root of the repository. Running htags also produces nice HTML files that make it much easier to browse through.

It has quite a few integrations as well. The snippet I added to my emacs init.el is as follows:

;; gtags/gnu globals
(setq load-path (cons "/usr/share/emacs/site-lisp/" load-path))
(autoload 'gtags-mode "gtags" "" t)
(setq c-mode-hook
 '(lambda ()
 (gtags-mode 1)
 ))
(setq gtags-suggested-key-mapping t)
(setq gtags-auto-update t)

Here is a table that compares similar tools.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s