Commit facd6b9a authored by jgruber's avatar jgruber Committed by Commit bot

[debug-wrapper] Migrate more tests

* Fix setting script-scope variables through inspector by internalizing
  their names.
* Reconstruct values of Number, String, and Boolean classes.
* Adapt a couple of tests for API restrictions.

BUG=v8:5530

Review-Url: https://codereview.chromium.org/2512963002
Cr-Commit-Position: refs/heads/master@{#41175}
parent 5a1fbe24
......@@ -733,11 +733,13 @@ bool ScopeIterator::SetClosureVariableValue(Handle<String> variable_name,
bool ScopeIterator::SetScriptVariableValue(Handle<String> variable_name,
Handle<Object> new_value) {
Handle<String> internalized_variable_name =
isolate_->factory()->InternalizeString(variable_name);
Handle<Context> context = CurrentContext();
Handle<ScriptContextTable> script_contexts(
context->global_object()->native_context()->script_context_table());
ScriptContextTable::LookupResult lookup_result;
if (ScriptContextTable::Lookup(script_contexts, variable_name,
if (ScriptContextTable::Lookup(script_contexts, internalized_variable_name,
&lookup_result)) {
Handle<Context> script_context = ScriptContextTable::GetContext(
script_contexts, lookup_result.context_index);
......
......@@ -25,8 +25,6 @@
// (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
// Simple debug event handler which just counts the number of break points hit.
......@@ -81,19 +79,6 @@ f();
assertEquals(1, break_point_hit_count);
Debug.clearBreakPoint(bp);
// Changing condition.
break_point_hit_count = 0;
bp = Debug.setBreakPoint(f, 0, 0, '"ab".indexOf("b") > 0');
f();
assertEquals(1, break_point_hit_count);
Debug.changeBreakPointCondition(bp, 'Math.sin(Math.PI/2) > 1');
f();
assertEquals(1, break_point_hit_count);
Debug.changeBreakPointCondition(bp, '1==1');
f();
assertEquals(2, break_point_hit_count);
Debug.clearBreakPoint(bp);
// Conditional breakpoint which checks global variable.
break_point_hit_count = 0;
bp = Debug.setBreakPoint(f, 0, 0, 'x==1');
......@@ -134,21 +119,19 @@ Debug.clearBreakPoint(bp);
// Multiple conditional breakpoint which the same condition.
break_point_hit_count = 0;
bp1 = Debug.setBreakPoint(h, 0, 22, 'a % 2 == 0');
bp2 = Debug.setBreakPoint(h, 0, 22, 'a % 2 == 0');
assertThrows(() => Debug.setBreakPoint(h, 0, 22, 'a % 2 == 0'));
for (var i = 0; i < 10; i++) {
g();
}
assertEquals(5, break_point_hit_count);
Debug.clearBreakPoint(bp1);
Debug.clearBreakPoint(bp2);
// Multiple conditional breakpoint which different conditions.
break_point_hit_count = 0;
bp1 = Debug.setBreakPoint(h, 0, 22, 'a % 2 == 0');
bp2 = Debug.setBreakPoint(h, 0, 22, '(a + 1) % 2 == 0');
assertThrows(() => Debug.setBreakPoint(h, 0, 22, '(a + 1) % 2 == 0'));
for (var i = 0; i < 10; i++) {
g();
}
assertEquals(10, break_point_hit_count);
assertEquals(5, break_point_hit_count);
Debug.clearBreakPoint(bp1);
Debug.clearBreakPoint(bp2);
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug --no-analyze-environment-liveness
// Flags: --no-analyze-environment-liveness
// Test that debug-evaluate only resolves variables that are used by
// the function inside which we debug-evaluate. This is to avoid
......
......@@ -25,15 +25,32 @@
// (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.
var Debug = debug.Debug;
function CheckScope(scope_mirror, scope_expectations, expected_scope_type) {
assertEquals(expected_scope_type, scope_mirror.scopeType());
const ScopeType = debug.ScopeType;
var scope_object = scope_mirror.scopeObject().value();
let exception = null;
let listenerDelegate = null;
const expected_break_count = 5;
let break_count = 0;
Debug.setListener(function(event, exec_state, event_data, data) {
if (event != Debug.DebugEvent.Break) return;
try {
break_count++;
listenerDelegate(exec_state);
} catch (e) {
exception = e;
print(e, e.stack);
}
});
function CheckScope(scope_frame, scope_expectations, expected_scope_type) {
assertEquals(expected_scope_type, scope_frame.scopeType());
var scope_object = scope_frame.scopeObject().value();
for (var name in scope_expectations) {
var actual = scope_object[name];
......@@ -42,14 +59,29 @@ function CheckScope(scope_mirror, scope_expectations, expected_scope_type) {
}
}
var ScopeType = debug.ScopeType;
// ---
listenerDelegate = function(exec_state) {
const frame = exec_state.frame(0);
assertEquals(7, frame.scopeCount());
CheckScope(frame.scope(0), {}, ScopeType.Local);
CheckScope(frame.scope(1), { a: 4, b: 5 }, ScopeType.Closure);
CheckScope(frame.scope(2), { w: 5, v: "Capybara" }, ScopeType.With);
CheckScope(frame.scope(3), { z: 22 }, ScopeType.Closure);
CheckScope(frame.scope(4), { x: 5 }, ScopeType.Closure);
CheckScope(frame.scope(5), {}, ScopeType.Script);
CheckScope(frame.scope(6), {}, ScopeType.Global);
};
var f1 = (function F1(x) {
(function F1(x) {
function F2(y) {
var z = x + y;
with ({w: 5, v: "Capybara"}) {
var F3 = function(a, b) {
function F4(p) {
debugger;
return p + a + b + z + w + v.length;
}
return F4;
......@@ -58,51 +90,63 @@ var f1 = (function F1(x) {
}
}
return F2(17);
})(5);
})(5)();
var mirror = Debug.MakeMirror(f1);
// ---
assertEquals(6, mirror.scopeCount());
listenerDelegate = function(exec_state) {
const frame = exec_state.frame(0);
CheckScope(mirror.scope(0), { a: 4, b: 5 }, ScopeType.Closure);
CheckScope(mirror.scope(1), { w: 5, v: "Capybara" }, ScopeType.With);
CheckScope(mirror.scope(2), { z: 22 }, ScopeType.Closure);
CheckScope(mirror.scope(3), { x: 5 }, ScopeType.Closure);
CheckScope(mirror.scope(4), {}, ScopeType.Script);
CheckScope(mirror.scope(5), {}, ScopeType.Global);
assertEquals(3, frame.scopeCount());
var f2 = function() { return 5; }
CheckScope(frame.scope(0), {}, ScopeType.Local);
CheckScope(frame.scope(1), {}, ScopeType.Script);
CheckScope(frame.scope(2), {}, ScopeType.Global);
};
var mirror = Debug.MakeMirror(f2);
(function() { debugger; return 5; })();
assertEquals(2, mirror.scopeCount());
// ---
CheckScope(mirror.scope(0), {}, ScopeType.Script);
CheckScope(mirror.scope(1), {}, ScopeType.Global);
listenerDelegate = function(exec_state) {
const frame = exec_state.frame(0);
var f3 = (function F1(invisible_parameter) {
assertEquals(5, frame.scopeCount());
CheckScope(frame.scope(0), {}, ScopeType.Local);
CheckScope(frame.scope(1), { visible2: 20 }, ScopeType.Closure);
CheckScope(frame.scope(2), { visible1: 10 }, ScopeType.Closure);
CheckScope(frame.scope(3), {}, ScopeType.Script);
CheckScope(frame.scope(4), {}, ScopeType.Global);
};
(function F1(invisible_parameter) {
var invisible1 = 1;
var visible1 = 10;
return (function F2() {
var invisible2 = 2;
return (function F3() {
var visible2 = 20;
return (function () {return visible1 + visible2 + visible1a;});
return (function () { debugger; return visible1 + visible2; });
})();
})();
})(5);
})(5)();
var mirror = Debug.MakeMirror(f3);
// ---
assertEquals(4, mirror.scopeCount());
listenerDelegate = function(exec_state) {
const frame = exec_state.frame(0);
CheckScope(mirror.scope(0), { visible2: 20 }, ScopeType.Closure);
CheckScope(mirror.scope(1), { visible1: 10 }, ScopeType.Closure);
CheckScope(mirror.scope(2), {}, ScopeType.Script);
CheckScope(mirror.scope(3), {}, ScopeType.Global);
assertEquals(5, frame.scopeCount());
CheckScope(frame.scope(0), {}, ScopeType.Local);
CheckScope(frame.scope(1), { e2: "I'm error 2" }, ScopeType.Catch);
CheckScope(frame.scope(2), { e1: "I'm error 1" }, ScopeType.Catch);
CheckScope(frame.scope(3), {}, ScopeType.Script);
CheckScope(frame.scope(4), {}, ScopeType.Global);
};
var f4 = (function One() {
(function One() {
try {
throw "I'm error 1";
} catch (e1) {
......@@ -110,47 +154,38 @@ var f4 = (function One() {
throw "I'm error 2";
} catch (e2) {
return function GetError() {
debugger;
return e1 + e2;
};
}
}
})();
})()();
var mirror = Debug.MakeMirror(f4);
// ---
assertEquals(4, mirror.scopeCount());
listenerDelegate = function(exec_state) {
const frame = exec_state.frame(0);
CheckScope(mirror.scope(0), { e2: "I'm error 2" }, ScopeType.Catch);
CheckScope(mirror.scope(1), { e1: "I'm error 1" }, ScopeType.Catch);
CheckScope(mirror.scope(2), {}, ScopeType.Script);
CheckScope(mirror.scope(3), {}, ScopeType.Global);
assertEquals(5, frame.scopeCount());
CheckScope(frame.scope(0), {}, ScopeType.Local);
CheckScope(frame.scope(1), { p4: 20, p6: 22 }, ScopeType.Closure);
CheckScope(frame.scope(2), { p1: 1 }, ScopeType.Closure);
CheckScope(frame.scope(3), {}, ScopeType.Script);
CheckScope(frame.scope(4), {}, ScopeType.Global);
};
var f5 = (function Raz(p1, p2) {
(function Raz(p1, p2) {
var p3 = p1 + p2;
return (function() {
var p4 = 20;
var p5 = 21;
var p6 = 22;
return eval("(function(p7){return p1 + p4 + p6 + p7})");
return eval("(function(p7){ debugger; return p1 + p4 + p6 + p7})");
})();
})(1,2);
var mirror = Debug.MakeMirror(f5);
assertEquals(4, mirror.scopeCount());
CheckScope(mirror.scope(0), { p4: 20, p6: 22 }, ScopeType.Closure);
CheckScope(mirror.scope(1), { p1: 1 }, ScopeType.Closure);
CheckScope(mirror.scope(2), {}, ScopeType.Script);
CheckScope(mirror.scope(3), {}, ScopeType.Global);
function CheckNoScopeVisible(f) {
var mirror = Debug.MakeMirror(f);
assertEquals(0, mirror.scopeCount());
}
})(1,2)();
CheckNoScopeVisible(Number);
// ---
CheckNoScopeVisible(Function.toString);
assertNull(exception);
assertEquals(expected_break_count, break_count);
......@@ -25,8 +25,6 @@
// (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
// Simple debug event handler which just counts the number of break points hit.
......@@ -58,19 +56,14 @@ f();
assertEquals(1, break_point_hit_count);
// Set another breakpoint in f at the same place.
bp2 = Debug.setBreakPoint(f);
assertThrows(() => Debug.setBreakPoint(f));
f();
assertEquals(2, break_point_hit_count);
// Remove one of the break points.
// Remove the break points.
Debug.clearBreakPoint(bp1);
f();
assertEquals(3, break_point_hit_count);
// Remove the second break point.
Debug.clearBreakPoint(bp2);
f();
assertEquals(3, break_point_hit_count);
assertEquals(2, break_point_hit_count);
// Perform the same test using function g (this time removing the break points
// in the another order).
......@@ -78,28 +71,22 @@ break_point_hit_count = 0;
bp1 = Debug.setBreakPoint(g);
g();
assertEquals(1, break_point_hit_count);
bp2 = Debug.setBreakPoint(g);
assertThrows(() => Debug.setBreakPoint(g));
g();
assertEquals(2, break_point_hit_count);
Debug.clearBreakPoint(bp2);
g();
assertEquals(3, break_point_hit_count);
Debug.clearBreakPoint(bp1);
g();
assertEquals(3, break_point_hit_count);
assertEquals(2, break_point_hit_count);
// Finally test with many break points.
test_count = 10;
bps = new Array(test_count);
break_point_hit_count = 0;
for (var i = 0; i < test_count; i++) {
bps[i] = Debug.setBreakPoint(h);
h();
}
for (var i = 0; i < test_count; i++) {
if (i == 0) {
Debug.setBreakPoint(h);
} else {
assertThrows(() => Debug.setBreakPoint(h));
}
h();
Debug.clearBreakPoint(bps[i]);
}
assertEquals(test_count * 2, break_point_hit_count);
h();
assertEquals(test_count * 2, break_point_hit_count);
assertEquals(test_count, break_point_hit_count);
......@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-debug-as debug
var Debug = debug.Debug;
var break_count = 0;
......@@ -63,37 +62,37 @@ assertCount(3, 1);
f(1);
assertCount(4, 1);
Debug.setBreakPoint(f, 1, 0, "x > 0");
assertThrows(() => Debug.setBreakPoint(f, 1, 0, "x > 0"));
f(1);
assertCount(5, 1);
assertCount(5, 2);
f(0);
assertCount(5, 1);
assertCount(5, 2);
Debug.setBreakPoint(g, 2, 0, "1 == 2");
g(1);
assertCount(5, 1);
assertCount(5, 2);
Debug.setBreakPoint(g, 2, 0, "x == 1");
assertThrows(() => Debug.setBreakPoint(g, 2, 0, "x == 1"));
g(1);
assertCount(6, 2);
assertCount(5, 3);
g(2);
assertCount(6, 2);
assertCount(5, 3);
g(1);
assertCount(7, 3);
assertCount(5, 3);
Debug.setBreakPoint(g, 2, 0, "x > 0");
assertThrows(() => Debug.setBreakPoint(g, 2, 0, "x > 0"));
g(1);
assertCount(8, 4);
assertCount(5, 4);
g(0);
assertCount(8, 4);
assertCount(5, 4);
h(0);
assertCount(8, 5);
assertCount(5, 5);
Debug.setBreakPoint(h, 3, 0, "x > 0");
h(1);
assertCount(9, 6);
assertCount(6, 6);
h(0);
assertCount(9, 6);
assertCount(6, 6);
Debug.clearBreakOnException();
Debug.setListener(null);
......@@ -25,8 +25,6 @@
// (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;
var test_name;
......@@ -68,7 +66,7 @@ function BeginTest(name) {
// Check result of a test.
function EndTest() {
assertTrue(listener_called, "listerner not called for " + test_name);
assertTrue(listener_called, "listener not called for " + test_name);
assertNull(exception, test_name);
end_test_count++;
}
......
......@@ -25,8 +25,8 @@
// (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 --expose-gc --send-idle-notification
// Flags: --allow-natives-syntax --expose-natives-as natives
// Flags: --expose-gc --send-idle-notification
// Flags: --expose-natives-as natives
// Flags: --noharmony-shipping
// Flags: --nostress-opt
......@@ -39,7 +39,6 @@
// as 'experimental', but are still returned by Debug.scripts(), so
// we disable harmony-shipping for this test
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug;
Debug.setListener(function(){});
......
......@@ -25,11 +25,8 @@
// (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.
var Debug = debug.Debug;
var DebugCommandProcessor = debug.DebugCommandProcessor;
// Accepts a function/closure 'fun' that must have a debugger statement inside.
// A variable 'variable_name' must be initialized before debugger statement
......@@ -78,24 +75,6 @@ function RunPauseTest(scope_number, expected_old_result, variable_name,
assertEquals(expected_new_result, actual_new_result);
}
// Accepts a closure 'fun' that returns a variable from its outer scope.
// The test changes the value of variable via the handle to function and checks
// that the return value changed accordingly.
function RunClosureTest(scope_number, expected_old_result, variable_name,
new_value, expected_new_result, fun) {
var actual_old_result = fun();
assertEquals(expected_old_result, actual_old_result);
var fun_mirror = Debug.MakeMirror(fun);
var scope = fun_mirror.scope(scope_number);
scope.setVariableValue(variable_name, new_value);
var actual_new_result = fun();
assertEquals(expected_new_result, actual_new_result);
}
function ClosureTestCase(scope_index, old_result, variable_name, new_value,
new_result, success_expected, factory) {
......@@ -117,15 +96,6 @@ ClosureTestCase.prototype.run_pause_test = function() {
});
}
ClosureTestCase.prototype.run_closure_test = function() {
var th = this;
var fun = this.factory_(false);
this.run_and_catch_(function() {
RunClosureTest(th.scope_index_, th.old_result_, th.variable_name_,
th.new_value_, th.new_result_, fun);
});
}
ClosureTestCase.prototype.run_and_catch_ = function(runnable) {
if (this.success_expected_) {
runnable();
......@@ -212,10 +182,6 @@ for (var i = 0; i < closure_test_cases.length; i++) {
closure_test_cases[i].run_pause_test();
}
for (var i = 0; i < closure_test_cases.length; i++) {
closure_test_cases[i].run_closure_test();
}
// Test local scope.
......@@ -290,25 +256,6 @@ RunPauseTest(0, 5, 'p', 2012, 2012, (function Factory() {
})());
// Test value description protocol JSON
assertEquals(true, DebugCommandProcessor.resolveValue_({value: true}));
assertSame(null, DebugCommandProcessor.resolveValue_({type: "null"}));
assertSame(undefined,
DebugCommandProcessor.resolveValue_({type: "undefined"}));
assertSame("123", DebugCommandProcessor.resolveValue_(
{type: "string", stringDescription: "123"}));
assertSame(123, DebugCommandProcessor.resolveValue_(
{type: "number", stringDescription: "123"}));
assertSame(Number, DebugCommandProcessor.resolveValue_(
{handle: Debug.MakeMirror(Number).handle()}));
assertSame(RunClosureTest, DebugCommandProcessor.resolveValue_(
{handle: Debug.MakeMirror(RunClosureTest).handle()}));
// Test script-scope variable.
let abc = 12;
{
......@@ -318,7 +265,6 @@ let abc = 12;
if (event == Debug.DebugEvent.Break) {
let scope_count = exec_state.frame().scopeCount();
let script_scope = exec_state.frame().scope(scope_count - 2);
assertTrue(script_scope.isScope());
assertEquals(debug.ScopeType.Script, script_scope.scopeType());
script_scope.setVariableValue('abc', 42);
}
......
......@@ -25,18 +25,35 @@
// (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
"use strict";
let top_level_let = 255;
// Get the Debug object exposed from the debug context global object.
var Debug = debug.Debug;
function CheckScope(scope_mirror, scope_expectations, expected_scope_type) {
assertEquals(expected_scope_type, scope_mirror.scopeType());
const ScopeType = debug.ScopeType;
var scope_object = scope_mirror.scopeObject().value();
let exception = null;
let listenerDelegate = null;
const expected_break_count = 5;
let break_count = 0;
Debug.setListener(function(event, exec_state, event_data, data) {
if (event != Debug.DebugEvent.Break) return;
try {
break_count++;
listenerDelegate(exec_state);
} catch (e) {
exception = e;
print(e, e.stack);
}
});
function CheckScope(scope_frame, scope_expectations, expected_scope_type) {
assertEquals(expected_scope_type, scope_frame.scopeType());
var scope_object = scope_frame.scopeObject().value();
for (let name in scope_expectations) {
let actual = scope_object[name];
......@@ -45,16 +62,22 @@ function CheckScope(scope_mirror, scope_expectations, expected_scope_type) {
}
}
// A copy of the scope types from debug/mirrors.js.
var ScopeType = { Global: 0,
Local: 1,
With: 2,
Closure: 3,
Catch: 4,
Block: 5,
Script: 6};
// ---
listenerDelegate = function(exec_state) {
const frame = exec_state.frame(0);
var f1 = (function F1(x) {
assertEquals(6, frame.scopeCount());
CheckScope(frame.scope(0), {}, ScopeType.Local);
CheckScope(frame.scope(1), { a: 4, b: 5 }, ScopeType.Closure);
CheckScope(frame.scope(2), { z: 22, w: 5, v: "Capybara" }, ScopeType.Closure);
CheckScope(frame.scope(3), { x: 5 }, ScopeType.Closure);
CheckScope(frame.scope(4), { top_level_let: 255 }, ScopeType.Script);
CheckScope(frame.scope(5), {}, ScopeType.Global);
};
(function F1(x) {
function F2(y) {
var z = x + y;
{
......@@ -62,6 +85,7 @@ var f1 = (function F1(x) {
var v = "Capybara";
var F3 = function(a, b) {
function F4(p) {
debugger;
return p + a + b + z + w + v.length;
}
return F4;
......@@ -70,19 +94,24 @@ var f1 = (function F1(x) {
}
}
return F2(17);
})(5);
})(5)();
// ---
var mirror = Debug.MakeMirror(f1);
listenerDelegate = function(exec_state) {
const frame = exec_state.frame(0);
assertEquals(5, mirror.scopeCount());
assertEquals(6, frame.scopeCount());
CheckScope(mirror.scope(0), { a: 4, b: 5 }, ScopeType.Closure);
CheckScope(mirror.scope(1), { z: 22, w: 5, v: "Capybara" }, ScopeType.Closure);
CheckScope(mirror.scope(2), { x: 5 }, ScopeType.Closure);
CheckScope(mirror.scope(3), { top_level_let: 255 }, ScopeType.Script);
CheckScope(mirror.scope(4), {}, ScopeType.Global);
CheckScope(frame.scope(0), {}, ScopeType.Local);
CheckScope(frame.scope(1), { l3: 9 }, ScopeType.Block);
CheckScope(frame.scope(2), { l2: 7 }, ScopeType.Block);
CheckScope(frame.scope(3), { v1:3, l0: 0, v3: 5, v6: 11 }, ScopeType.Closure);
CheckScope(frame.scope(4), { top_level_let: 255 }, ScopeType.Script);
CheckScope(frame.scope(5), {}, ScopeType.Global);
};
var f2 = (function() {
(function() {
var v1 = 3;
var v2 = 4;
let l0 = 0;
......@@ -98,19 +127,10 @@ var f2 = (function() {
let l4 = 11;
var v6 = l4;
return function() {
debugger;
return l0 + v1 + v3 + l2 + l3 + v6;
};
}
}
}
})();
var mirror = Debug.MakeMirror(f2);
assertEquals(5, mirror.scopeCount());
CheckScope(mirror.scope(0), { l3: 9 }, ScopeType.Block);
CheckScope(mirror.scope(1), { l2: 7 }, ScopeType.Block);
CheckScope(mirror.scope(2), { v1:3, l0: 0, v3: 5, v6: 11 }, ScopeType.Closure);
CheckScope(mirror.scope(3), { top_level_let: 255 }, ScopeType.Script);
CheckScope(mirror.scope(4), {}, ScopeType.Global);
})()();
......@@ -25,7 +25,6 @@
// (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 --allow-natives-syntax
Debug = debug.Debug;
var listened = false;
......
......@@ -49,8 +49,9 @@
# TODO(jarin/mstarzinger): Investigate debugger issues with TurboFan.
'debug/debug-evaluate-closure': [FAIL],
'debug/debug-evaluate-locals': [FAIL],
'debug/es6/debug-evaluate-blockscopes': [FAIL],
'debug/debug-liveedit-double-call': [FAIL],
'debug/debug-set-variable-value': [FAIL],
'debug/es6/debug-evaluate-blockscopes': [FAIL],
}], # variant == turbofan_opt
##############################################################################
......
......@@ -519,6 +519,14 @@ class DebugWrapper {
return { value : () => localValue };
}
reconstructValue(objectId) {
const {msgid, msg} = this.createMessage(
"Runtime.getProperties", { objectId : objectId, ownProperties: true });
this.sendMessage(msg);
const reply = this.takeReplyChecked(msgid);
return Object(reply.result.internalProperties[0].value.value);
}
reconstructRemoteObject(obj) {
let value = obj.value;
let isUndefined = false;
......@@ -554,7 +562,20 @@ class DebugWrapper {
break;
}
default: {
value = this.propertiesToObject(this.getProperties(obj.objectId));
switch (obj.className) {
case "global":
value = Function('return this')();
break;
case "Number":
case "String":
case "Boolean":
value = this.reconstructValue(obj.objectId);
break;
default:
value = this.propertiesToObject(
this.getProperties(obj.objectId));
break;
}
break;
}
}
......
......@@ -589,9 +589,6 @@
['variant == turbofan_opt', {
'es6/array-iterator-turbo': [SKIP],
# TODO(jarin/mstarzinger): Investigate debugger issues with TurboFan.
'debug-set-variable-value': [FAIL],
# TODO(jgruber): Fails in --turbo --always-opt mode.
'regress/regress-105': [FAIL],
......
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