DXR

For a while now I’ve been working on a project to create a Mozilla Developer Resource Kit (MDRK).  After spending three years helping students get started in the Mozilla world I’ve had a few ideas how to make life for new developers coming to Mozilla a bit easier.  The MDRK is something we’ll be working on into the fall, but I wanted to share one piece of it now.

My work with Dehydra got to the point last week (see bug 435814) that it was time to make a demo–actually, Benjamin gave me the push I needed to finally get it done so he could take it with him to the GCC Developers’ Summit.  I’m not sure what the final UI for this should be, but since I had code for the MDRK to improve the front-end of MXR, I decided to hack my Dehydra SQLite database into it.  After trying several ways to partition the Mozilla type system so it was useable in GUI form, Mark Finkle suggested that I use Schrep’s Mozilla Platform diagram.  It’s not perfect, but it provided a handy way to begin.  Here’s what it looks like when you start:

Clicking one of the modules in the diagram (NOTE: SQLite, NSPR, and Cairo are C, so I don’t have Dehydra info for them yet) gives you a list of Classes, Structs, and Interfaces:

Next, you can click a type’s declaration location (in gray text to the right of the type name) to see the code, or click the type name itself to get information about its members, bases, and derived types:

I’ve got a broken implementation of “show all callers,” which should not be taken as accurate yet (i.e., clicking a member name will often give no results at this point).  However, the structure is in place to support it once I get the back-end db right.  Clicking a location for a Declaration or Definition jumps to the source:

This is the same source view you get via MXR, with the exception that I’ve altered the CSS, added context via the source tree on the left, and integrated dehydra type searches to replace ident searches where applicable.  This could be much more intelligent, but for now, clicking a type name in the source takes you to the type itself vs. doing a search:

I’ll just stress once again that this is a demo before I give you a URL, in the hopes that you’ll be gentle and constructive with your feedback: http://zenit.senecac.on.ca/wiki/dxr.

I’d appreciate if you put comments about where I’m wrong with info in the dehydra xref on bug 435814.  A huge thanks to Chris Tyler, Benjamin Smedberg, Ted Mielczarek, Taras Glek, Dave Mandelin, and the dozen odd people in #seneca who have been testing this for me.

You can also download the SQLite database here, if you want to play with the data itself.  NOTE: I’ve indexed the following reversion of mozilla-central: 572802919ad2.

This entry was posted in CDOT, Mozilla, Seneca. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

10 Comments

  1. Robert O'Callahan
    Posted June 19, 2008 at 5:53 pm | Permalink

    Looks fabulous!

  2. Blair McBride
    Posted June 19, 2008 at 6:20 pm | Permalink

    Wow… impressive!

    Will work great as a Prism App.

  3. Posted June 19, 2008 at 7:17 pm | Permalink

    Really great!
    Bookmark… er… starred :)

  4. Vlad Sukhoy
    Posted June 19, 2008 at 11:52 pm | Permalink

    Awesome!

  5. Posted June 20, 2008 at 3:29 am | Permalink

    This looks like the start of a great new tool.

    For the purposes of helping people get into the code, the big thing that seems to be lacking is documentation for the modules, classes and functions. It would take it to another level of usefulness if you could get doxygen support integrated in there too. Doxygen comments are used to document parts of the Mozilla code, and if you’re tool supported it, I’m sure that practice would spread to much of the rest of it.

    Nice work!

  6. Posted June 20, 2008 at 5:55 am | Permalink

    That’s a really useful way of navigating the code base. bookmarked it too.

    Any chance you could add /accessible to the diagram? We’d love it to be nice and visible ;-)

  7. Posted June 20, 2008 at 8:24 am | Permalink

    Hey Steve:

    Yes, bsmedberg and I want to redo the diagram, as it’s wrong (missing things like accessible) and inaccurate in places. Really and truly just something that existed and I could use in a hurry.

    Funnily enough, the test case I had as I worked on this project was accessible and nsIAccessible, nsPIAccessible, nsAccessible :)

    Dave

  8. Joshua Cranmer
    Posted June 20, 2008 at 12:27 pm | Permalink

    Looks good… hope dehydra can handle the C portions at some point as well…

    Also, you might want to look at doxygen stuff as well in addition to MDC for documentation.

  9. skierpage
    Posted June 20, 2008 at 5:22 pm | Permalink

    Wow. So, how does it go, with the tab strip and the animation?! View > Source is… somewhat bare-bones! Firebug > Inspect just shows me a bunch of empty divs.

    It must be bits of XUL, but ?? I can’t see any.js file loading a XUL file.

    Show-stopper bug: it needs a lot of work for MSIE 7 compatibility ;-)

  10. Vlad Sukhoy
    Posted June 20, 2008 at 8:54 pm | Permalink

    There is already promising work on C/objetive-C/objective-C++ frontends for xhydra on bug 421097, there’s a good chance that eventually it will handle those ;)

6 Trackbacks

  1. [...] For details, read Dave’s blog post about it. [...]

  2. By Bread and Circuits » Mozilla Summit 2008, IMHO on August 1, 2008 at 3:36 pm

    [...] DXR meet-up and planning session with Benjamin and Taras.  To say that these guys have high hopes for what it might do is an understatement.  But I think it’s all doable, and I’m pumped to get started on it again in the fall.  You know good things are coming when you see this on irc in the wee hours of the morning: “04:01 < csmedberg> woot, initial outline of dxrpy code in my hg userdir” [...]

  3. By Bread and Circuits » Reduce, Reuse, Recycle on September 8, 2008 at 10:43 pm

    [...] Friday I was working on DXR, and I realized that I take these ideas for granted so much that it becomes easy to not talk about [...]

  4. By Bread and Circuits » Tinkering with DXR on February 27, 2009 at 3:15 pm

    [...] asked me the other day if I’d setup a DXR instance for Thunderbird.  About the same time I met with Chris and Mohak to discuss his work to [...]

  5. [...] of the things I’m working on in my spare time is rewriting and extending DXR.  I’m adding more static analysis info to the data, adding a “document” style [...]

  6. [...] Dehydra is a lightweight static analysis tool for C++. It is implemented as a GCC plugin that passes C++ AST information to JavaScript code, which can examine the provided AST nodes. Among other things, Dehydra is used as the smarts behind a very cool semantic Mozilla code browser called DXR (Dehydra Cross Reference). [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>