Add function for setting breakpoint by scriptId and position to debugger script

Review URL: http://codereview.chromium.org/6301001

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6302 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8805509f
......@@ -112,8 +112,8 @@ var debugger_flags = {
// Create a new break point object and add it to the list of break points.
function MakeBreakPoint(source_position, opt_line, opt_column, opt_script_break_point) {
var break_point = new BreakPoint(source_position, opt_line, opt_column, opt_script_break_point);
function MakeBreakPoint(source_position, opt_script_break_point) {
var break_point = new BreakPoint(source_position, opt_script_break_point);
break_points.push(break_point);
return break_point;
}
......@@ -123,10 +123,8 @@ function MakeBreakPoint(source_position, opt_line, opt_column, opt_script_break_
// NOTE: This object does not have a reference to the function having break
// point as this would cause function not to be garbage collected when it is
// not used any more. We do not want break points to keep functions alive.
function BreakPoint(source_position, opt_line, opt_column, opt_script_break_point) {
function BreakPoint(source_position, opt_script_break_point) {
this.source_position_ = source_position;
this.source_line_ = opt_line;
this.source_column_ = opt_column;
if (opt_script_break_point) {
this.script_break_point_ = opt_script_break_point;
} else {
......@@ -424,7 +422,7 @@ ScriptBreakPoint.prototype.set = function (script) {
if (position === null) return;
// Create a break point object and set the break point.
break_point = MakeBreakPoint(position, this.line(), this.column(), this);
break_point = MakeBreakPoint(position, this);
break_point.setIgnoreCount(this.ignoreCount());
var actual_position = %SetScriptBreakPoint(script, position, break_point);
if (IS_UNDEFINED(actual_position)) {
......@@ -639,7 +637,7 @@ Debug.setBreakPoint = function(func, opt_line, opt_column, opt_condition) {
opt_condition);
} else {
// Set a break point directly on the function.
var break_point = MakeBreakPoint(source_position, opt_line, opt_column);
var break_point = MakeBreakPoint(source_position);
var actual_position =
%SetFunctionBreakPoint(func, source_position, break_point);
actual_position += this.sourcePosition(func);
......@@ -652,6 +650,25 @@ Debug.setBreakPoint = function(func, opt_line, opt_column, opt_condition) {
};
Debug.setBreakPointByScriptIdAndPosition = function(script_id, position,
condition, enabled)
{
break_point = MakeBreakPoint(position);
break_point.setCondition(condition);
if (!enabled)
break_point.disable();
var scripts = this.scripts();
for (var i = 0; i < scripts.length; i++) {
if (script_id == scripts[i].id) {
break_point.actual_position = %SetScriptBreakPoint(scripts[i], position,
break_point);
break;
}
}
return break_point;
};
Debug.enableBreakPoint = function(break_point_number) {
var break_point = this.findBreakPoint(break_point_number, false);
// Only enable if the breakpoint hasn't been deleted:
......
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