Commit acd0c3cf authored by yangguo's avatar yangguo Committed by Commit bot

[debugger] fix blacklisted tests.

BUG=v8:5581

R=jgruber@chromium.org

Review-Url: https://codereview.chromium.org/2469043003
Cr-Commit-Position: refs/heads/master@{#40793}
parent a758c197
...@@ -8,15 +8,19 @@ ...@@ -8,15 +8,19 @@
var Debug = debug.Debug var Debug = debug.Debug
var done, stepCount; var done, stepCount;
var exception = null;
function listener(event, execState, eventData, data) { function listener(event, execState, eventData, data) {
if (event == Debug.DebugEvent.Break) { if (event != Debug.DebugEvent.Break) return;
try {
if (!done) { if (!done) {
execState.prepareStep(Debug.StepAction.StepIn); execState.prepareStep(Debug.StepAction.StepIn);
var s = execState.frame().sourceLineText(); var s = execState.frame().sourceLineText();
assertTrue(s.indexOf('// ' + stepCount + '.') !== -1); assertTrue(s.indexOf('// ' + stepCount + '.') !== -1);
stepCount++; stepCount++;
} }
} catch (e) {
exception = e;
} }
}; };
...@@ -24,14 +28,14 @@ Debug.setListener(listener); ...@@ -24,14 +28,14 @@ Debug.setListener(listener);
class Base { class Base {
constructor() { // 1. constructor() {
var x = 1; // 2. var x = 1; // 1.
var y = 2; // 3. var y = 2; // 2.
done = true; // 4. done = true; // 3.
} }
} }
class Derived extends Base {} class Derived extends Base {} // 0.
(function TestBreakPointInConstructor() { (function TestBreakPointInConstructor() {
...@@ -40,7 +44,7 @@ class Derived extends Base {} ...@@ -40,7 +44,7 @@ class Derived extends Base {}
var bp = Debug.setBreakPoint(Base, 0); var bp = Debug.setBreakPoint(Base, 0);
new Base(); new Base();
assertEquals(1, stepCount); assertEquals(4, stepCount);
Debug.clearBreakPoint(bp); Debug.clearBreakPoint(bp);
})(); })();
...@@ -52,7 +56,7 @@ class Derived extends Base {} ...@@ -52,7 +56,7 @@ class Derived extends Base {}
var bp = Debug.setBreakPoint(Base, 0); var bp = Debug.setBreakPoint(Base, 0);
new Derived(); new Derived();
assertEquals(1, stepCount); assertEquals(4, stepCount);
Debug.clearBreakPoint(bp); Debug.clearBreakPoint(bp);
})(); })();
...@@ -60,15 +64,15 @@ class Derived extends Base {} ...@@ -60,15 +64,15 @@ class Derived extends Base {}
(function TestStepInto() { (function TestStepInto() {
done = false; done = false;
stepCount = 0; stepCount = -1;
function f() { function f() {
new Derived(); // 0. new Derived(); // -1.
} }
var bp = Debug.setBreakPoint(f, 0); var bp = Debug.setBreakPoint(f, 0);
f(); f();
assertEquals(1, stepCount); assertEquals(4, stepCount);
Debug.clearBreakPoint(bp); Debug.clearBreakPoint(bp);
})(); })();
...@@ -76,17 +80,17 @@ class Derived extends Base {} ...@@ -76,17 +80,17 @@ class Derived extends Base {}
(function TestExtraIndirection() { (function TestExtraIndirection() {
done = false; done = false;
stepCount = 0; stepCount = -2;
class Derived2 extends Derived {} class Derived2 extends Derived {} // -1.
function f() { function f() {
new Derived2(); // 0. new Derived2(); // -2.
} }
var bp = Debug.setBreakPoint(f, 0); var bp = Debug.setBreakPoint(f, 0);
f(); f();
assertEquals(1, stepCount); assertEquals(4, stepCount);
Debug.clearBreakPoint(bp); Debug.clearBreakPoint(bp);
})(); })();
...@@ -94,20 +98,21 @@ class Derived extends Base {} ...@@ -94,20 +98,21 @@ class Derived extends Base {}
(function TestBoundClass() { (function TestBoundClass() {
done = false; done = false;
stepCount = 0; stepCount = -1;
var bound = Derived.bind(null); var bound = Derived.bind(null);
function f() { function f() {
new bound(); // 0. new bound(); // -1.
} }
var bp = Debug.setBreakPoint(f, 0); var bp = Debug.setBreakPoint(f, 0);
f(); f();
assertEquals(1, stepCount); assertEquals(4, stepCount);
Debug.clearBreakPoint(bp); Debug.clearBreakPoint(bp);
})(); })();
Debug.setListener(null); Debug.setListener(null);
assertNull(exception);
...@@ -9,36 +9,31 @@ Debug = debug.Debug ...@@ -9,36 +9,31 @@ Debug = debug.Debug
listenerComplete = false; listenerComplete = false;
breakPointCount = 0; breakPointCount = 0;
exception = null;
function listener(event, exec_state, event_data, data) { function listener(event, exec_state, event_data, data) {
if (event == Debug.DebugEvent.Break) { if (event != Debug.DebugEvent.Break) return;
try {
breakPointCount++; breakPointCount++;
if (breakPointCount == 1) { if (breakPointCount == 1) {
// Break point in initializer for parameter `a`, invoked by // Break point in initializer for parameter `a`, invoked by
// initializer for parameter `b` // initializer for parameter `b`
assertEquals('default', exec_state.frame(1).evaluate('mode').value()); assertEquals('default', exec_state.frame(0).evaluate('mode').value());
assertTrue(exec_state.frame(1).evaluate('b').isUndefined());
// initializer for `b` can't refer to `b` assertTrue(exec_state.frame(1).evaluate('c').isUndefined());
assertThrows(function() {
exec_state.frame(1).evaluate('b').value();
}, ReferenceError);
assertThrows(function() {
exec_state.frame(1).evaluate('c');
}, ReferenceError);
} else if (breakPointCount == 2) { } else if (breakPointCount == 2) {
// Break point in IIFE initializer for parameter `c` // Break point in IIFE initializer for parameter `c`
assertEquals('modeFn', exec_state.frame(1).evaluate('a.name').value()); assertEquals('modeFn', exec_state.frame(1).evaluate('a.name').value());
assertEquals('default', exec_state.frame(1).evaluate('b').value()); assertEquals('default', exec_state.frame(1).evaluate('b').value());
assertThrows(function() { assertTrue(exec_state.frame(1).evaluate('c').isUndefined());
exec_state.frame(1).evaluate('c');
}, ReferenceError);
} else if (breakPointCount == 3) { } else if (breakPointCount == 3) {
// Break point in function body --- `c` parameter is shadowed // Break point in function body --- `c` parameter is shadowed
assertEquals('modeFn', exec_state.frame(0).evaluate('a.name').value()); assertEquals('modeFn', exec_state.frame(0).evaluate('a.name').value());
assertEquals('default', exec_state.frame(0).evaluate('b').value()); assertEquals('default', exec_state.frame(0).evaluate('b').value());
assertEquals('local', exec_state.frame(0).evaluate('d').value()); assertEquals('local', exec_state.frame(0).evaluate('d').value());
} }
} catch (e) {
exception = e;
} }
}; };
...@@ -56,3 +51,4 @@ f(); ...@@ -56,3 +51,4 @@ f();
// Make sure that the debug event listener vas invoked. // Make sure that the debug event listener vas invoked.
assertEquals(3, breakPointCount); assertEquals(3, breakPointCount);
assertNull(exception);
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
############################################################################## ##############################################################################
# Too slow in debug mode with --stress-opt mode. # Too slow in debug mode with --stress-opt mode.
'regress/regress-2318': [PASS, ['mode == debug', SKIP]],
'regress/regress-create-exception': [PASS, ['mode == debug', SKIP]], 'regress/regress-create-exception': [PASS, ['mode == debug', SKIP]],
############################################################################## ##############################################################################
...@@ -134,17 +135,6 @@ ...@@ -134,17 +135,6 @@
'verify-check-false': [FAIL, NO_VARIANTS], 'verify-check-false': [FAIL, NO_VARIANTS],
'verify-assert-false': [NO_VARIANTS, ['mode == release and dcheck_always_on == False', PASS], ['mode == debug or dcheck_always_on == True', FAIL]], 'verify-assert-false': [NO_VARIANTS, ['mode == release and dcheck_always_on == False', PASS], ['mode == debug or dcheck_always_on == True', FAIL]],
##############################################################################
# BUG(5581): Broken tests with exceptions thrown in debug listener.
'es6/debug-step-into-constructor': [FAIL],
'es6/default-parameters-debug': [FAIL],
'regress/regress-2296': [FAIL],
'regress/regress-2318': [FAIL],
'regress/regress-4703': [FAIL],
'regress/regress-5071': [FAIL],
'regress/regress-998565': [FAIL],
'regress/regress-crbug-107996': [FAIL],
############################################################################## ##############################################################################
# Tests with different versions for release and debug. # Tests with different versions for release and debug.
'compiler/alloc-number': [PASS, ['mode == debug', SKIP]], 'compiler/alloc-number': [PASS, ['mode == debug', SKIP]],
......
...@@ -30,7 +30,11 @@ ...@@ -30,7 +30,11 @@
Debug = debug.Debug Debug = debug.Debug
function listener(event, exec_state, event_data, data) { function listener(event, exec_state, event_data, data) {
event_data.script().setSource(1); try {
event_data.script().setSource(1);
} catch (e) {
assertTrue(String(e).indexOf("Source is not a string") > 0);
}
}; };
Debug.setListener(listener); Debug.setListener(listener);
......
...@@ -25,11 +25,10 @@ ...@@ -25,11 +25,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug --nostack-trace-on-abort --stack-size=150 // Flags: --expose-debug-as debug --stack-size=150
function f() { function f() {
var i = 0; var i = 0;
// Stack-allocate to reach the end of stack quickly. // Stack-allocate to reach the end of stack quickly.
var _A0 = 00; var _A1 = 01; var _A2 = 02; var _A3 = 03; var _A4 = 04; var _A0 = 00; var _A1 = 01; var _A2 = 02; var _A3 = 03; var _A4 = 04;
var _B0 = 05; var _B1 = 06; var _B2 = 07; var _B3 = 08; var _B4 = 09; var _B0 = 05; var _B1 = 06; var _B2 = 07; var _B3 = 08; var _B4 = 09;
...@@ -58,10 +57,16 @@ function f() { ...@@ -58,10 +57,16 @@ function f() {
Debug = debug.Debug; Debug = debug.Debug;
function listener(event, exec_state, event_data, data) { function listener(event, exec_state, event_data, data) {
result = exec_state.frame().evaluate("i").value(); if (event != Debug.DebugEvent.Break) return;
try {
exec_state.frame(0).evaluate("i");
} catch (e) {
}
}; };
Debug.setListener(listener); Debug.setListener(listener);
var bp = Debug.setBreakPoint(f, 0); var bp = Debug.setBreakPoint(f, 1);
assertThrows(function() { f(); }, RangeError); assertThrows(function() { f(); }, RangeError);
Debug.setListener(null);
...@@ -4,8 +4,10 @@ ...@@ -4,8 +4,10 @@
// Flags: --expose-debug-as debug // Flags: --expose-debug-as debug
var exception = null;
function listener(event, exec_state, event_data, data) { function listener(event, exec_state, event_data, data) {
if (event != Debug.DebugEvent.Break) return; if (event != debug.Debug.DebugEvent.Break) return;
try { try {
var all_scopes = exec_state.frame().allScopes(); var all_scopes = exec_state.frame().allScopes();
assertEquals([ debug.ScopeType.Block, assertEquals([ debug.ScopeType.Block,
...@@ -15,6 +17,7 @@ function listener(event, exec_state, event_data, data) { ...@@ -15,6 +17,7 @@ function listener(event, exec_state, event_data, data) {
all_scopes.map(scope => scope.scopeType())); all_scopes.map(scope => scope.scopeType()));
} catch (e) { } catch (e) {
exception = e; exception = e;
print(e);
} }
} }
...@@ -28,3 +31,6 @@ debug.Debug.setListener(listener); ...@@ -28,3 +31,6 @@ debug.Debug.setListener(listener);
} }
debugger; debugger;
})(); })();
debug.Debug.setListener(null);
assertNull(exception);
...@@ -5,16 +5,20 @@ ...@@ -5,16 +5,20 @@
// Flags: --expose-debug-as debug // Flags: --expose-debug-as debug
var Debug = debug.Debug; var Debug = debug.Debug;
var exception = null;
function listener(event, exec_state, event_data, data) { function listener(event, exec_state, event_data, data) {
assertEquals(2, exec_state.frameCount()); if (event != Debug.DebugEvent.Break) return;
assertEquals("a", exec_state.frame(0).localName(0)); try {
assertEquals("1", exec_state.frame(0).localValue(0).value()); assertEquals(2, exec_state.frameCount());
assertEquals(1, exec_state.frame(0).localCount()); assertEquals("a", exec_state.frame(0).localName(0));
assertEquals(1, exec_state.frame(0).localValue(0).value());
assertEquals(1, exec_state.frame(0).localCount());
} catch (e) {
exception = e;
}
} }
Debug.setListener(listener);
function f() { function f() {
var a = 1; var a = 1;
{ {
...@@ -23,4 +27,7 @@ function f() { ...@@ -23,4 +27,7 @@ function f() {
} }
} }
Debug.setListener(listener);
f(); f();
Debug.setListener(null);
assertNull(exception);
// Copyright 2008 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug
listenerCalled = false;
function listener(event, exec_state, event_data, data) {
listenerCalled = true;
throw 1;
};
// Add the debug event listener.
Debug.setListener(listener);
function f() {
a=1
};
// Set a break point and call to invoke the debug event listener.
Debug.setBreakPoint(f, 0, 0);
f();
// Make sure that the debug event listener vas invoked.
assertTrue(listenerCalled);
...@@ -30,15 +30,19 @@ ...@@ -30,15 +30,19 @@
Debug = debug.Debug; Debug = debug.Debug;
Debug.setListener(listener); Debug.setListener(listener);
var exception = null;
var fourteen; var fourteen;
var four_in_debugger = []; var four_in_debugger = [];
function listener(event, exec_state, event_data, data) { function listener(event, exec_state, event_data, data) {
if (event == Debug.DebugEvent.Break) { if (event == Debug.DebugEvent.Break) {
for (var i = 0; i < exec_state.frameCount(); i++) { try {
var frame = exec_state.frame(i); for (var i = 0; i < exec_state.frameCount() - 1; i++) {
four_in_debugger[i] = frame.evaluate("four", false).value(); var frame = exec_state.frame(i);
four_in_debugger[i] = frame.evaluate("four", false).value();
}
} catch (e) {
exception = e;
} }
} }
} }
...@@ -62,3 +66,4 @@ assertEquals(4, four_in_debugger[1]); ...@@ -62,3 +66,4 @@ assertEquals(4, four_in_debugger[1]);
assertEquals(4, four_in_debugger[2]); assertEquals(4, four_in_debugger[2]);
Debug.setListener(null); Debug.setListener(null);
assertNull(exception);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment