diff options
| author | Steve Block <steveblock@google.com> | 2010-07-08 12:39:36 +0100 |
|---|---|---|
| committer | Steve Block <steveblock@google.com> | 2010-07-08 12:41:04 +0100 |
| commit | 8defd9ff6930b4e24729971a61cf7469daf119be (patch) | |
| tree | 3be589af44201dcaead530f4046cb63e7c9b68c4 /src/debug-debugger.js | |
| parent | 85dec77e821ae98054f8e09ba3180c148a9264d6 (diff) | |
| download | android_external_v8-8defd9ff6930b4e24729971a61cf7469daf119be.tar.gz android_external_v8-8defd9ff6930b4e24729971a61cf7469daf119be.tar.bz2 android_external_v8-8defd9ff6930b4e24729971a61cf7469daf119be.zip | |
Update V8 to r5017 as required by WebKit r62496
Change-Id: I1b4b7718d1d77ceef07f543e9150a2cb3a628f3a
Diffstat (limited to 'src/debug-debugger.js')
| -rw-r--r-- | src/debug-debugger.js | 77 |
1 files changed, 51 insertions, 26 deletions
diff --git a/src/debug-debugger.js b/src/debug-debugger.js index d5e91cbd..47a3c8e3 100644 --- a/src/debug-debugger.js +++ b/src/debug-debugger.js @@ -236,6 +236,7 @@ function ScriptBreakPoint(type, script_id_or_name, opt_line, opt_column, this.active_ = true; this.condition_ = null; this.ignoreCount_ = 0; + this.break_points_ = []; } @@ -289,6 +290,15 @@ ScriptBreakPoint.prototype.column = function() { }; +ScriptBreakPoint.prototype.actual_locations = function() { + var locations = []; + for (var i = 0; i < this.break_points_.length; i++) { + locations.push(this.break_points_[i].actual_location); + } + return locations; +} + + ScriptBreakPoint.prototype.update_positions = function(line, column) { this.line_ = line; this.column_ = column; @@ -334,10 +344,8 @@ ScriptBreakPoint.prototype.setIgnoreCount = function(ignoreCount) { this.ignoreCount_ = ignoreCount; // Set ignore count on all break points created from this script break point. - for (var i = 0; i < break_points.length; i++) { - if (break_points[i].script_break_point() === this) { - break_points[i].setIgnoreCount(ignoreCount); - } + for (var i = 0; i < this.break_points_.length; i++) { + this.break_points_[i].setIgnoreCount(ignoreCount); } }; @@ -379,20 +387,23 @@ ScriptBreakPoint.prototype.set = function (script) { } // Convert the line and column into an absolute position within the script. - var pos = Debug.findScriptSourcePosition(script, this.line(), column); + var position = Debug.findScriptSourcePosition(script, this.line(), column); // If the position is not found in the script (the script might be shorter // than it used to be) just ignore it. - if (pos === null) return; + if (position === null) return; // Create a break point object and set the break point. - break_point = MakeBreakPoint(pos, this.line(), this.column(), this); + break_point = MakeBreakPoint(position, this.line(), this.column(), this); break_point.setIgnoreCount(this.ignoreCount()); - pos = %SetScriptBreakPoint(script, pos, break_point); - if (!IS_UNDEFINED(pos)) { - this.actual_location = script.locationFromPosition(pos); - } - + var actual_position = %SetScriptBreakPoint(script, position, break_point); + if (IS_UNDEFINED(actual_position)) { + actual_position = position; + } + var actual_location = script.locationFromPosition(actual_position, true); + break_point.actual_location = { line: actual_location.line, + column: actual_location.column }; + this.break_points_.push(break_point); return break_point; }; @@ -409,6 +420,7 @@ ScriptBreakPoint.prototype.clear = function () { } } break_points = remaining_break_points; + this.break_points_ = []; }; @@ -554,6 +566,19 @@ Debug.findBreakPoint = function(break_point_number, remove) { } }; +Debug.findBreakPointActualLocations = function(break_point_number) { + for (var i = 0; i < script_break_points.length; i++) { + if (script_break_points[i].number() == break_point_number) { + return script_break_points[i].actual_locations(); + } + } + for (var i = 0; i < break_points.length; i++) { + if (break_points[i].number() == break_point_number) { + return [break_points[i].actual_location]; + } + } + return []; +} Debug.setBreakPoint = function(func, opt_line, opt_column, opt_condition) { if (!IS_FUNCTION(func)) throw new Error('Parameters have wrong types.'); @@ -585,7 +610,12 @@ Debug.setBreakPoint = function(func, opt_line, opt_column, opt_condition) { } else { // Set a break point directly on the function. var break_point = MakeBreakPoint(source_position, opt_line, opt_column); - %SetFunctionBreakPoint(func, source_position, break_point); + var actual_position = + %SetFunctionBreakPoint(func, source_position, break_point); + actual_position += this.sourcePosition(func); + var actual_location = script.locationFromPosition(actual_position, true); + break_point.actual_location = { line: actual_location.line, + column: actual_location.column }; break_point.setCondition(opt_condition); return break_point.number(); } @@ -1482,8 +1512,10 @@ DebugCommandProcessor.prototype.setBreakPointRequest_ = } response.body.line = break_point.line(); response.body.column = break_point.column(); + response.body.actual_locations = break_point.actual_locations(); } else { response.body.type = 'function'; + response.body.actual_locations = [break_point.actual_location]; } }; @@ -1598,7 +1630,8 @@ DebugCommandProcessor.prototype.listBreakpointsRequest_ = function(request, resp hit_count: break_point.hit_count(), active: break_point.active(), condition: break_point.condition(), - ignoreCount: break_point.ignoreCount() + ignoreCount: break_point.ignoreCount(), + actual_locations: break_point.actual_locations() } if (break_point.type() == Debug.ScriptBreakPointType.ScriptId) { @@ -2037,6 +2070,7 @@ DebugCommandProcessor.prototype.changeLiveRequest_ = function(request, response) return response.failed('Missing arguments'); } var script_id = request.arguments.script_id; + var preview_only = !!request.arguments.preview_only; var scripts = %DebugGetLoadedScripts(); @@ -2059,18 +2093,9 @@ DebugCommandProcessor.prototype.changeLiveRequest_ = function(request, response) var new_source = request.arguments.new_source; - try { - Debug.LiveEdit.SetScriptSource(the_script, new_source, change_log); - } catch (e) { - if (e instanceof Debug.LiveEdit.Failure) { - // Let's treat it as a "success" so that body with change_log will be - // sent back. "change_log" will have "failure" field set. - change_log.push( { failure: true, message: e.toString() } ); - } else { - throw e; - } - } - response.body = {change_log: change_log}; + var result_description = Debug.LiveEdit.SetScriptSource(the_script, + new_source, preview_only, change_log); + response.body = {change_log: change_log, result: result_description}; }; |
