Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Debug-only str->equals(), str->dump(), obj->dump() methods

11 views
Skip to first unread message

Jeff Walden

unread,
Feb 1, 2012, 6:00:58 PM2/1/12
to
Ever printed out a JSObject* then realized you wanted to see the object's properties and stuff? And you hit an up arrow to recall the line that printed out the object, then realized you had to move the cursor to the start of the line to insert "js_DumpObject(", then move it back to the end to add ")"? And then you got an error because you forgot the result you were testing was actually a reference, and you need to cursor back over to add a "&"? And then you went all rageface?

Rage no more.

I just added a dump() method to JSObject and JSString which does js_DumpObject or js_DumpString. (JSAtom's dump method acts like js_DumpAtom.) Then if you up-arrow, you can just type out "->dump()", no messing with cursor position. The js_Dump* methods remain, but honestly, I plan never to type them again if I can help it.

At the same time I also added a debug-only JSString::equals(const char*) method. It totally ignores OOM and all that, but if you just want to set a conditional breakpoint on "does this string have this value?", it should make things easier for you.

Anyway. These are all debug-only. Use 'em only when debugging. Enjoy.

Jeff

P.S. -- Yeah yeah, I know, archer. I'm not entirely certain if my system's debugger's new enough to use it, it apparently requires ongoing work to keep it working, and I'm still faintly old-school about this. :-)

Jim Blandy

unread,
Feb 1, 2012, 9:39:30 PM2/1/12
to dev-tech-js-en...@lists.mozilla.org
On 02/01/2012 03:00 PM, Jeff Walden wrote:
> P.S. -- Yeah yeah, I know, archer. I'm not entirely certain if my
> system's debugger's new enough to use it, it apparently requires
> ongoing work to keep it working, and I'm still faintly old-school
> about this. :-)
I'll be the first to agree that the Archer support is way more brittle
than I'd like it to be, even granted how, um, "dynamic" our data
representations have been in the last few years.

I think the solution is to put a primitive layer of interpretation in
C++, and test it from 'make check', so that people know to update it
when they change things.

However, Mozilla-archer does run on stock GDB nowadays.

0 new messages