Title: [163363] trunk/LayoutTests
Revision
163363
Author
[email protected]
Date
2014-02-03 21:10:04 -0800 (Mon, 03 Feb 2014)

Log Message

Need regression test for the debugger modifying locals in a DFG frame.
https://bugs.webkit.org/show_bug.cgi?id=128120.

Reviewed by Geoffrey Garen.

Regression test for https://bugs.webkit.org/show_bug.cgi?id=128112.

This test does the following:
1. Warm up a DFG function.
2. Sets a breakpoint in a function breakpointBasic() that will be called
   by the DFG function, but has never been called yet.
3. Call a driver function which in turn calls the DFG function, and expect
   the debugger to break.
4. At the breakpoint in breakpointBasic(), evaluate an _expression_ on its
   caller i.e. the DFG function, and change a local variable in it.
5. Resume from the debugger, and let the DFG function and its driver
   function run to completion. The DFG function will return a value
   computed using the modified local.
6. At the end of the driver function, verify that the returned computed
   value reflects the modified value.

This test has been verified with tracing enabled to ensure that the test
DFG function was indeed DFG compiled, and that the test passed with the
expected results.

* inspector-protocol/debugger/resources/breakpoint.js:
(notInlineable2):
(dfgWithoutInline2):
(callNotInlineable2):
* inspector-protocol/debugger/setBreakpoint-dfg-and-modify-local-expected.txt: Added.
* inspector-protocol/debugger/setBreakpoint-dfg-and-modify-local.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (163362 => 163363)


--- trunk/LayoutTests/ChangeLog	2014-02-04 05:05:43 UTC (rev 163362)
+++ trunk/LayoutTests/ChangeLog	2014-02-04 05:10:04 UTC (rev 163363)
@@ -1,5 +1,39 @@
 2014-02-03  Mark Lam  <[email protected]>
 
+        Need regression test for the debugger modifying locals in a DFG frame.
+        https://bugs.webkit.org/show_bug.cgi?id=128120.
+
+        Reviewed by Geoffrey Garen.
+
+        Regression test for https://bugs.webkit.org/show_bug.cgi?id=128112.
+
+        This test does the following:
+        1. Warm up a DFG function.
+        2. Sets a breakpoint in a function breakpointBasic() that will be called
+           by the DFG function, but has never been called yet.
+        3. Call a driver function which in turn calls the DFG function, and expect
+           the debugger to break.
+        4. At the breakpoint in breakpointBasic(), evaluate an _expression_ on its
+           caller i.e. the DFG function, and change a local variable in it.
+        5. Resume from the debugger, and let the DFG function and its driver
+           function run to completion. The DFG function will return a value
+           computed using the modified local.
+        6. At the end of the driver function, verify that the returned computed
+           value reflects the modified value.
+
+        This test has been verified with tracing enabled to ensure that the test
+        DFG function was indeed DFG compiled, and that the test passed with the
+        expected results.
+
+        * inspector-protocol/debugger/resources/breakpoint.js:
+        (notInlineable2):
+        (dfgWithoutInline2):
+        (callNotInlineable2):
+        * inspector-protocol/debugger/setBreakpoint-dfg-and-modify-local-expected.txt: Added.
+        * inspector-protocol/debugger/setBreakpoint-dfg-and-modify-local.html: Added.
+
+2014-02-03  Mark Lam  <[email protected]>
+
         Need regression test to ensure that the debugger does not attempt to execute a bad script from its console.
         <https://webkit.org/b/128121>
 

Modified: trunk/LayoutTests/inspector-protocol/debugger/resources/breakpoint.js (163362 => 163363)


--- trunk/LayoutTests/inspector-protocol/debugger/resources/breakpoint.js	2014-02-04 05:05:43 UTC (rev 163362)
+++ trunk/LayoutTests/inspector-protocol/debugger/resources/breakpoint.js	2014-02-04 05:10:04 UTC (rev 163363)
@@ -56,3 +56,29 @@
         result += inliningFoo(i);
     log("dfgWithInline result: " + result);    
 }
+
+function notInlineable2(x, callFunctionWithBreakpoint)
+{
+    var func = new Function("return x + 100;");
+    if (callFunctionWithBreakpoint)
+        breakpointBasic();
+    return x + 3;
+}
+
+function dfgWithoutInline2()
+{
+    var i;
+    var result = 0;
+    for (i = 0; i < 1000; i++)
+        result += notInlineable2(i, false);
+    log("result: " + result);
+}
+
+function callNotInlineable2()
+{
+    var result = notInlineable2(10000, true);
+    if (result == 20003)
+        log("PASS: result is " + result);
+    else
+        log("FAIL: result is " + result + ", expecting 20003");
+}

Added: trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-dfg-and-modify-local-expected.txt (0 => 163363)


--- trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-dfg-and-modify-local-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-dfg-and-modify-local-expected.txt	2014-02-04 05:10:04 UTC (rev 163363)
@@ -0,0 +1,14 @@
+Debugger.evaluateOnCallFrame in a DFG compiled functions.
+
+Found breakpoint.js
+result: 502500
+dfg function warmed up
+
+Breakpoint set in breakpointBasic()
+Hit Breakpoint!
+Evaluating in DFG frame at frame[1]: 'x = 20000;'
+Resumed from breakpoint
+inside breakpointBasic
+PASS: result is 20003
+Test complete
+

Added: trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-dfg-and-modify-local.html (0 => 163363)


--- trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-dfg-and-modify-local.html	                        (rev 0)
+++ trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-dfg-and-modify-local.html	2014-02-04 05:10:04 UTC (rev 163363)
@@ -0,0 +1,72 @@
+<html>
+<head>
+<script src=""
+<script src=""
+
+<script>
+// Put this here instead of on <body onload> to prevent an extra Debugger.scriptParsed event.
+window._onload_ = runTest;
+
+function test()
+{
+    // This test setting 2 breakpoints in DFG compiled functions: one inlined,
+    // and one not inlined.
+
+    InspectorTest.sendCommand("Debugger.enable", {});
+
+    var breakpointId = null;
+    var scriptId = 0;
+    var startLine = 0;
+
+    InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
+    {
+        if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
+            InspectorTest.log("Found breakpoint.js");
+            scriptId = messageObject.params.scriptId;
+            startLine = messageObject.params.startLine;
+
+            InspectorTest.sendCommand("Runtime.evaluate", {
+                _expression_: "dfgWithoutInline2();"
+            }, function(responseObject) {
+                InspectorTest.log("dfg function warmed up\n");
+
+                var location1 = {scriptId: scriptId, lineNumber: 2, columnNumber: 0};
+
+                InspectorTest.sendCommand("Debugger.setBreakpoint", {location: location1}, function(responseObject) {
+                    InspectorTest.checkForError(responseObject);
+                    InspectorTest.log("Breakpoint set in breakpointBasic()");
+
+                    breakpointId = responseObject.result.breakpointId;
+                    InspectorTest.sendCommand("Runtime.evaluate", {
+                        _expression_: "callNotInlineable2();"
+                    }, function(responseObject) {
+                        InspectorTest.log("Test complete");
+                        InspectorTest.completeTest();
+                    });
+                });
+            });
+        }
+    }
+
+    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    {
+        InspectorTest.log("Hit Breakpoint!");
+        var callFrames = messageObject.params.callFrames;
+        if (callFrames.length < 3)
+            InspectorTest.log("FAIL: too few frames in stack trace");
+
+        var callFrameId = callFrames[1].callFrameId;
+        InspectorTest.log("Evaluating in DFG frame at frame[1]: 'x = 20000;'");
+        InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", { callFrameId: callFrameId, _expression_: "x = 20000;" }, function(responseObject) {
+            InspectorTest.sendCommand("Debugger.resume", {}, function(responseObject) {
+                InspectorTest.log("Resumed from breakpoint");
+            });
+        });
+    }
+}
+</script>
+</head>
+<body>
+<p>Debugger.evaluateOnCallFrame in a DFG compiled functions.</p>
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to