Closed Bug 822563 Opened 7 years ago Closed 7 years ago

JS GDB pretty-printers: pretty-print JSObject & values

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla20

People

(Reporter: jimb, Assigned: jimb)

Details

Attachments

(1 file, 2 obsolete files)

The GDB pretty-printer should pretty-print references to JSObject instances (including instances of classes derived from JSObject).

That is, instead of this:
$16 = (js::ScopeObject &) @0x7ffff152fc40: {<JSObject> = {<js::ObjectImpl> = {<js::gc::Cell> = {<No data fields>}, shape_ = 0x7ffff15210d8, type_ = 0x7ffff151f040, slots = 0x0, elements = 0xc00510}, }, }

we should get this:
$16 = (js::ScopeObject &) @0x7ffff152fc40: [object Call]
Attachment #693262 - Flags: review?(sphink)
New patch; original included stray changes from other work.
Assignee: general → jimb
Attachment #693262 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #693262 - Flags: review?(sphink)
Attachment #693263 - Flags: review?(sphink)
One more try. I was careless in the pretty-printer lookup cleanup. Includes a regression test.
Attachment #693263 - Attachment is obsolete: true
Attachment #693263 - Flags: review?(sphink)
Attachment #693266 - Flags: review?(sphink)
Comment on attachment 693266 [details] [diff] [review]
Pretty-print references to JSObject and its subclasses.

Review of attachment 693266 [details] [diff] [review]:
-----------------------------------------------------------------

This worked out pretty nicely, unless there's something horrible I'm missing when eyeballing this.

::: js/src/gdb/mozilla/prettyprinters.py
@@ +312,4 @@
>  class Pointer(object):
>      def __new__(cls, value, cache):
>          # Don't try to provide pretty-printers for NULL pointers.
> +        if value.type.code == gdb.TYPE_CODE_PTR and value == 0: return None

nit: I like the same-line return for very short conditionals, but I find this one hard to spot.
Attachment #693266 - Flags: review?(sphink) → review+
Thanks for the review! I changed the same-line return.

https://hg.mozilla.org/integration/mozilla-inbound/rev/6b17e37a0762
Flags: in-testsuite+
Target Milestone: --- → mozilla20
(Clearing target milestone & in-testsuite for the moment, due to backout.)
(Incidentally: you don't have to bother setting Target Milestone when pushing to mozilla-inbound -- our merge-inbound-to-central-and-comment-on-all-the-bugs tool will automatically will do that for you, I'm told.)
Flags: in-testsuite+ → in-testsuite?
Target Milestone: mozilla20 → ---
"Surely this won't need a try push."
Okay, that try run looks clean. Landing again:
https://hg.mozilla.org/integration/mozilla-inbound/rev/723e403c36b1
Flags: in-testsuite? → in-testsuite+
https://hg.mozilla.org/mozilla-central/rev/723e403c36b1
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
You need to log in before you can comment on or make changes to this bug.