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 @@
var Debug = debug.Debug
var done, stepCount;
var exception = null;
function listener(event, execState, eventData, data) {
if (event == Debug.DebugEvent.Break) {
if (event != Debug.DebugEvent.Break) return;
try {
if (!done) {
execState.prepareStep(Debug.StepAction.StepIn);
var s = execState.frame().sourceLineText();
assertTrue(s.indexOf('// ' + stepCount + '.') !== -1);
stepCount++;
}
} catch (e) {
exception = e;
}
};
......@@ -24,14 +28,14 @@ Debug.setListener(listener);
class Base {
constructor() { // 1.
var x = 1; // 2.
var y = 2; // 3.
done = true; // 4.
constructor() {
var x = 1; // 1.
var y = 2; // 2.
done = true; // 3.
}
}
class Derived extends Base {}
class Derived extends Base {} // 0.
(function TestBreakPointInConstructor() {
......@@ -40,7 +44,7 @@ class Derived extends Base {}
var bp = Debug.setBreakPoint(Base, 0);
new Base();
assertEquals(1, stepCount);
assertEquals(4, stepCount);
Debug.clearBreakPoint(bp);
})();
......@@ -52,7 +56,7 @@ class Derived extends Base {}
var bp = Debug.setBreakPoint(Base, 0);
new Derived();
assertEquals(1, stepCount);
assertEquals(4, stepCount);
Debug.clearBreakPoint(bp);
})();
......@@ -60,15 +64,15 @@ class Derived extends Base {}
(function TestStepInto() {
done = false;
stepCount = 0;
stepCount = -1;
function f() {
new Derived(); // 0.
new Derived(); // -1.
}
var bp = Debug.setBreakPoint(f, 0);
f();
assertEquals(1, stepCount);
assertEquals(4, stepCount);
Debug.clearBreakPoint(bp);
})();
......@@ -76,17 +80,17 @@ class Derived extends Base {}
(function TestExtraIndirection() {
done = false;
stepCount = 0;
stepCount = -2;
class Derived2 extends Derived {}
class Derived2 extends Derived {} // -1.
function f() {
new Derived2(); // 0.
new Derived2(); // -2.
}
var bp = Debug.setBreakPoint(f, 0);
f();
assertEquals(1, stepCount);
assertEquals(4, stepCount);
Debug.clearBreakPoint(bp);
})();
......@@ -94,20 +98,21 @@ class Derived extends Base {}
(function TestBoundClass() {
done = false;
stepCount = 0;
stepCount = -1;
var bound = Derived.bind(null);
function f() {
new bound(); // 0.
new bound(); // -1.
}
var bp = Debug.setBreakPoint(f, 0);
f();
assertEquals(1, stepCount);
assertEquals(4, stepCount);
Debug.clearBreakPoint(bp);
})();
Debug.setListener(null);
assertNull(exception);
......@@ -9,36 +9,31 @@ Debug = debug.Debug
listenerComplete = false;
breakPointCount = 0;
exception = null;
function listener(event, exec_state, event_data, data) {
if (event == Debug.DebugEvent.Break) {
if (event != Debug.DebugEvent.Break) return;
try {
breakPointCount++;
if (breakPointCount == 1) {
// Break point in initializer for parameter `a`, invoked by
// initializer for parameter `b`
assertEquals('default', exec_state.frame(1).evaluate('mode').value());
// initializer for `b` can't refer to `b`
assertThrows(function() {
exec_state.frame(1).evaluate('b').value();
}, ReferenceError);
assertThrows(function() {
exec_state.frame(1).evaluate('c');
}, ReferenceError);
assertEquals('default', exec_state.frame(0).evaluate('mode').value());
assertTrue(exec_state.frame(1).evaluate('b').isUndefined());
assertTrue(exec_state.frame(1).evaluate('c').isUndefined());
} else if (breakPointCount == 2) {
// Break point in IIFE initializer for parameter `c`
assertEquals('modeFn', exec_state.frame(1).evaluate('a.name').value());
assertEquals('default', exec_state.frame(1).evaluate('b').value());
assertThrows(function() {
exec_state.frame(1).evaluate('c');
}, ReferenceError);
assertTrue(exec_state.frame(1).evaluate('c').isUndefined());
} else if (breakPointCount == 3) {
// Break point in function body --- `c` parameter is shadowed
assertEquals('modeFn', exec_state.frame(0).evaluate('a.name').value());
assertEquals('default', exec_state.frame(0).evaluate('b').value());
assertEquals('local', exec_state.frame(0).evaluate('d').value());
}
} catch (e) {
exception = e;
}
};
......@@ -56,3 +51,4 @@ f();
// Make sure that the debug event listener vas invoked.
assertEquals(3, breakPointCount);
assertNull(exception);
......@@ -69,6 +69,7 @@
##############################################################################
# Too slow in debug mode with --stress-opt mode.
'regress/regress-2318': [PASS, ['mode == debug', SKIP]],
'regress/regress-create-exception': [PASS, ['mode == debug', SKIP]],
##############################################################################
......@@ -134,17 +135,6 @@
'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]],
##############################################################################
# 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.
'compiler/alloc-number': [PASS, ['mode == debug', SKIP]],
......
......@@ -30,7 +30,11 @@
Debug = debug.Debug
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);
......
......@@ -25,11 +25,10 @@
// (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 --nostack-trace-on-abort --stack-size=150
// Flags: --expose-debug-as debug --stack-size=150
function f() {
var i = 0;
// 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 _B0 = 05; var _B1 = 06; var _B2 = 07; var _B3 = 08; var _B4 = 09;
......@@ -58,10 +57,16 @@ function f() {
Debug = debug.Debug;
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);
var bp = Debug.setBreakPoint(f, 0);
var bp = Debug.setBreakPoint(f, 1);
assertThrows(function() { f(); }, RangeError);
Debug.setListener(null);
......@@ -4,8 +4,10 @@
// Flags: --expose-debug-as debug
var exception = null;
function listener(event, exec_state, event_data, data) {
if (event != Debug.DebugEvent.Break) return;
if (event != debug.Debug.DebugEvent.Break) return;
try {
var all_scopes = exec_state.frame().allScopes();
assertEquals([ debug.ScopeType.Block,
......@@ -15,6 +17,7 @@ function listener(event, exec_state, event_data, data) {
all_scopes.map(scope => scope.scopeType()));
} catch (e) {
exception = e;
print(e);
}
}
......@@ -28,3 +31,6 @@ debug.Debug.setListener(listener);
}
debugger;
})();
debug.Debug.setListener(null);
assertNull(exception);
......@@ -5,16 +5,20 @@
// Flags: --expose-debug-as debug
var Debug = debug.Debug;
var exception = null;
function listener(event, exec_state, event_data, data) {
assertEquals(2, exec_state.frameCount());
assertEquals("a", exec_state.frame(0).localName(0));
assertEquals("1", exec_state.frame(0).localValue(0).value());
assertEquals(1, exec_state.frame(0).localCount());
if (event != Debug.DebugEvent.Break) return;
try {
assertEquals(2, exec_state.frameCount());
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() {
var a = 1;
{
......@@ -23,4 +27,7 @@ function f() {
}
}
Debug.setListener(listener);
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 @@
Debug = debug.Debug;
Debug.setListener(listener);
var exception = null;
var fourteen;
var four_in_debugger = [];
function listener(event, exec_state, event_data, data) {
if (event == Debug.DebugEvent.Break) {
for (var i = 0; i < exec_state.frameCount(); i++) {
var frame = exec_state.frame(i);
four_in_debugger[i] = frame.evaluate("four", false).value();
try {
for (var i = 0; i < exec_state.frameCount() - 1; i++) {
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]);
assertEquals(4, four_in_debugger[2]);
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