Closed Bug 1254295 Opened 9 years ago Closed 8 years ago

gdb frame filter should compute function and script info

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: tromey, Assigned: tromey)

References

(Blocks 3 open bugs)

Details

Attachments

(3 files, 3 obsolete files)

Once the unwinder is added (see bug 1232712), we should update the included frame filter to find the function and script info and return it. I'll attach a patch that adds function info and shows where the script info should be added. I'm not 100% sure this is correct but it has at least once printed information that was useful...
Attached patch add function name to gdb frame filter (obsolete) (deleted) — Splinter Review
MozReview-Commit-ID: LJEr9sNtdMV
See https://bugzilla.mozilla.org/show_bug.cgi?id=1232712#c20 to understand what is wrong with this patch.
I've updated this patch (will attach soon) but it is still a bit wrong. It shows: #33 0x00007f0d1c475f61 in <<JitFrame_Exit>> () #34 0x00007f0cdadc5bd3 in <<JitFrame_BaselineStub>> () #35 0x00007f0c903720bc in <<JitFrame_BaselineJS "Handler.prototype.process">> () #36 0x00007f0cd8bd3e44 in <<JitFrame_BaselineStub>> () #37 0x00007f0c90483488 in <<JitFrame_BaselineJS "this.PromiseWalker.walkerLoop">> () #38 0x00007f0cd8bd3e44 in <<JitFrame_BaselineStub>> () #39 0x00007f0c90721072 in <<JitFrame_BaselineJS "bound ">> () #40 0x00007f0cd8bd3e44 in <<JitFrame_BaselineStub>> () #41 0x00007f0c90721072 in <<JitFrame_BaselineJS "bound bound ">> () #42 0x00007f0d1c474d94 in <<JitFrame_Entry "callFunctionWithAsyncStack">> () What would be correct here? I gather that these are generally off by one; does that include moving the function name from frame #35 onto frame #34? Also, "bound bound" seems pretty unfriendly and I'm wondering if there's a better way to extract the name. Currently it's using the "atom_" member of JSFunction.
Flags: needinfo?(nicolas.b.pierron)
Attached patch add function name to gdb frame filter (obsolete) (deleted) — Splinter Review
Updated for changes in final unwinder patch. MozReview-Commit-ID: LJEr9sNtdMV
Attachment #8727595 - Attachment is obsolete: true
I also tried adding arguments here, but sometimes I get strange values for numActualArgs_. For example I can easily get a trace where this is 140737488348144. I did verify in this case that the callee token claims this is a function call. When the value is correct we can now print some arguments: #6 0x00007ffff7ff20f3 in <<JitFrame_BaselineStub "f1">> (this=JSVAL_VOID, arg1=$jsval(4700)) There's also this buglet: #7 0x00007ffff7fc096b in <<JitFrame_BaselineJS <error reading variable: Cannot access memory at address 0xfff9000000000000>>> ()
(In reply to Tom Tromey :tromey from comment #5) > When the value is correct we can now print some arguments: > > #6 0x00007ffff7ff20f3 in <<JitFrame_BaselineStub "f1">> (this=JSVAL_VOID, > arg1=$jsval(4700)) Only BaselineJS and IonJS should have a calleeToken associated to them. I will look at the patch to see what might be going wrong, but the BaselineStub header are not supposed to have a JitFrameLayout. > There's also this buglet: > > #7 0x00007ffff7fc096b in <<JitFrame_BaselineJS <error reading variable: > Cannot access memory at address 0xfff9000000000000>>> () 0xfff90… is a JS::Value which is "undefined", and this is probably because you are interpreting the content of the stack as a JitFrameLayout while it is not supposed to be one. I will look at the patch.
Flags: needinfo?(nicolas.b.pierron)
(In reply to Nicolas B. Pierron [:nbp] from comment #6) > Only BaselineJS and IonJS should have a calleeToken associated to them. This happened due to moving callee information to the next frame; which is wrong, but I don't really understand what is going on here. I'll attach my WIP patch that adds arguments as well.
Attached patch add function name to gdb frame filter (obsolete) (deleted) — Splinter Review
MozReview-Commit-ID: LJEr9sNtdMV
Attachment #8729114 - Attachment is obsolete: true
Assignee: nobody → ttromey
Status: NEW → ASSIGNED
Attachment #8729575 - Attachment is obsolete: true
The patch I'm about to attach adds function names, parameters, and filenames to the backtrace. It doesn't add line numbers, as that's more complicated; I'll file a follow-up bug. It also has one hack to work around bug 987069 for now; I'll file a follow-up for this as well.
Blocks: 1254297
Comment on attachment 8806004 [details] Bug 1254295 - add function name to gdb frame filter; https://reviewboard.mozilla.org/r/89578/#review89742 ::: js/src/gdb/mozilla/unwind.py:178 (Diff revision 1) > + except gdb.MemoryError: > + function = "(could not read function name)" > + script = fptr['u']['i']['s']['script_'] > + elif tag == self.cache.CalleeToken_Script: > + script = gdb.Value(calleetoken).cast(self.cache.JSScript) > + return [function, script] nit: using a dictionary would make this easier to extend as needed. ::: js/src/gdb/mozilla/unwind.py:223 (Diff revision 1) > + calleetoken = long(this_frame['calleeToken_']) > + tag = calleetoken & 3 > + if tag != self.cache.CalleeToken_Function and tag != self.cache.CalleeToken_FunctionConstructing: > + return FrameDecorator.frame_args(self) nit: Use _decode_jitframe and test if function is None.
Attachment #8806004 - Flags: review?(nicolas.b.pierron) → review+
Attachment #8806005 - Flags: review?(nicolas.b.pierron) → review+
Comment on attachment 8806006 [details] Bug 1254295 - add "flushregs" advice to unwinder instructions; https://reviewboard.mozilla.org/r/89582/#review89754
Attachment #8806006 - Flags: review?(nicolas.b.pierron) → review+
Pushed by ttromey@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1e2587f668f4 add function name to gdb frame filter; r=nbp https://hg.mozilla.org/integration/autoland/rev/52736ea528a9 fix a few typos in JS headers; r=nbp https://hg.mozilla.org/integration/autoland/rev/5ba29d0fdd6d add "flushregs" advice to unwinder instructions; r=nbp
Blocks: 1316678
Blocks: 1316679
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: