Closed
Bug 1139235
Opened 10 years ago
Closed 9 years ago
Single-stepping through a switch statement should always directly jump to the right case
Categories
(DevTools :: Debugger, defect)
DevTools
Debugger
Tracking
(firefox45 fixed)
VERIFIED
FIXED
Firefox 45
Tracking | Status | |
---|---|---|
firefox45 | --- | fixed |
People
(Reporter: till, Assigned: tromey)
References
Details
Attachments
(1 file, 6 obsolete files)
(deleted),
patch
|
tromey
:
review+
|
Details | Diff | Splinter Review |
Currently, whether we directly switch to the right `case` or not depends on how we're treating the `switch` internally. If it's sparse, single-stepping stops at every `case` until finally the right one is reached. If it's dense, we do the right thing.
This makes debugging Shumway's main interpreter loop close to impossible, causing me to frequently switch to Chrome :(
Assignee | ||
Comment 1•10 years ago
|
||
This seems fine to me, except for the situation where the case expression is not a literal.
In that situation it seems like one might reasonably want to step through the case.
I didn't look at Shumway to see what is done there.
Bug 1003554 is related.
There, the current plan is to restrict entry points to offsets that have an explicit
entry in the line table.
Given that bug, one approach to fixing this one would be to change BytecodeEmitter.cpp:EmitSwitch
to avoid emitting a line note for a "case" if the case's expression is a literal.
Assignee: nobody → ttromey
Depends on: 1003554
Reporter | ||
Comment 2•10 years ago
|
||
(In reply to Tom Tromey :tromey from comment #1)
> This seems fine to me, except for the situation where the case expression is
> not a literal.
> In that situation it seems like one might reasonably want to step through
> the case.
Agreed.
> I didn't look at Shumway to see what is done there.
We only use literals as case expressions, so this doesn't apply to Shumway.
Assignee | ||
Comment 3•10 years ago
|
||
Here's a patch. It requires the patches from the other bugs,
specifically 1003554.
Assignee | ||
Comment 4•10 years ago
|
||
Rebased and updated for bytecode emitter changes.
Attachment #8573260 -
Attachment is obsolete: true
Assignee | ||
Updated•10 years ago
|
Attachment #8588047 -
Flags: review?(jimb)
Comment 5•9 years ago
|
||
Comment on attachment 8588047 [details] [diff] [review]
don't set line for literal case expressions
Review of attachment 8588047 [details] [diff] [review]:
-----------------------------------------------------------------
Jim agreed on IRC to pass this review on to me.
Attachment #8588047 -
Flags: review?(jimb) → review?(nfitzgerald)
Comment 6•9 years ago
|
||
Comment on attachment 8588047 [details] [diff] [review]
don't set line for literal case expressions
Review of attachment 8588047 [details] [diff] [review]:
-----------------------------------------------------------------
r=me with comments addressed
::: js/src/frontend/BytecodeEmitter.cpp
@@ +6860,5 @@
> return true;
> }
>
> bool
> +BytecodeEmitter::emitTree(ParseNode* pn, bool suppressLine)
Magical bool parameters at the end of arguments lists kinda suck. It is annoying to tell what's going on at call sites, unless you add /* supressLine = */ comments, which also suck to author. I would prefer an enum class, but if you think it's overkill I'm not going to cry foul.
::: js/src/jit-test/tests/debug/Frame-onStep-14.js
@@ +5,5 @@
> +g.eval('function bob() { return "bob"; }');
> +
> +// Stepping into a sparse switch should not stop on literal cases.
> +g.eval(`function lit(x) {
> + debugger; // +0
Rather than checking line deltas, you can use the `evaluate` function to give the source a sane starting line number (such as 1). You can run the js shell and do help(evaluate) for docs on the function.
@@ +7,5 @@
> +// Stepping into a sparse switch should not stop on literal cases.
> +g.eval(`function lit(x) {
> + debugger; // +0
> + switch(x) { // +1
> + case "bob": // +2
Can you add other cases, so we can verify that they get skipped past without requiring multiple steps?
Attachment #8588047 -
Flags: review?(nfitzgerald) → review+
Assignee | ||
Comment 7•9 years ago
|
||
Updated according to review.
Attachment #8588047 -
Attachment is obsolete: true
Assignee | ||
Comment 8•9 years ago
|
||
I overlooked changing a parameter name in BytecodeEmitter.h.
Attachment #8608107 -
Attachment is obsolete: true
Assignee | ||
Updated•9 years ago
|
Attachment #8608112 -
Flags: review+
Assignee | ||
Updated•9 years ago
|
Attachment #8668028 -
Flags: review+
Assignee | ||
Comment 10•9 years ago
|
||
Operator at end of line.
Attachment #8668028 -
Attachment is obsolete: true
Assignee | ||
Updated•9 years ago
|
Attachment #8669048 -
Flags: review+
Assignee | ||
Updated•9 years ago
|
Attachment #8677558 -
Flags: review+
Assignee | ||
Comment 12•9 years ago
|
||
Assignee | ||
Updated•9 years ago
|
Keywords: checkin-needed
Comment 13•9 years ago
|
||
Keywords: checkin-needed
Comment 14•9 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox45:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 45
Comment 15•9 years ago
|
||
I can confirm that it's working in today's Nightly.
Sebastian
Status: RESOLVED → VERIFIED
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•