Title: [206693] trunk
Revision
206693
Author
[email protected]
Date
2016-09-30 16:26:48 -0700 (Fri, 30 Sep 2016)

Log Message

Web Inspector: Stepping over/out of a function sometimes resumes instead of taking you to caller
https://bugs.webkit.org/show_bug.cgi?id=162802
<rdar://problem/28569982>

Reviewed by Mark Lam.

Source/_javascript_Core:

* debugger/Debugger.cpp:
(JSC::Debugger::stepOverStatement):
(JSC::Debugger::stepOutOfFunction):
Enable stepping mode when we start stepping.

LayoutTests:

* inspector/debugger/resources/log-pause-location.js:
(TestPage.registerInitializer.createLocation):
(TestPage.registerInitializer.window.setBreakpointsOnLinesWithBreakpointComment):
Helper to set breakpoints everywhere in a file that has a BREAKPOINT comment.

* inspector/debugger/stepping/stepping-pause-in-inner-step-to-parent-expected.txt: Added.
* inspector/debugger/stepping/stepping-pause-in-inner-step-to-parent.html: Added.
Test that stepping out and over end up in the parent. Before this change
we would never have made it back into entry and the test failed.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (206692 => 206693)


--- trunk/LayoutTests/ChangeLog	2016-09-30 23:12:23 UTC (rev 206692)
+++ trunk/LayoutTests/ChangeLog	2016-09-30 23:26:48 UTC (rev 206693)
@@ -1,3 +1,21 @@
+2016-09-30  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Stepping over/out of a function sometimes resumes instead of taking you to caller
+        https://bugs.webkit.org/show_bug.cgi?id=162802
+        <rdar://problem/28569982>
+
+        Reviewed by Mark Lam.
+
+        * inspector/debugger/resources/log-pause-location.js:
+        (TestPage.registerInitializer.createLocation):
+        (TestPage.registerInitializer.window.setBreakpointsOnLinesWithBreakpointComment):
+        Helper to set breakpoints everywhere in a file that has a BREAKPOINT comment.
+
+        * inspector/debugger/stepping/stepping-pause-in-inner-step-to-parent-expected.txt: Added.
+        * inspector/debugger/stepping/stepping-pause-in-inner-step-to-parent.html: Added.
+        Test that stepping out and over end up in the parent. Before this change
+        we would never have made it back into entry and the test failed.
+
 2016-09-30  Myles C. Maxfield  <[email protected]>
 
         Implement rendering of font-variation-settings

Modified: trunk/LayoutTests/inspector/debugger/resources/log-pause-location.js (206692 => 206693)


--- trunk/LayoutTests/inspector/debugger/resources/log-pause-location.js	2016-09-30 23:12:23 UTC (rev 206692)
+++ trunk/LayoutTests/inspector/debugger/resources/log-pause-location.js	2016-09-30 23:26:48 UTC (rev 206693)
@@ -40,6 +40,28 @@
         return loadLinesFromSourceCode(WebInspector.frameResourceManager.mainFrame.mainResource);
     }
 
+    window.setBreakpointsOnLinesWithBreakpointComment = function(resource) {
+        if (!resource)
+            resource = WebInspector.frameResourceManager.mainFrame.mainResource;
+
+        function createLocation(resource, lineNumber, columnNumber) {
+            return {url: resource.url, lineNumber, columnNumber};
+        }
+
+        let promises = [];
+
+        for (let i = 0; i < lines.length; ++i) {
+            let line = lines[i];
+            if (/BREAKPOINT/.test(line)) {
+                let lastPathComponent = parseURL(resource.url).lastPathComponent;
+                InspectorTest.log(`Setting Breakpoint: ${lastPathComponent}:${i}:0`);
+                promises.push(DebuggerAgent.setBreakpointByUrl.invoke({url: resource.url, lineNumber: i, columnNumber: 0}));
+            }
+        }
+
+        return Promise.all(promises);
+    }
+
     window.logResolvedBreakpointLinesWithContext = function(inputLocation, resolvedLocation, context) {
         if (resolvedLocation.sourceCode !== linesSourceCode && !WebInspector.frameResourceManager.mainFrame.mainResource.scripts.includes(resolvedLocation.sourceCode)) {
             InspectorTest.log("--- Source Unavailable ---");

Added: trunk/LayoutTests/inspector/debugger/stepping/stepping-pause-in-inner-step-to-parent-expected.txt (0 => 206693)


--- trunk/LayoutTests/inspector/debugger/stepping/stepping-pause-in-inner-step-to-parent-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/debugger/stepping/stepping-pause-in-inner-step-to-parent-expected.txt	2016-09-30 23:26:48 UTC (rev 206693)
@@ -0,0 +1,106 @@
+Checking pause locations when pausing inside a function and stepping through to the outer function.
+
+Setting Breakpoint: stepping-pause-in-inner-step-to-parent.html:11:0
+
+== Running test suite: Debugger.stepping.inner-to-outer
+-- Running test case: Debugger.stepping.inner-to-outer.StepIn
+_expression_: setTimeout(entry)
+STEPS: in, in, resume
+PAUSED (breakpoint)
+PAUSE AT pause:12:5
+      8    }
+      9    
+     10    function pause() {
+ ->  11        |var x; // BREAKPOINT
+     12    }
+     13    
+     14    // ---------
+
+ACTION: step-in
+PAUSE AT pause:13:2
+      9    
+     10    function pause() {
+     11        var x; // BREAKPOINT
+ ->  12    }|
+     13    
+     14    // ---------
+     15    
+
+ACTION: step-in
+PAUSE AT entry:9:2
+      5    <script>
+      6    function entry() {
+      7        pause();
+ ->   8    }|
+      9    
+     10    function pause() {
+     11        var x; // BREAKPOINT
+
+ACTION: resume
+RESUMED
+PASS: Should have used all steps.
+
+-- Running test case: Debugger.stepping.inner-to-outer.StepOver
+_expression_: setTimeout(entry)
+STEPS: over, over, resume
+PAUSED (breakpoint)
+PAUSE AT pause:12:5
+      8    }
+      9    
+     10    function pause() {
+ ->  11        |var x; // BREAKPOINT
+     12    }
+     13    
+     14    // ---------
+
+ACTION: step-over
+PAUSE AT pause:13:2
+      9    
+     10    function pause() {
+     11        var x; // BREAKPOINT
+ ->  12    }|
+     13    
+     14    // ---------
+     15    
+
+ACTION: step-over
+PAUSE AT entry:9:2
+      5    <script>
+      6    function entry() {
+      7        pause();
+ ->   8    }|
+      9    
+     10    function pause() {
+     11        var x; // BREAKPOINT
+
+ACTION: resume
+RESUMED
+PASS: Should have used all steps.
+
+-- Running test case: Debugger.stepping.inner-to-outer.StepOut
+_expression_: setTimeout(entry)
+STEPS: out, resume
+PAUSED (breakpoint)
+PAUSE AT pause:12:5
+      8    }
+      9    
+     10    function pause() {
+ ->  11        |var x; // BREAKPOINT
+     12    }
+     13    
+     14    // ---------
+
+ACTION: step-out
+PAUSE AT entry:9:2
+      5    <script>
+      6    function entry() {
+      7        pause();
+ ->   8    }|
+      9    
+     10    function pause() {
+     11        var x; // BREAKPOINT
+
+ACTION: resume
+RESUMED
+PASS: Should have used all steps.
+

Added: trunk/LayoutTests/inspector/debugger/stepping/stepping-pause-in-inner-step-to-parent.html (0 => 206693)


--- trunk/LayoutTests/inspector/debugger/stepping/stepping-pause-in-inner-step-to-parent.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/debugger/stepping/stepping-pause-in-inner-step-to-parent.html	2016-09-30 23:26:48 UTC (rev 206693)
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+function entry() {
+    pause();
+}
+
+function pause() {
+    var x; // BREAKPOINT
+}
+
+// ---------
+
+function test()
+{
+    InspectorTest.debug();
+
+    let suite = InspectorTest.createAsyncSuite("Debugger.stepping.inner-to-outer");
+
+    window.initializeSteppingTestSuite(suite);
+
+    addSteppingTestCase({
+        name: "Debugger.stepping.inner-to-outer.StepIn",
+        description: "Should be able to leave an inner function via step-in and end up in the caller.",
+        _expression_: "setTimeout(entry)",
+        steps: [
+            // breakpoint
+            "in", // leaving pause
+            "in", // leaving entry
+            "resume",
+        ]
+    });
+
+    addSteppingTestCase({
+        name: "Debugger.stepping.inner-to-outer.StepOver",
+        description: "Should be able to leave an inner function via step-over and end up in the caller.",
+        _expression_: "setTimeout(entry)",
+        steps: [
+            // breakpoint
+            "over", // leaving pause
+            "over", // leaving entry
+            "resume",
+        ]
+    });
+
+    addSteppingTestCase({
+        name: "Debugger.stepping.inner-to-outer.StepOut",
+        description: "Should be able to leave an inner function via step-out and end up in the caller.",
+        _expression_: "setTimeout(entry)",
+        steps: [
+            // breakpoint
+            "out", // out of pause, should end up in entry
+            "resume",
+        ]
+    });
+
+    loadMainPageContent().then(() => {
+        setBreakpointsOnLinesWithBreakpointComment().then(() => {
+            suite.runTestCasesAndFinish();
+        });
+    });
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Checking pause locations when pausing inside a function and stepping through to the outer function.</p>
+</body>
+</html>

Modified: trunk/Source/_javascript_Core/ChangeLog (206692 => 206693)


--- trunk/Source/_javascript_Core/ChangeLog	2016-09-30 23:12:23 UTC (rev 206692)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-09-30 23:26:48 UTC (rev 206693)
@@ -1,3 +1,16 @@
+2016-09-30  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Stepping over/out of a function sometimes resumes instead of taking you to caller
+        https://bugs.webkit.org/show_bug.cgi?id=162802
+        <rdar://problem/28569982>
+
+        Reviewed by Mark Lam.
+
+        * debugger/Debugger.cpp:
+        (JSC::Debugger::stepOverStatement):
+        (JSC::Debugger::stepOutOfFunction):
+        Enable stepping mode when we start stepping.
+
 2016-09-30  Filip Pizlo  <[email protected]>
 
         B3::moveConstants should be able to edit code to minimize the number of constants

Modified: trunk/Source/_javascript_Core/debugger/Debugger.cpp (206692 => 206693)


--- trunk/Source/_javascript_Core/debugger/Debugger.cpp	2016-09-30 23:12:23 UTC (rev 206692)
+++ trunk/Source/_javascript_Core/debugger/Debugger.cpp	2016-09-30 23:26:48 UTC (rev 206693)
@@ -638,6 +638,7 @@
         return;
 
     m_pauseOnCallFrame = m_currentCallFrame;
+    setSteppingMode(SteppingModeEnabled);
     notifyDoneProcessingDebuggerEvents();
 }
 
@@ -649,6 +650,7 @@
     VMEntryFrame* topVMEntryFrame = m_vm.topVMEntryFrame;
     m_pauseOnCallFrame = m_currentCallFrame ? m_currentCallFrame->callerFrame(topVMEntryFrame) : nullptr;
     m_pauseOnStepOut = true;
+    setSteppingMode(SteppingModeEnabled);
     notifyDoneProcessingDebuggerEvents();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to