Skip to content
Powerful search for large codebases
Python C++ JavaScript HTML CSS Rust Other
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
trilite @ e92ee93


DXR, A Code Search and Cross-Reference Tool


DXR is a source code cross-reference tool that uses static analysis data collected by instrumented compilers. DXR was created in order to build on tools like LXR and MXR. DXR runs only on Linux for the moment.


DXR is fairly well documented, so whether you're looking to deploy DXR, write plugins or templates for DXR have a look at the docs/ folder. The documents in this folder is a great starting point for anybody who wants to deploy and/or develop DXR.

Quick Start

To try out DXR on a HelloWorld-size project...

git clone --recursive git://
cd dxr  # (the top level of the repository, not the dxr folder within it)

# If you want to customize VM configuration for your environment, run the
# line below, and change the settings you need, e.g. turning off NFS:
cp vagrantconfig_local.yaml-dist vagrantconfig_local.yaml

vagrant up
vagrant ssh

On the VM...

cd ~/dxr
cd ~/dxr/tests/test_basic
make target

Then, on your host box, surf to, and poke around to your heart's content. You may have to substitute the IP address of your Vagrant machine.


If, after trying a search, you see the error...

Server Error
Database error: no such module: trilite

SSH into the VM and, run ldconfig as root to sort out the shared library linking problem. Then restart, and all should work as expected.

Installing on a Real Machine

To install DXR on a machine of your choice, install the dependencies in docs/deployment.mkd. Then, install the dxr Python package, either by running python2.6 develop (if you want to hack on DXR itself) or python2.6 install.

If you'd like to install it as non-root (recommended), use virtualenv:

virtualenv my-dxr-env
source my-dxr-env/bin/activate  # You'll have to repeat this line each time
                                # you want to use DXR in a new shell.
pip install -r requirements.txt
python develop         # Magic path munging will make this the
                                # copy of Python in the virtualenv.

Finally, run make from tests/test_basic to build a sample index and tests/test_basic/target to start the server.

Things To Do

This is a short list of major things that could be done to improve DXR.

  • Refactor the database schema
    • Remove plugin specific tables
    • Provide data collection API for plugins (ie. no direct database access for plugins)
    • Optimize schema for search queries
      • Store extents as a blob in *_refs, types, functions, etc.
      • Use trilite for functions, types, macros, etc.
      • Store the transitive closure of indirect calls
    • Port search logic to new schema
  • Write proper search query parser
    • Space is a delimiter unless in dice [ ], quotes " " or escaped \
    • Assume grep syntax for terms, path:, type:, etc. (ie. * is literal, \* is kleene star)
    • Let quotes "text" be literal terms, path:, function:, etc.
    • egrep syntax for regexp:, regex: and egrep: ie. * is kleene star, \* is literal)
    • Prefix + implies case sensitivity (and fully qualified type:, function:, etc.)
    • Prefix - implies negation (prefix -+ and +- is case sensitive negation) (Prefix +, -, +- and -+ can be applied to terms, path:, type:, egrep:, etc.)
  • Minor refactoring of template interface to minimize size
    • Reuse annotations (i.e., don't store the same annotation for each line)
    • Reuse menus (i.e., don't store the same menu for each occurrence)
  • Minor UI fixes and cleanup
    • Colorize highlighted matches (highlight with classes, .m1, .m2, ..., use merge-extents)
    • Make the UI pretty
    • Add option in "Advanced" search to disable redirect (use cookies to remember setting)
    • Minimize template size (at 20 MiB for 20k lines, this is a real issue)
  • Add tree format version number to generated trees (Don't merge generated output with different formats, when configuring update cron job)
Something went wrong with that request. Please try again.