Note: This document is still in the draft state. I hope I can finish it within one day or two if I have more time. ;) --Kennykaiyinyu 19:04, 10 June 2008 (PDT)

What is Source-Navigator?

(quoted from the internet) Source-Navigator is a source code analysis tool which lets users to edit, browse and build their projects. With it, you can edit your source code, display relationships between classes and functions and members, and display call trees. You can also build your projects, either with your own makefile, or by using Source-Navigator's build system to automatically generate a makefile. Source-Navigator works with the Insight GUI interface for GDB.

Why worth a try?

It's quite fast as compared to mxr. (I think.)

You can specify whether it's the declaration/definition of a method/function to look up... but on the other hand mxr can only allow you to type in the name for it to generate a long list of occurances. (as I understand. Let me know if this is wrong..)

It can generate a class hierarchy quite easily (unfortunately, not for classnames which are defined by macro.)

Installing Source Navigator

In Ubuntu

Execute the following line in a terminal window:

sudo apt-get install sourcenav

This should install source-navigator. One can check whether the installation is complete by executing:

$ which snavigator
/usr/bin/snavigator

Importing the source

Execute the following: snavigator. This triggers a splash screen, followed by a "Source-Navigator Projects" dialog as the following: I've already created a new project bin.proj before documenting this. If this is your first time to open source navigator, the big white box on the left of the dialog should contain no lines.

Click "New Project". This shows the "Auto-Create Project" dialog: which allows you to decide your filename of the project file (which ends in .proj) and your source directory/directories that you want to import into the project. (You can always include more by pressing the "More" button.)

In my case, I inputted the followings:

Project File: <tt>~/snav-mozilla</tt>

Add Directory (where your source files reside in -- I understand that the label here is not so self-explanatory...): <tt>~/moz1.9/mozilla</tt> (because I saved my source at ~/moz1.9/mozilla.)

Remember to ensure that "Include Subdirectories" and "Build Cross-reference database" are checked.

Then click "OK". The snavigator then begins to scan your source directories. This takes a few minutes. Now you can enjoy searching the mozilla code in a faster speed.

Using Source Navigator (more later)

Opening a Project

Open a terminal.

Type <tt>snavigator</tt> followed by striking Enter.

This shows the "Source-Navigator Projects" dialog. Choose the project file that you've just created and then click "Open...". Source Navigator then loads the database and then display the following Symbols window:

Searching a method

by typing in the method name

viewing the definition/declaration by highlighting the method in the code