Added type method to the debug events.
Fixed handling of script break points past the length of the script. Review URL: http://codereview.chromium.org/13126 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@917 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
5b9561b104
commit
99fb47aa06
@ -322,6 +322,10 @@ ScriptBreakPoint.prototype.set = function (script) {
|
|||||||
// Convert the line and column into an absolute position within the script.
|
// Convert the line and column into an absolute position within the script.
|
||||||
var pos = Debug.findScriptSourcePosition(script, this.line(), column);
|
var pos = 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;
|
||||||
|
|
||||||
// Create a break point object and set the break point.
|
// Create a break point object and set the break point.
|
||||||
break_point = MakeBreakPoint(pos, this.line(), this.column(), this);
|
break_point = MakeBreakPoint(pos, this.line(), this.column(), this);
|
||||||
break_point.setIgnoreCount(this.ignoreCount());
|
break_point.setIgnoreCount(this.ignoreCount());
|
||||||
@ -443,7 +447,8 @@ Debug.findFunctionSourcePosition = function(func, opt_line, opt_column) {
|
|||||||
// Returns the character position in a script based on a line number and an
|
// Returns the character position in a script based on a line number and an
|
||||||
// optional position within that line.
|
// optional position within that line.
|
||||||
Debug.findScriptSourcePosition = function(script, opt_line, opt_column) {
|
Debug.findScriptSourcePosition = function(script, opt_line, opt_column) {
|
||||||
return script.locationFromLine(opt_line, opt_column).position;
|
var location = script.locationFromLine(opt_line, opt_column);
|
||||||
|
return location ? location.position : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -727,6 +732,16 @@ function BreakEvent(exec_state, break_points_hit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BreakEvent.prototype.executionState = function() {
|
||||||
|
return this.exec_state_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
BreakEvent.prototype.eventType = function() {
|
||||||
|
return Debug.DebugEvent.Break;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
BreakEvent.prototype.func = function() {
|
BreakEvent.prototype.func = function() {
|
||||||
return this.exec_state_.frame(0).func();
|
return this.exec_state_.frame(0).func();
|
||||||
};
|
};
|
||||||
@ -799,12 +814,24 @@ function MakeExceptionEvent(exec_state, exception, uncaught) {
|
|||||||
return new ExceptionEvent(exec_state, exception, uncaught);
|
return new ExceptionEvent(exec_state, exception, uncaught);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function ExceptionEvent(exec_state, exception, uncaught) {
|
function ExceptionEvent(exec_state, exception, uncaught) {
|
||||||
this.exec_state_ = exec_state;
|
this.exec_state_ = exec_state;
|
||||||
this.exception_ = exception;
|
this.exception_ = exception;
|
||||||
this.uncaught_ = uncaught;
|
this.uncaught_ = uncaught;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ExceptionEvent.prototype.executionState = function() {
|
||||||
|
return this.exec_state_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
ExceptionEvent.prototype.eventType = function() {
|
||||||
|
return Debug.DebugEvent.Exception;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
ExceptionEvent.prototype.uncaught = function() {
|
ExceptionEvent.prototype.uncaught = function() {
|
||||||
return this.uncaught_;
|
return this.uncaught_;
|
||||||
}
|
}
|
||||||
@ -855,18 +882,28 @@ ExceptionEvent.prototype.toJSONProtocol = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function MakeCompileEvent(script_source, script_name, script_function) {
|
function MakeCompileEvent(script_source, script_name, script_function, before) {
|
||||||
return new CompileEvent(script_source, script_name, script_function);
|
return new CompileEvent(script_source, script_name, script_function, before);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function CompileEvent(script_source, script_name, script_function) {
|
function CompileEvent(script_source, script_name, script_function, before) {
|
||||||
this.scriptSource = script_source;
|
this.scriptSource = script_source;
|
||||||
this.scriptName = script_name;
|
this.scriptName = script_name;
|
||||||
this.scriptFunction = script_function;
|
this.scriptFunction = script_function;
|
||||||
|
this.before = before;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CompileEvent.prototype.eventType = function() {
|
||||||
|
if (this.before) {
|
||||||
|
return Debug.DebugEvent.BeforeComplie;
|
||||||
|
} else {
|
||||||
|
return Debug.DebugEvent.AfterComplie;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
function MakeNewFunctionEvent(func) {
|
function MakeNewFunctionEvent(func) {
|
||||||
return new NewFunctionEvent(func);
|
return new NewFunctionEvent(func);
|
||||||
}
|
}
|
||||||
@ -876,6 +913,12 @@ function NewFunctionEvent(func) {
|
|||||||
this.func = func;
|
this.func = func;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NewFunctionEvent.prototype.eventType = function() {
|
||||||
|
return Debug.DebugEvent.NewFunction;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
NewFunctionEvent.prototype.name = function() {
|
NewFunctionEvent.prototype.name = function() {
|
||||||
return this.func.name;
|
return this.func.name;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user