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

Unified Diff: src/runtime.cc

Issue 3017021: Fix break position not to be outside of the script (Closed)
Patch Set: long line Created 10 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 | « no previous file | test/mjsunit/debug-setbreakpoint.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index fa881eb203bc2a1e1d6693b403d6d433efcbf2a9..0b5698b180f243b2c1e6e68cc2ab4aa1ca1eed7f 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -9342,6 +9342,13 @@ static Object* Runtime_SetScriptBreakPoint(Arguments args) {
}
Debug::SetBreakPoint(shared, break_point_object_arg, &position);
position += shared->start_position();
+
+ // The result position may become beyond script source end.
+ // This is expected when the function is toplevel. This may become
+ // a problem later when actual position gets converted into line/column.
+ if (shared->is_toplevel() && position == shared->end_position()) {
+ position = shared->end_position() - 1;
+ }
return Smi::FromInt(position);
}
return Heap::undefined_value();
« no previous file with comments | « no previous file | test/mjsunit/debug-setbreakpoint.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698