Revision: 4879
Author: [email protected]
Date: Wed Jun 16 07:50:07 2010
Log: Save actual break point location to script break point object.
Review URL: http://codereview.chromium.org/2864003
http://code.google.com/p/v8/source/detail?r=4879
Modified:
/branches/bleeding_edge/src/debug-debugger.js
/branches/bleeding_edge/src/debug.cc
/branches/bleeding_edge/src/debug.h
/branches/bleeding_edge/src/runtime.cc
/branches/bleeding_edge/test/cctest/test-debug.cc
/branches/bleeding_edge/test/mjsunit/debug-setbreakpoint.js
=======================================
--- /branches/bleeding_edge/src/debug-debugger.js Fri May 14 12:20:07 2010
+++ /branches/bleeding_edge/src/debug-debugger.js Wed Jun 16 07:50:07 2010
@@ -293,7 +293,6 @@
this.line_ = line;
this.column_ = column;
}
-
ScriptBreakPoint.prototype.hit_count = function() {
@@ -389,7 +388,10 @@
// Create a break point object and set the break point.
break_point = MakeBreakPoint(pos, this.line(), this.column(), this);
break_point.setIgnoreCount(this.ignoreCount());
- %SetScriptBreakPoint(script, pos, break_point);
+ pos = %SetScriptBreakPoint(script, pos, break_point);
+ if (!IS_UNDEFINED(pos)) {
+ this.actual_location = script.locationFromPosition(pos);
+ }
return break_point;
};
=======================================
--- /branches/bleeding_edge/src/debug.cc Thu Jun 10 02:02:16 2010
+++ /branches/bleeding_edge/src/debug.cc Wed Jun 16 07:50:07 2010
@@ -1028,8 +1028,8 @@
void Debug::SetBreakPoint(Handle<SharedFunctionInfo> shared,
- int source_position,
- Handle<Object> break_point_object) {
+ Handle<Object> break_point_object,
+ int* source_position) {
HandleScope scope;
if (!EnsureDebugInfo(shared)) {
@@ -1043,9 +1043,11 @@
// Find the break point and change it.
BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS);
- it.FindBreakLocationFromPosition(source_position);
+ it.FindBreakLocationFromPosition(*source_position);
it.SetBreakPoint(break_point_object);
+ *source_position = it.position();
+
// At least one active break point now.
ASSERT(debug_info->GetBreakPointCount() > 0);
}
=======================================
--- /branches/bleeding_edge/src/debug.h Thu Jun 10 02:02:16 2010
+++ /branches/bleeding_edge/src/debug.h Wed Jun 16 07:50:07 2010
@@ -230,8 +230,8 @@
static Object* Break(Arguments args);
static void SetBreakPoint(Handle<SharedFunctionInfo> shared,
- int source_position,
- Handle<Object> break_point_object);
+ Handle<Object> break_point_object,
+ int* source_position);
static void ClearBreakPoint(Handle<Object> break_point_object);
static void ClearAllBreakPoints();
static void FloodWithOneShot(Handle<SharedFunctionInfo> shared);
=======================================
--- /branches/bleeding_edge/src/runtime.cc Mon Jun 14 06:55:38 2010
+++ /branches/bleeding_edge/src/runtime.cc Wed Jun 16 07:50:07 2010
@@ -9061,7 +9061,7 @@
Handle<Object> break_point_object_arg = args.at<Object>(2);
// Set break point.
- Debug::SetBreakPoint(shared, source_position, break_point_object_arg);
+ Debug::SetBreakPoint(shared, break_point_object_arg, &source_position);
return Heap::undefined_value();
}
@@ -9159,8 +9159,9 @@
}
-// Change the state of a break point in a script. NOTE: Regarding
performance
-// see the NOTE for GetScriptFromScriptData.
+// Changes the state of a break point in a script and returns source
position
+// where break point was set. NOTE: Regarding performance see the NOTE for
+// GetScriptFromScriptData.
// args[0]: script to set break point in
// args[1]: number: break source position (within the script source)
// args[2]: number: break point object
@@ -9188,7 +9189,9 @@
} else {
position = source_position - shared->start_position();
}
- Debug::SetBreakPoint(shared, position, break_point_object_arg);
+ Debug::SetBreakPoint(shared, break_point_object_arg, &position);
+ position += shared->start_position();
+ return Smi::FromInt(position);
}
return Heap::undefined_value();
}
=======================================
--- /branches/bleeding_edge/test/cctest/test-debug.cc Tue Jun 15 10:01:02
2010
+++ /branches/bleeding_edge/test/cctest/test-debug.cc Wed Jun 16 07:50:07
2010
@@ -192,8 +192,9 @@
static int break_point = 0;
Handle<v8::internal::SharedFunctionInfo> shared(fun->shared());
Debug::SetBreakPoint(
- shared, position,
- Handle<Object>(v8::internal::Smi::FromInt(++break_point)));
+ shared,
+ Handle<Object>(v8::internal::Smi::FromInt(++break_point)),
+ &position);
return break_point;
}
=======================================
--- /branches/bleeding_edge/test/mjsunit/debug-setbreakpoint.js Thu Apr 1
09:25:07 2010
+++ /branches/bleeding_edge/test/mjsunit/debug-setbreakpoint.js Wed Jun 16
07:50:07 2010
@@ -134,6 +134,7 @@
};
function g() {
+ // Comment.
f();
};
@@ -184,3 +185,8 @@
sourceUrlFunc();
assertTrue(breakListenerCalled, "Break listener not called on breakpoint
set by sourceURL");
+
+// Set a break point on a line with the comment, and check that actual
position
+// is the next line after the comment.
+var number = Debug.setScriptBreakPointById(g_script_id, g_line + 1);
+assertEquals(g_line + 2,
Debug.findBreakPoint(number).actual_location.line);
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev