Closed Bug 1007383 Opened 6 years ago Closed 6 years ago

Incomplete console stack traces for asm.js code

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla32

People

(Reporter: azakai, Assigned: luke)

Details

Attachments

(3 files, 1 obsolete file)

Attached file a.html
The testcase throws an exception. In the console, it shows up ok as

uncaught exception: abort() at stackTrace@file:///home/alon/Dev/emscripten/a.html:2328:7
abort@file:///home/alon/Dev/emscripten/a.html:9735:3
enlargeMemory@file:///home/alon/Dev/emscripten/a.html:2347:3
Runtime.dynamicAlloc@file:///home/alon/Dev/emscripten/a.html:1800:159
_sbrk@file:///home/alon/Dev/emscripten/a.html:2702:23
_malloc@file:///home/alon/Dev/emscripten/a.html:7480:21
__Z3f10v [f10()]@file:///home/alon/Dev/emscripten/a.html:6115:11
__Z2f9v [f9()]@file:///home/alon/Dev/emscripten/a.html:6123:2
__Z2f8v [f8()]@file:///home/alon/Dev/emscripten/a.html:6129:2
__Z2f7v [f7()]@file:///home/alon/Dev/emscripten/a.html:6135:2
__Z2f6v [f6()]@file:///home/alon/Dev/emscripten/a.html:6141:2
__Z2f5v [f5()]@file:///home/alon/Dev/emscripten/a.html:6147:2
__Z2f4v [f4()]@file:///home/alon/Dev/emscripten/a.html:6153:2
__Z2f3v [f3()]@file:///home/alon/Dev/emscripten/a.html:6159:2
__Z2f2v [f2()]@file:///home/alon/Dev/emscripten/a.html:6165:2
__Z2f1v [f1()]@file:///home/alon/Dev/emscripten/a.html:6171:2
__Z2f0v [f0()]@file:///home/alon/Dev/emscripten/a.html:6177:2
_main@file:///home/alon/Dev/emscripten/a.html:6185:2
callMain@file:///home/alon/Dev/emscripten/a.html:9626:9
doRun@file:///home/alon/Dev/emscripten/a.html:9683:7
run/<@file:///home/alon/Dev/emscripten/a.html:9695:19

but, the console stack trace, when I click to expand it, shows only

Module.printErr() a.html:1245
abort() a.html:9727
enlargeMemory() a.html:2347
Runtime.dynamicAlloc() a.html:1800
_sbrk() a.html:2702
callMain() a.html:9626
doRun() a.html:9683
run/<()

So between callMain and _sbrk, there should be lots of functions, but they were ignored.
This may well be an Odin bug; we may not be printing the right function string in a way that throws off the console.log stack-trace parser.
With asm.js disabled, the stack trace shows up ok, and when enabled, exactly the asm frames are lost.
Ahh, so console.log uses JS::DescribeStack which uses a NonBuiltinScriptFrameIter which skips the asm.js frames when asm.js is enabled.  I meant to update this one but forgot; shouldn't be too hard.
Component: Developer Tools: Console → JavaScript Engine
Product: Firefox → Core
Assignee: nobody → luke
Attached patch fix-stackSplinter Review
Attachment #8419712 - Flags: review?(jdemooij)
Attached file test.html (obsolete) —
Ideally, I'd like to add a testcase that verifies that console.error output contains the asm.js frames.  Here's a trivial testcase, but I don't know how to test the console.error output.  Rob, do you suppose you could point me to a mochitest that I could copy or a person who could help me write such a test?
Flags: needinfo?(rcampbell)
Comment on attachment 8419712 [details] [diff] [review]
fix-stack

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

(The commit message appears to be for another bug.)

::: js/src/vm/OldDebugAPI.cpp
@@ +904,3 @@
>  {
> +    if (iter.isFunctionFrame())
> +        funDisplayName_ = iter.functionDisplayAtom();

Was wondering about initializing funDisplayName_ to nullptr in the non-function case, but it's a Heap<T> so initialized to null. Yay constructors.
Attachment #8419712 - Flags: review?(jdemooij) → review+
(In reply to Luke Wagner [:luke] (on partial PTO) from comment #5)
> Created attachment 8419715 [details]
> test.html
> 
> Ideally, I'd like to add a testcase that verifies that console.error output
> contains the asm.js frames.  Here's a trivial testcase, but I don't know how
> to test the console.error output.  Rob, do you suppose you could point me to
> a mochitest that I could copy or a person who could help me write such a
> test?

check http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/webconsole/test/

e.g., test_consoleapi.html

They have some examples for tests of our console API.

Front end tests live in browser/devtools/webconsole/test and there are a bunch of them. Grepping for console.error should find you something pertinent.

Find me in IRC today if you need some help digging.
Flags: needinfo?(rcampbell)
Attached patch stack-testsSplinter Review
Thanks, that helps a lot!  Can I just add this here?
Attachment #8419715 - Attachment is obsolete: true
Attachment #8422072 - Flags: review?(rcampbell)
(In reply to Luke Wagner [:luke] (on partial PTO) from comment #8)
> Created attachment 8422072 [details] [diff] [review]
> stack-tests
> 
> Thanks, that helps a lot!  Can I just add this here?

sure you can!
Attachment #8422072 - Flags: review?(rcampbell) → review+
https://hg.mozilla.org/mozilla-central/rev/b8533fbcc811
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
QA Whiteboard: [good first verify]
You need to log in before you can comment on or make changes to this bug.