Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1442)

Unified Diff: test/cctest/test-debug.cc

Issue 2169463002: [debugger] use absolute source positions for break locations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: address comment Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/heap/test-heap.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-debug.cc
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index df3efd6ff9baa27e8f26404d9c0412f1533bb5d9..8935d8da70ef9a747bd75f6da5a7f3f189150713 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -157,29 +157,23 @@ static bool HasDebugInfo(v8::Local<v8::Function> fun) {
return shared->HasDebugInfo();
}
-
-// Set a break point in a function and return the associated break point
-// number.
-static int SetBreakPoint(Handle<v8::internal::JSFunction> fun, int position) {
+// Set a break point in a function with a position relative to function start,
+// and return the associated break point number.
+static int SetBreakPoint(v8::Local<v8::Function> fun, int position) {
+ i::Handle<i::JSFunction> function =
+ i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*fun));
+ position += function->shared()->start_position();
static int break_point = 0;
- v8::internal::Isolate* isolate = fun->GetIsolate();
+ v8::internal::Isolate* isolate = function->GetIsolate();
v8::internal::Debug* debug = isolate->debug();
debug->SetBreakPoint(
- fun,
+ function,
Handle<Object>(v8::internal::Smi::FromInt(++break_point), isolate),
&position);
return break_point;
}
-// Set a break point in a function and return the associated break point
-// number.
-static int SetBreakPoint(v8::Local<v8::Function> fun, int position) {
- return SetBreakPoint(
- i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*fun)), position);
-}
-
-
// Set a break point in a function using the Debug object and return the
// associated break point number.
static int SetBreakPointFromJS(v8::Isolate* isolate,
@@ -8039,29 +8033,29 @@ TEST(BreakLocationIterator) {
TestBreakLocation::Iterator* iterator =
TestBreakLocation::GetIterator(debug_info, i::ALL_BREAK_LOCATIONS);
CHECK(iterator->GetBreakLocation().IsDebuggerStatement());
- CHECK_EQ(7, iterator->GetBreakLocation().position());
+ CHECK_EQ(17, iterator->GetBreakLocation().position());
iterator->Next();
CHECK(iterator->GetBreakLocation().IsDebugBreakSlot());
- CHECK_EQ(22, iterator->GetBreakLocation().position());
+ CHECK_EQ(32, iterator->GetBreakLocation().position());
iterator->Next();
CHECK(iterator->GetBreakLocation().IsCall());
- CHECK_EQ(22, iterator->GetBreakLocation().position());
+ CHECK_EQ(32, iterator->GetBreakLocation().position());
iterator->Next();
CHECK(iterator->GetBreakLocation().IsDebuggerStatement());
- CHECK_EQ(37, iterator->GetBreakLocation().position());
+ CHECK_EQ(47, iterator->GetBreakLocation().position());
iterator->Next();
CHECK(iterator->GetBreakLocation().IsReturn());
- CHECK_EQ(50, iterator->GetBreakLocation().position());
+ CHECK_EQ(60, iterator->GetBreakLocation().position());
iterator->Next();
CHECK(iterator->Done());
delete iterator;
iterator = TestBreakLocation::GetIterator(debug_info, i::CALLS_AND_RETURNS);
CHECK(iterator->GetBreakLocation().IsCall());
- CHECK_EQ(22, iterator->GetBreakLocation().position());
+ CHECK_EQ(32, iterator->GetBreakLocation().position());
iterator->Next();
CHECK(iterator->GetBreakLocation().IsReturn());
- CHECK_EQ(50, iterator->GetBreakLocation().position());
+ CHECK_EQ(60, iterator->GetBreakLocation().position());
iterator->Next();
CHECK(iterator->Done());
delete iterator;
« no previous file with comments | « test/cctest/heap/test-heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698