Source Navigator

  • Revision slug: Source_Navigator
  • Revision title: Source Navigator
  • Revision id: 166182
  • Created:
  • Creator: Kennykaiyinyu
  • Is current revision? Yes
  • Comment /* Importing the source */

Revision Content

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.

More information can be found here --> http://sourcenav.sourceforge.net/

Why worth a try?

  1. It's quite fast as compared to mxr. (I think.)
  2. 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..)
  3. 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

  1. Execute the following: snavigator. This triggers a splash screen, followed by a "Source-Navigator Projects" dialog as the following: Source Navigator Dialog
    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.
  2. Click "New Project". This shows the "Auto-Create Project" dialog:
    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.)
  3. Remember to ensure that "Include Subdirectories" and "Build Cross-reference database" are checked.
  4. 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

  1. Open a terminal.
  2. Type <tt>snavigator</tt> followed by striking Enter.
  3. 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:
    Source-Navigator Symbol Window

Searching a method

by typing in the method name

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

...

Displaying a inheritance hierarchy

  1. ...

Searching a string

  1. ...

Revision Source

<p><b>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. ;) --<a href="User:Kennykaiyinyu">Kennykaiyinyu</a> 19:04, 10 June 2008 (PDT)</b>
</p>
<h2 id="What_is_Source-Navigator.3F" name="What_is_Source-Navigator.3F">What is Source-Navigator?</h2>
<p>(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.
</p><p>More information can be found here --&gt; <a class=" external" href="http://sourcenav.sourceforge.net/" rel="freelink">http://sourcenav.sourceforge.net/</a>
</p>
<h3 id="Why_worth_a_try.3F" name="Why_worth_a_try.3F">Why worth a try?</h3>
<ol><li> It's quite fast as compared to mxr. (I think.)
</li><li> 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..)
</li><li> It can generate a class hierarchy quite easily (unfortunately, not for classnames which are defined by macro.)
</li></ol>
<h2 id="Installing_Source_Navigator" name="Installing_Source_Navigator"> Installing Source Navigator </h2>
<h3 id="In_Ubuntu" name="In_Ubuntu"> In Ubuntu</h3>
<p>Execute the following line in a terminal window:
</p>
<pre class="eval">sudo apt-get install sourcenav
</pre>
<p>This should install source-navigator. One can check whether the installation is complete by executing:
</p>
<pre class="eval">$ which snavigator
/usr/bin/snavigator
</pre>
<h2 id="Importing_the_source" name="Importing_the_source">Importing the source</h2>
<ol><li> Execute the following: <code>snavigator</code>. This triggers a splash screen, followed by a "Source-Navigator Projects" dialog as the following: <img alt="Source Navigator Dialog" fileid="369" src="File:en/Media_Gallery/Snavigator-project-dialog.jpg"> <br>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. </li><li> Click "New Project". This shows the "Auto-Create Project" dialog:<br><img alt="Auto-Create-Project Dialog" fileid="366" src="File:en/Media_Gallery/Snav-auto-create-project.jpg"><br> 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.) <ul><li>In my case, I inputted the followings:
<ul><li><i>Project File</i>: <br> <tt>~/snav-mozilla</tt>
</li><li><i>Add Directory</i> (where your source files reside in -- I understand that the label here is not so self-explanatory...): <br> <tt>~/moz1.9/mozilla</tt> <br>(because I saved my source at ~/moz1.9/mozilla.)
</li></ul>
</li></ul>
</li><li> Remember to ensure that "Include Subdirectories" and "Build Cross-reference database" are checked.
</li><li> 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.
</li></ol>
<h2 id="Using_Source_Navigator_.28more_later.29" name="Using_Source_Navigator_.28more_later.29">Using Source Navigator (more later)</h2>
<h3 id="Opening_a_Project" name="Opening_a_Project">Opening a Project</h3>
<ol><li> Open a terminal. </li><li> Type <tt>snavigator</tt> followed by striking Enter.
</li><li> 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:<br><img alt="Source-Navigator Symbol Window" fileid="368" src="File:en/Media_Gallery/Snav-symbols.jpg">
</li></ol>
<h3 id="Searching_a_method" name="Searching_a_method">Searching a method</h3>
<h4 id="by_typing_in_the_method_name" name="by_typing_in_the_method_name">by typing in the method name</h4>
<h4 id="viewing_the_definition.2Fdeclaration_by_highlighting_the_method_in_the_code" name="viewing_the_definition.2Fdeclaration_by_highlighting_the_method_in_the_code">viewing the definition/declaration by highlighting the method in the code</h4>
<h4 id="..." name="...">...</h4>
<h3 id="Displaying_a_inheritance_hierarchy" name="Displaying_a_inheritance_hierarchy">Displaying a inheritance hierarchy</h3>
<ol><li>...
</li></ol>
<h3 id="Searching_a_string" name="Searching_a_string">Searching a string</h3>
<ol><li>...
</li></ol>
Revert to this revision