v8/test/mjsunit/regress/regress-419663.js
yangguo@chromium.org 83ddaa0df7 Fix break location calculation.
R=ulan@chromium.org
BUG=chromium:419663
LOG=Y

Review URL: https://codereview.chromium.org/658723005

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24697 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2014-10-17 14:11:01 +00:00

38 lines
913 B
JavaScript

// Copyright 2012 the V8 project authors. All rights reserved.
// 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 o = {
f: function(x) {
var a = x + 1;
o = 1;
}
}
function sentinel() {}
var Debug = debug.Debug;
Debug.setListener(function() {});
var script = Debug.findScript(sentinel);
// Used in Debug.setScriptBreakPointById.
var p = Debug.findScriptSourcePosition(script, 9, 0);
var q = Debug.setBreakPointByScriptIdAndPosition(script.id, p).actual_position;
var r = Debug.setBreakPointByScriptIdAndPosition(script.id, q).actual_position;
assertEquals(q, r);
function assertLocation(p, l, c) {
var location = script.locationFromPosition(p, false);
assertEquals(l, location.line);
assertEquals(c, location.column);
}
assertLocation(p, 9, 0);
assertLocation(q, 9, 4);
assertLocation(r, 9, 4);