Give an error when setting break points in functions either defined through the API or in functions which are part of the V8 builtins.
BUG=178 Review URL: http://codereview.chromium.org/13785 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@977 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
f7168008ea
commit
2d66455dc0
@ -474,10 +474,18 @@ Debug.findBreakPoint = function(break_point_number, remove) {
|
||||
|
||||
Debug.setBreakPoint = function(func, opt_line, opt_column, opt_condition) {
|
||||
if (!IS_FUNCTION(func)) throw new Error('Parameters have wrong types.');
|
||||
// Break points in API functions are not supported.
|
||||
if (%FunctionIsAPIFunction(func)) {
|
||||
throw new Error('Cannot set break point in native code.');
|
||||
}
|
||||
var source_position = this.findFunctionSourcePosition(func, opt_line, opt_column) -
|
||||
this.sourcePosition(func);
|
||||
// Find the script for the function.
|
||||
var script = %FunctionGetScript(func);
|
||||
// Break in builtin JavaScript code is not supported.
|
||||
if (script.type == Debug.ScriptType.Native) {
|
||||
throw new Error('Cannot set break point in native code.');
|
||||
}
|
||||
// If the script for the function has a name convert this to a script break
|
||||
// point.
|
||||
if (script && script.name) {
|
||||
|
@ -919,6 +919,18 @@ static Object* Runtime_FunctionSetPrototype(Arguments args) {
|
||||
}
|
||||
|
||||
|
||||
static Object* Runtime_FunctionIsAPIFunction(Arguments args) {
|
||||
NoHandleAllocation ha;
|
||||
ASSERT(args.length() == 1);
|
||||
|
||||
CONVERT_CHECKED(JSFunction, f, args[0]);
|
||||
// The function_data field of the shared function info is used exclusively by
|
||||
// the API.
|
||||
return !f->shared()->function_data()->IsUndefined() ? Heap::true_value()
|
||||
: Heap::false_value();
|
||||
}
|
||||
|
||||
|
||||
static Object* Runtime_SetCode(Arguments args) {
|
||||
HandleScope scope;
|
||||
ASSERT(args.length() == 2);
|
||||
|
@ -160,6 +160,7 @@ namespace v8 { namespace internal {
|
||||
F(FunctionGetSourceCode, 1) \
|
||||
F(FunctionGetScript, 1) \
|
||||
F(FunctionGetScriptSourcePosition, 1) \
|
||||
F(FunctionIsAPIFunction, 1) \
|
||||
F(GetScript, 1) \
|
||||
\
|
||||
F(ClassOf, 1) \
|
||||
|
Loading…
Reference in New Issue
Block a user