Skip to content
An intelligent source code browser
JavaScript PHP Python ActionScript Shell C++ Perl
Pull request Compare This branch is 2439 commits behind mozilla:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.




DXR is a source code cross-reference tool that uses static analysis data collected by Dehydra (  DXR was created in order to build on tools like LXR and MXR.  DXR only runs on Linux for the moment, and is heavily customized for the Mozilla project's source code.


DXR is primarily a database of source code information.  You need a lot of
space to do this, and a fast computer helps a lot.

1) In order to build the database you need a working Mozilla and Dehydra build environemnt.  If you have this already, take note of the paths for your g++ and dehydra plugin, so you can alter paths in the scripts.  If you do not have one, you can follow the instructions here:

* Mozilla Build Environment for Linux (
* Dehydra Build Environment for Linux (

Note that Dehydra is only supported for gcc-4.5; any earlier version of gcc uses
a different plugin architecture, which is not supported.

If you are using a Fedora-like Linux, you can also do the following to have an environment setup locally:


NOTE: this will not alter your system in any way, or replace any default tools.  It builds everything in a ./tools directory.  See for necessary build dependencies.

You also need to make sure that you have python and python-sqlite installed on
your computer, as well as sqlite3

2) DXR uses config info from an INI style config file. Alter the variables in
dxrsrc/www/dxr.config for your environment.

3) For the moment you also need to alter dxrsrc/xref-scripts/dxr.js (i.e., the dehydra script) to point to your srcdir:

// NOTE the trailing slash
var srcroot = "/home/dave/dxr/mozilla-central/";

4) Create the wwwdir (e.g., /var/www/html/dxr) you specified in your dxr.config

5) Copy (or symlink) the contents of dxrsrc/www to your web dir. You also need
to copy (or symlink) the xref-scripts directory.

6) Configure and build your program. Note that you need to have:
CXXFLAGS="-fplugin=/path/to/ -fplugin-arg-gcc_dehydra-script=/path/to/dxrsrc/xref-scripts/dxr.js"
CFLAGS="-fplugin=/path/to/ -fplugin-arg-gcc_dehydra-script=/path/to/dxrsrc/xref-scripts/dxr.js"

7) Run the cross-reference generator:
dxrsrc/xref-scripts/ -f /path/to/web/dir/dxr.config

8) Download and install (or at least build somewhere the web app can access) Glimpse:

9) You can optionally install sqlite 3 if it is not already installed on your system.  You don't strictly need it, but it makes accessing the database manually eaiser.


You can build your source, create the xref database, and create the static HTML content as follows:

dxrsrc/xref-scripts/ -f /path/to/web/dir/dxr.config

This will post-process the data into dxr.sqlite.  It will also build the static
html and create a glimpse full-text search index.  All these files will be
created in the wwwdir using the name of the tree you provided in dxr.config
(e.g., mozilla-central).  You will end up with the following structure:

/var/www/html/dxr (or whereever your wwwdir is located)
		 /index.html (auto-generated during
                 /mozilla-central (symnlink to mozilla-central-current)
                                                   /.glimpse*  (glimpse index files)
                                         /accessible (and all other source files copied from your src dir)
Something went wrong with that request. Please try again.