Title: [169221] trunk
- Revision
- 169221
- Author
- [email protected]
- Date
- 2014-05-22 14:40:21 -0700 (Thu, 22 May 2014)
Log Message
REGRESSION(r154797): Debugger crashes when stepping over an uncaught exception.
<https://webkit.org/b/133182>
Reviewed by Oliver Hunt.
Source/_javascript_Core:
Before r154797, we used to clear the VM exception before calling into the
debugger. After r154797, we don't. This patch will restore this clearing
of the exception before calling into the debugger.
Also added assertions after returning from calls into the debugger to
ensure that the debugger did not introduce any exceptions.
* interpreter/Interpreter.cpp:
(JSC::unwindCallFrame):
(JSC::Interpreter::unwind):
(JSC::Interpreter::debug):
- Fixed the assertion here. Interpreter::debug() should never be called
with a pending exception. Debugger callbacks for exceptions should be
handled by Interpreter::unwind() and Interpreter::unwindCallFrame().
LayoutTests:
* inspector-protocol/debugger/regress-133182-expected.txt: Added.
* inspector-protocol/debugger/regress-133182.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (169220 => 169221)
--- trunk/LayoutTests/ChangeLog 2014-05-22 21:37:38 UTC (rev 169220)
+++ trunk/LayoutTests/ChangeLog 2014-05-22 21:40:21 UTC (rev 169221)
@@ -1,3 +1,13 @@
+2014-05-22 Mark Lam <[email protected]>
+
+ REGRESSION(r154797): Debugger crashes when stepping over an uncaught exception.
+ <https://webkit.org/b/133182>
+
+ Reviewed by Oliver Hunt.
+
+ * inspector-protocol/debugger/regress-133182-expected.txt: Added.
+ * inspector-protocol/debugger/regress-133182.html: Added.
+
2014-05-22 Michał Pakuła vel Rutka <[email protected]>
Unreviewed EFL gardening
Added: trunk/LayoutTests/inspector-protocol/debugger/regress-133182-expected.txt (0 => 169221)
--- trunk/LayoutTests/inspector-protocol/debugger/regress-133182-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector-protocol/debugger/regress-133182-expected.txt 2014-05-22 21:40:21 UTC (rev 169221)
@@ -0,0 +1,48 @@
+CONSOLE MESSAGE: line 48: [1] Testing statement '({}).a.b.c.d;'
+CONSOLE MESSAGE: line 49: [1] Paused and about to step
+CONSOLE MESSAGE: line 61: [1] Resumed
+CONSOLE MESSAGE: line 53: [1] Paused after stepping
+CONSOLE MESSAGE: line 61: [1] Resumed
+CONSOLE MESSAGE: line 1: TypeError: undefined is not an object (evaluating '({}).a.b')
+CONSOLE MESSAGE: line 48: [2] Testing statement 'exceptionBasic();'
+CONSOLE MESSAGE: line 49: [2] Paused and about to step
+CONSOLE MESSAGE: line 61: [2] Resumed
+CONSOLE MESSAGE: line 53: [2] Paused after stepping
+CONSOLE MESSAGE: line 61: [2] Resumed
+CONSOLE MESSAGE: line 3: TypeError: undefined is not an object (evaluating '({}).a.b')
+CONSOLE MESSAGE: line 48: [3] Testing statement 'exceptionDOM();'
+CONSOLE MESSAGE: line 49: [3] Paused and about to step
+CONSOLE MESSAGE: line 61: [3] Resumed
+CONSOLE MESSAGE: line 53: [3] Paused after stepping
+CONSOLE MESSAGE: line 61: [3] Resumed
+CONSOLE MESSAGE: line 8: NotFoundError: DOM Exception 8: An attempt was made to reference a Node in a context where it does not exist.
+CONSOLE MESSAGE: line 48: [4] Testing statement 'exceptionInHostFunction();'
+CONSOLE MESSAGE: line 49: [4] Paused and about to step
+CONSOLE MESSAGE: line 61: [4] Resumed
+CONSOLE MESSAGE: line 53: [4] Paused after stepping
+CONSOLE MESSAGE: line 61: [4] Resumed
+CONSOLE MESSAGE: line 24: exception in host function
+CONSOLE MESSAGE: line 48: [5] Testing statement 'throwString();'
+CONSOLE MESSAGE: line 49: [5] Paused and about to step
+CONSOLE MESSAGE: line 61: [5] Resumed
+CONSOLE MESSAGE: line 53: [5] Paused after stepping
+CONSOLE MESSAGE: line 61: [5] Resumed
+CONSOLE MESSAGE: line 13: exception string
+CONSOLE MESSAGE: line 48: [6] Testing statement 'throwParam({x:1});'
+CONSOLE MESSAGE: line 49: [6] Paused and about to step
+CONSOLE MESSAGE: line 61: [6] Resumed
+CONSOLE MESSAGE: line 53: [6] Paused after stepping
+CONSOLE MESSAGE: line 61: [6] Resumed
+CONSOLE MESSAGE: line 18: [object Object]
+CONSOLE MESSAGE: line 48: [7] Testing statement 'throwParam(new Error('error message'));'
+CONSOLE MESSAGE: line 49: [7] Paused and about to step
+CONSOLE MESSAGE: line 61: [7] Resumed
+CONSOLE MESSAGE: line 53: [7] Paused after stepping
+CONSOLE MESSAGE: line 61: [7] Resumed
+CONSOLE MESSAGE: line 18: Error: error message
+Regression test for https://bugs.webkit.org/show_bug.cgi?id=133182
+
+Stepping after breaking on uncaught exceptions should not crash
+
+PASS - paused for each uncaught exception
+
Added: trunk/LayoutTests/inspector-protocol/debugger/regress-133182.html (0 => 169221)
--- trunk/LayoutTests/inspector-protocol/debugger/regress-133182.html (rev 0)
+++ trunk/LayoutTests/inspector-protocol/debugger/regress-133182.html 2014-05-22 21:40:21 UTC (rev 169221)
@@ -0,0 +1,78 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+function test()
+{
+ var expectPause = false;
+ var isStepping = false;
+
+ var testIndex = 0;
+ var statementsWithUncaughtExceptions = [
+ "({}).a.b.c.d;",
+ "exceptionBasic();",
+ "exceptionDOM();",
+ "exceptionInHostFunction();",
+ "throwString();",
+ "throwParam({x:1});",
+ "throwParam(new Error('error message'));"
+ ];
+
+ function triggerNextUncaughtException()
+ {
+
+ // Evaluate statement and expect to pause.
+ if (testIndex < statementsWithUncaughtExceptions.length) {
+ var statement = statementsWithUncaughtExceptions[testIndex++];
+ InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { " + statement + " }, 0);"});
+ return;
+ }
+
+ // Done evaluating statements to pause. Evaluate some more we do not expect to pause.
+ InspectorTest.log("PASS - paused for each uncaught exception");
+ InspectorTest.completeTest();
+ }
+
+
+ InspectorTest.sendCommand("Debugger.enable", {});
+ InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "uncaught"}, function(responseObject) {
+ InspectorTest.checkForError(responseObject);
+ expectPause = true;
+ triggerNextUncaughtException();
+ });
+
+ InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+ {
+ if (!expectPause) {
+ InspectorTest.log("FAIL - debugger paused when we did not expect to");
+ InspectorTest.completeTest();
+ return;
+ }
+
+ if (!isStepping) {
+ console.log("[" + testIndex + "] Testing statement '" + statementsWithUncaughtExceptions[testIndex - 1] + "'");
+ console.log("[" + testIndex + "] Paused and about to step");
+ isStepping = true;
+ InspectorTest.sendCommand("Debugger.stepOver", {});
+ } else {
+ console.log("[" + testIndex + "] Paused after stepping");
+ isStepping = false;
+ InspectorTest.sendCommand("Debugger.resume", {});
+ }
+ }
+
+ InspectorTest.eventHandler["Debugger.resumed"] = function(messageObject)
+ {
+ console.log("[" + testIndex + "] Resumed");
+ if (!isStepping)
+ triggerNextUncaughtException();
+ }
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Regression test for https://bugs.webkit.org/show_bug.cgi?id=133182</p>
+<p>Stepping after breaking on uncaught exceptions should not crash</p>
+</body>
+</html>
Modified: trunk/Source/_javascript_Core/ChangeLog (169220 => 169221)
--- trunk/Source/_javascript_Core/ChangeLog 2014-05-22 21:37:38 UTC (rev 169220)
+++ trunk/Source/_javascript_Core/ChangeLog 2014-05-22 21:40:21 UTC (rev 169221)
@@ -1,3 +1,25 @@
+2014-05-22 Mark Lam <[email protected]>
+
+ REGRESSION(r154797): Debugger crashes when stepping over an uncaught exception.
+ <https://webkit.org/b/133182>
+
+ Reviewed by Oliver Hunt.
+
+ Before r154797, we used to clear the VM exception before calling into the
+ debugger. After r154797, we don't. This patch will restore this clearing
+ of the exception before calling into the debugger.
+
+ Also added assertions after returning from calls into the debugger to
+ ensure that the debugger did not introduce any exceptions.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::unwindCallFrame):
+ (JSC::Interpreter::unwind):
+ (JSC::Interpreter::debug):
+ - Fixed the assertion here. Interpreter::debug() should never be called
+ with a pending exception. Debugger callbacks for exceptions should be
+ handled by Interpreter::unwind() and Interpreter::unwindCallFrame().
+
2014-05-21 Filip Pizlo <[email protected]>
Store barrier elision should run after DCE in both the DFG path and the FTL path
Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.cpp (169220 => 169221)
--- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp 2014-05-22 21:37:38 UTC (rev 169220)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.cpp 2014-05-22 21:40:21 UTC (rev 169221)
@@ -447,10 +447,12 @@
JSScope* scope = callFrame->scope();
if (Debugger* debugger = callFrame->vmEntryGlobalObject()->debugger()) {
+ ClearExceptionScope scope(&callFrame->vm());
if (callFrame->callee())
debugger->returnEvent(callFrame);
else
debugger->didExecuteProgram(callFrame);
+ ASSERT(!callFrame->hadException());
}
JSValue activation;
@@ -700,9 +702,8 @@
if (exceptionValue.isEmpty() || (exceptionValue.isCell() && !exceptionValue.asCell()))
exceptionValue = jsNull();
- if (exceptionValue.isObject()) {
+ if (exceptionValue.isObject())
isTermination = isTerminatedExecutionException(asObject(exceptionValue));
- }
ASSERT(callFrame->vm().exceptionStack().size());
@@ -726,6 +727,7 @@
}
debugger->exception(callFrame, exceptionValue, hasHandler);
+ ASSERT(!callFrame->hadException());
}
// Calculate an exception handler vPC, unwinding call frames as necessary.
@@ -1225,28 +1227,31 @@
Debugger* debugger = callFrame->vmEntryGlobalObject()->debugger();
if (!debugger)
return;
- ASSERT(callFrame->codeBlock()->hasDebuggerRequests() || callFrame->hadException());
+ ASSERT(callFrame->codeBlock()->hasDebuggerRequests());
+ ASSERT(!callFrame->hadException());
+
switch (debugHookID) {
case DidEnterCallFrame:
debugger->callEvent(callFrame);
- return;
+ break;
case WillLeaveCallFrame:
debugger->returnEvent(callFrame);
- return;
+ break;
case WillExecuteStatement:
debugger->atStatement(callFrame);
- return;
+ break;
case WillExecuteProgram:
debugger->willExecuteProgram(callFrame);
- return;
+ break;
case DidExecuteProgram:
debugger->didExecuteProgram(callFrame);
- return;
+ break;
case DidReachBreakpoint:
debugger->didReachBreakpoint(callFrame);
- return;
+ break;
}
+ ASSERT(!callFrame->hadException());
}
void Interpreter::enableSampler()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes