Author: [email protected]
Date: Mon Dec 15 01:15:05 2008
New Revision: 977

Modified:
    branches/bleeding_edge/src/debug-delay.js
    branches/bleeding_edge/src/runtime.cc
    branches/bleeding_edge/src/runtime.h

Log:
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

Modified: branches/bleeding_edge/src/debug-delay.js
==============================================================================
--- branches/bleeding_edge/src/debug-delay.js   (original)
+++ branches/bleeding_edge/src/debug-delay.js   Mon Dec 15 01:15:05 2008
@@ -474,10 +474,18 @@

  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) {

Modified: branches/bleeding_edge/src/runtime.cc
==============================================================================
--- branches/bleeding_edge/src/runtime.cc       (original)
+++ branches/bleeding_edge/src/runtime.cc       Mon Dec 15 01:15:05 2008
@@ -919,6 +919,18 @@
  }


+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);

Modified: branches/bleeding_edge/src/runtime.h
==============================================================================
--- branches/bleeding_edge/src/runtime.h        (original)
+++ branches/bleeding_edge/src/runtime.h        Mon Dec 15 01:15:05 2008
@@ -160,6 +160,7 @@
    F(FunctionGetSourceCode, 1) \
    F(FunctionGetScript, 1) \
    F(FunctionGetScriptSourcePosition, 1) \
+  F(FunctionIsAPIFunction, 1) \
    F(GetScript, 1) \
    \
    F(ClassOf, 1) \

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to