Hi, folks. I wrote a bunch of Python plug-in code for GDB to
automatically display SpiderMonkey types in a meaningful way; for example:

$ gdb obj~/js
(gdb) b math_atan2
Breakpoint 1 at 0x537b42: file /home/jimb/moz/archer/js/src/jsmath.cpp, line 
215.
(gdb) run -e "Math.atan2('schnoo')"
Starting program: /home/jimb/moz/archer/js/src/obj~/js -e "Math.atan2('schnoo')"

Breakpoint 1, math_atan2 (cx=0xc31470, argc=1, vp=0x7ffff17300a0) at 
/home/jimb/moz/archer/js/src/jsmath.cpp:215
215         if (argc <= 1) {
(gdb) print vp[2]
$1 = $jsval("schnoo")
(gdb) print vp[1]
$2 = $jsval(0x7ffff1505080 [Object Math])
(gdb) print vp[0]
$3 = $jsval(0x7ffff1511d00 [Object Function "atan2"])
(gdb) 


There's similar support for random stuff like parse nodes, property
cache entries, and so on.

For a long time, these have lived at:
http://hg.mozilla.org/users/jblandy_mozilla.com/archer-mozilla/ However,
I've started putting together a patch to integrate them into the Mozilla
tree, so that anyone who uses a Python-capable GDB will get them
automatically.

Does this sound like a good idea?

Possible questions and concerns:

  * Which versions of GDB will this work with? I'm adapting the
    pretty-printers to work with the stock GDB shipped with recent
    Linuxes; no custom build should be required. Even recent Macintoshes
    seem to ship with a Python-ignorant GDB, so it shouldn't affect them.
  * What happens when a Python pretty-printer encounters an error, due
    to a bug, say? Nowadays, GDB disables the pretty-printer, so things
    degrade gracefully. I'd make sure this happens before landing anything.
  * Who can I bug when there's a problem? I volunteer to be on call for
    any GDB-Python related issues; there are some other folks on the
    team who've hacked on this as well, and I hope they'll volunteer too.
  * How are we going to keep the pretty-printers up to date with the
    current SpiderMonkey code? SpiderMonkey has changed quickly over the
    last couple of years, and the printers have been prone to bit-rot.
    Here, I'm asking to impose on the rest of you: I suspect that having
    these printers in-tree will make problems show up more quickly, so
    we can stay on top of things.

I'm picking up Bug 506717
<https://bugzilla.mozilla.org/show_bug.cgi?id=506717> for the process of
integration.

My current work in progress is at
https://github.com/jimblandy/mozilla-central. In particular, take a look
at the integrate-archer
<https://github.com/jimblandy/mozilla-central/tree/integrate-archer> branch.
_______________________________________________
dev-tech-js-engine-internals mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

Reply via email to