Skip to content
No description or website provided.
Find file
Pull request Compare This branch is 2304 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 (

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.

2) Once you have a working environment, you need to obtain a Mozilla source tree:

3) Next, you need to patch the xpidl that comes with Mozilla, so that it will produce cross-reference info for .idl files:

cd /path/to/your/mozilla/srcdir
patch -p1 < dxrsrc/xpidl.patch

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

5) Alter dxr-mozconfig to use the appropriate paths for your environment, specifically:

# build with gcc+dehydra instead of normal g++.  Update as required for your env.
export CXX=$HOME/dxr/tools/gcc-dehydra/installed/bin/g++

# use dehydra plugin and dxr.js script
export CXXFLAGS=-fplugin="$HOME/dxr/tools/gcc-dehydra/dehydra-gcc/ -fplugin-arg=$HOME/dxr/xref-scripts/dxr.js"

6) 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/";

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

8) Copy (or move) the contents of dxrsrc/www to your web dir

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

10) 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 build Mozilla with Dehyda + dxr.js, then 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)
                                                   /.gliimpse*  (glimpse index files)
                                         /accessible (and all other source files copied from your src dir)
Something went wrong with that request. Please try again.