Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 1 | // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | // Flags: --expose-debug-as debug |
| 6 | |
| 7 | var o = { |
| 8 | f: function(x) { |
| 9 | var a = x + 1; |
| 10 | o = 1; |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | function sentinel() {} |
| 15 | |
| 16 | var Debug = debug.Debug; |
| 17 | |
| 18 | Debug.setListener(function() {}); |
| 19 | |
| 20 | var script = Debug.findScript(sentinel); |
| 21 | |
| 22 | // Used in Debug.setScriptBreakPointById. |
| 23 | var p = Debug.findScriptSourcePosition(script, 9, 0); |
| 24 | var q = Debug.setBreakPointByScriptIdAndPosition(script.id, p).actual_position; |
| 25 | var r = Debug.setBreakPointByScriptIdAndPosition(script.id, q).actual_position; |
| 26 | |
| 27 | assertEquals(q, r); |
| 28 | |
| 29 | function assertLocation(p, l, c) { |
| 30 | var location = script.locationFromPosition(p, false); |
| 31 | assertEquals(l, location.line); |
| 32 | assertEquals(c, location.column); |
| 33 | } |
| 34 | |
| 35 | assertLocation(p, 9, 0); |
| 36 | assertLocation(q, 9, 4); |
| 37 | assertLocation(r, 9, 4); |