2012/8/2 Jim Blandy <[email protected]>:
> 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?

Yes! CPython has similar gdb hooks and they're really helpful.

>   * 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.

Can tests be written for them, such that engine changes that break
debugging hooks will become immediately known?

-- 
Regards,
Benjamin
_______________________________________________
dev-tech-js-engine-internals mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

Reply via email to