This tree holds Python code to customize Archer, the GDB branch
extensible via Python, for debugging Mozilla. It includes printers for:

- jsval, and js::Value
- JSString, JSString *, JSAtom *, and jsid
- JSObject *, JSFunction *, and JSFunction
- js::PropertyCacheEntry and js::PCVal
- JSParseNode *, JSDefinition *, JSParseNode, JSDefinition, and JSFunctionBox *
- js::Shape

In general, pretty-printers for pointer-to-foo are summaries, and
pretty-printers for struct types show all members, unless it knows some
union branches are dead:

    (gdb) p (JSString *) $22
    $23 = 0xa0c000 "y" ATOMIZED
    (gdb) p *$23
    $24 = {mLengthAndFlags=(1 << 4)|FLAT|ATOMIZED, mChars=0xa0c010}

If a pretty-printer is misbehaving, you can say 'print/r' and that will use
the standard GDB formatting for everything.

The code is rough and incomplete at the moment. "Release early, release
often!" I'd love for others to pitch in. GDB's Python API is documented in
the GDB manual.

There are some tests in tests, with a hacked version of the SpiderMonkey
jit-tests driver.


You need to be running the latest Archer sources, available via Git.
Full instructions for checking out and building Archer are here:

I built from the archer-tromey-python branch:

  $ git clone git://
  Initialized empty Git repository in /home/jimb/archer/foo/archer/.git/
  remote: Counting objects: 331476, done.
  ... blah blah blah I am not wedged I am working hard for you ...
  $ cd archer
  $ git checkout --track -b my-branch origin/archer-tromey-python
  Branch my-branch set up to track remote branch archer-tromey-python from origin.
  Switched to a new branch 'my-branch'
  $ mkdir ../build
  $ cd ../build
  $ ../archer/configure --prefix=`cd ..; pwd`
  $ make -j8
  $ make install
  $ ../bin/gdb
  GNU gdb (GDB)

How to use these customizations

If you've put this tree in a directory named $dir (so that this file
is $dir/README), then put the following in your ~/.gdbinit file:

python import sys
python sys.path[0:0] = [$dir]
python import mozilla.autoload

There are more graceful ways to do this, but this will do for now.

Thanks To:

- Jason Orendorff, for calling lousy code what it is.