Give DXR a try

At Mozilla we have a long history of using MXR for looking up and discussing source code. Unfortunately MXR is an unlovable mess of Perl and a crappy (in terms of performance and license) text indexing engine that is glimpse. It is dead because nobody wants to work on it.

DXR is a semantically-aware successor to MXR. Semantic information is extracted from LLVM during compilation. This makes it possible to do searches like derived:nsIFile. DXR uses a modern Full Text Search engine for text searches, so it should be much faster than MXR. There is a test instance at dxr.mozilla.org, please give it a try. The homepage lists sample searches you can do.

DXR is written in Python. It uses an SQLite database + FTS index as a backend. Useful semantic information is extracted from the source via a Clang LLVM plugin. Checkout the source code at github.

DXR should be getting close to feature parity with MXR. Give it a try and let me know of any bugs/missing features you encounter (or submit a patch!). I realize that people have gotten used to various MXR quirks and that it can be stressful to switch to a new code indexer while trying to get stuff done, but MXR IS DEAD. We need to move on. Mozilla is complex, finding relevant code can take quite a while, especially for new contributors. Using a smarter indexer should save time, reduce frustration and free up a few developer-years to make Firefox better.

We have lots of ideas for DXR, but first we need to ensure it is a suitable replacement for MXR. Take DXR for a spin!

This entry was posted on Tuesday, May 22nd, 2012 at 9:34 am and is filed under static-analysis.
You can follow any comments to this entry through the RSS 2.0 feed.
Both comments and pings are currently closed.

Both are useful. For me, mxr has better search, and dxr has context-sensitive links. Which is why I wrote this quick and dirty bookmarklet which switches between mxr/dxr for the file you’re currently browsing. Not bullet proof, but still worked for me whenever the file exists on both systems: http://pastebin.mozilla.org/1648163

Please don’t disrespect Perl. Like most languages – computer or physical – it can be used or abused. Too many write it like programming shorthand and then there’s the simple lack of readability some developers can’t help but write with. That’s as much the developer’s fault as anything to do with the language itself.

Can you fix the dxr.mozilla.org -> dxr.lanedo.com redirect? I want to use dxr.mozilla.org for links in long lived places so those links will continue to work after DXR is moved to mozilla.org, but currently links with query strings break. Specifically: