I'm writing a guide for Ebrowse and will release it in this week.Ebrowse is a fast parser used to process C++ source files to produce a database that contains the class hierarchy that is later processed by Emacs to produce a class tree representation. It is somewhat like GNU Global, but is built-into Emacs and produce a class tree, so it will take longer to process in large source tree.
To use Ebrowse:
find . -name '*.cpp' -or -name '*.h' | ebrowse
Add more extension if you want. If your project only has hundreds of files, then =Ebrowse= works really well. After executing the command, a file named
BROWSE is generated; this is the database that contains the class hierarchy. Simply open this file and Emacs automatically recognizes the file and process it. After done processing the database, Emacs displays an index of all classes in the database in a tree format: if a class is derived from a class, it is nested inside the parent class. This buffer is called a
Tree buffer. Emacs provides three ways to interact with
Tree buffer: a buffer that displays the tree.
Member buffer: a buffer that displays members of each class. You
can toggle between declarations and definitions of a class and jump
to the location of each in the corresponding source file.
Source buffer: your code buffer. You can interact
database like finding and viewing (open for read-only) declaration
and definition, open a =Member= buffer of a class that contains the
tag at point...
If you have a large project (i.e. more than 10000 cpp files), but all classes are in
.h files, then don't add
.cpp or else it would take very long to generate
BROWSE file. You will lose the ability to switch to definition though; but this can be done by using
GNU Global. The most important thing is to view class hierarchy in
Tree buffer, and this is the advantage of Ebrowse.
WIP guide is here.
Update: Alternatively, you can use doxygen to generate all kinds of graphs (caller/callee graphs, dependency graphs, class hierarchy graphs...) but it also takes a long time to generate all, even for small source tree like ipxe. This is not that
doxygen is slow, in fact it's quite optimized, but to compute dependency for whole code base is not a trivial task.
Bonus: If you work with C and want to see call graph, use GNU Cflow. See my Reddit annswer.