diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2011-11-10 16:00:37 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-12 16:57:32 +0200 |
commit | 976ab81b10b04fc0d0be44ff31d311d644b28f42 (patch) | |
tree | cf488bed36642b8a5317f3e039bccbb300e172c1 | |
parent | 12cdefad03997ed444c1192f2c9e0500314a16d4 (diff) |
[V8] Add flag to avoid breakpoint relocation
Add a flag that prevents v8 from relocating breakpoints across
line boundaries.
Change-Id: I7caafdf91ff161c3566078685daef56526bc5926
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
-rw-r--r-- | src/3rdparty/v8/src/debug-debugger.js | 5 | ||||
-rw-r--r-- | src/3rdparty/v8/src/flag-definitions.h | 1 | ||||
-rw-r--r-- | src/3rdparty/v8/src/runtime.cc | 6 | ||||
-rw-r--r-- | src/3rdparty/v8/src/runtime.h | 1 | ||||
-rw-r--r-- | src/3rdparty/v8/test/cctest/test-debug.cc | 59 |
5 files changed, 72 insertions, 0 deletions
diff --git a/src/3rdparty/v8/src/debug-debugger.js b/src/3rdparty/v8/src/debug-debugger.js index 7787312..6c94c15 100644 --- a/src/3rdparty/v8/src/debug-debugger.js +++ b/src/3rdparty/v8/src/debug-debugger.js @@ -448,6 +448,11 @@ ScriptBreakPoint.prototype.set = function (script) { actual_position = position; } var actual_location = script.locationFromPosition(actual_position, true); + // Check for any relocation and compare it with the breakpoint_relocation flag + if (actual_location.line != line && !%AllowBreakPointRelocation()) { + %ClearBreakPoint(break_point); + return; + } break_point.actual_location = { line: actual_location.line, column: actual_location.column, script_id: script.id }; diff --git a/src/3rdparty/v8/src/flag-definitions.h b/src/3rdparty/v8/src/flag-definitions.h index dcc6c2c..135833b 100644 --- a/src/3rdparty/v8/src/flag-definitions.h +++ b/src/3rdparty/v8/src/flag-definitions.h @@ -387,6 +387,7 @@ DEFINE_implication(trace_array_abuse, trace_external_array_abuse) DEFINE_bool(debugger_auto_break, true, "automatically set the debug break flag when debugger commands are " "in the queue") +DEFINE_bool(breakpoint_relocation, true, "relocate breakpoints to the next executable line") DEFINE_bool(enable_liveedit, true, "enable liveedit experimental feature") DEFINE_bool(break_on_abort, true, "always cause a debug break before aborting") diff --git a/src/3rdparty/v8/src/runtime.cc b/src/3rdparty/v8/src/runtime.cc index c465a5b..191e717 100644 --- a/src/3rdparty/v8/src/runtime.cc +++ b/src/3rdparty/v8/src/runtime.cc @@ -11637,6 +11637,12 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetBreakLocations) { } +// Return the value of breakpoint_relocation flag +RUNTIME_FUNCTION(MaybeObject*, Runtime_AllowBreakPointRelocation) { + return Smi::FromInt(FLAG_breakpoint_relocation); +} + + // Set a break point in a function. // args[0]: function // args[1]: number: break source position (within the function source) diff --git a/src/3rdparty/v8/src/runtime.h b/src/3rdparty/v8/src/runtime.h index 036264e..74cc2d8 100644 --- a/src/3rdparty/v8/src/runtime.h +++ b/src/3rdparty/v8/src/runtime.h @@ -447,6 +447,7 @@ namespace internal { F(GetThreadDetails, 2, 1) \ F(SetDisableBreak, 1, 1) \ F(GetBreakLocations, 1, 1) \ + F(AllowBreakPointRelocation, 0, 1) \ F(SetFunctionBreakPoint, 3, 1) \ F(SetScriptBreakPoint, 3, 1) \ F(ClearBreakPoint, 1, 1) \ diff --git a/src/3rdparty/v8/test/cctest/test-debug.cc b/src/3rdparty/v8/test/cctest/test-debug.cc index 8d37440..51eb203 100644 --- a/src/3rdparty/v8/test/cctest/test-debug.cc +++ b/src/3rdparty/v8/test/cctest/test-debug.cc @@ -2304,6 +2304,65 @@ TEST(ScriptBreakPointTopLevelCrash) { CheckDebuggerUnloaded(); } +// Test that breakpoint_relocation flag is honored +TEST(ScriptBreakPointNoRelocation) { + i::FLAG_breakpoint_relocation = false; + + v8::HandleScope scope; + DebugLocalContext env; + env.ExposeDebug(); + + // Create a function for checking the function when hitting a break point. + frame_function_name = CompileFunction(&env, + frame_function_name_source, + "frame_function_name"); + + v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount, + v8::Undefined()); + + v8::Local<v8::String> script1 = v8::String::New( + "a = 0 // line 0\n" + " // line 1\n" + " // line 2\n" + " // line 3\n" + "function f() { // line 4\n" + " return 0; // line 5\n" + "} // line 6"); + + // Set the script break point on the empty line + SetScriptBreakPointByNameFromJS("test.html", 2, -1); + + // Compile the script and call the function. + v8::ScriptOrigin origin(v8::String::New("test.html"), v8::Integer::New(0)); + v8::Script::Compile(script1, &origin)->Run(); + v8::Local<v8::Function> f = + v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f"))); + f->Call(env->Global(), 0, NULL); + + // Check that a break point was not hit + CHECK_EQ(0, break_point_hit_count); + + v8::Local<v8::String> script2 = v8::String::New( + "a = 0 // line 0\n" + "function g() { // line 1\n" + " return 0; // line 2\n" + "} // line 3\n" + "function f() { // line 4\n" + " return 0; // line 5\n" + "} // line 6"); + + // Compile the script and call the new function + v8::Script::Compile(script2, &origin)->Run(); + v8::Local<v8::Function> g = + v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("g"))); + g->Call(env->Global(), 0, NULL); + + // Check that a break point was not hit + CHECK_EQ(1, break_point_hit_count); + + v8::Debug::SetDebugEventListener(NULL); + CheckDebuggerUnloaded(); +} // Test that it is possible to remove the last break point for a function // inside the break handling of that break point. |