summaryrefslogtreecommitdiff
path: root/deps
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2016-08-14 11:24:08 +0200
committerMichaël Zasso <targos@protonmail.com>2016-08-17 09:38:07 +0200
commita1d3a8db50fcbb3fb0639cb1bd8077d2c290a21b (patch)
tree1b60e4023bc580caf31fb5b92ea6fc3dc49ba0e3 /deps
parent8badb6776123a5e56e0dd675e03c97d52746b279 (diff)
downloadandroid-node-v8-a1d3a8db50fcbb3fb0639cb1bd8077d2c290a21b.tar.gz
android-node-v8-a1d3a8db50fcbb3fb0639cb1bd8077d2c290a21b.tar.bz2
android-node-v8-a1d3a8db50fcbb3fb0639cb1bd8077d2c290a21b.zip
deps: cherry-pick de5aaad from V8's upstream
Original commit message: [Debugger] Fix StepNext over function with caught exception Without CL debugger on StepNext adds breakpoint to function where throw instruction is located. In case of StepNext we will skip pause in this function because StepNext shouldn't break in a deeper frame. BUG=chromium:604495 R=yangguo@chromium.org LOG=N Review URL: https://codereview.chromium.org/1894263002 Cr-Commit-Position: refs/heads/master@{#35627} Fixes: https://github.com/nodejs/node/issues/7219 PR-URL: https://github.com/nodejs/node/pull/8099 Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Diffstat (limited to 'deps')
-rw-r--r--deps/v8/include/v8-version.h2
-rw-r--r--deps/v8/src/debug/debug.cc8
-rw-r--r--deps/v8/test/cctest/test-debug.cc33
3 files changed, 42 insertions, 1 deletions
diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h
index e9d2a7541c..52125445b4 100644
--- a/deps/v8/include/v8-version.h
+++ b/deps/v8/include/v8-version.h
@@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 5
#define V8_MINOR_VERSION 1
#define V8_BUILD_NUMBER 281
-#define V8_PATCH_LEVEL 80
+#define V8_PATCH_LEVEL 81
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
diff --git a/deps/v8/src/debug/debug.cc b/deps/v8/src/debug/debug.cc
index 7c76742bb9..cb2d8648aa 100644
--- a/deps/v8/src/debug/debug.cc
+++ b/deps/v8/src/debug/debug.cc
@@ -962,6 +962,14 @@ void Debug::PrepareStepOnThrow() {
it.Advance();
}
+ if (last_step_action() == StepNext) {
+ while (!it.done()) {
+ Address current_fp = it.frame()->UnpaddedFP();
+ if (current_fp >= thread_local_.target_fp_) break;
+ it.Advance();
+ }
+ }
+
// Find the closest Javascript frame we can flood with one-shots.
while (!it.done() &&
!it.frame()->function()->shared()->IsSubjectToDebugging()) {
diff --git a/deps/v8/test/cctest/test-debug.cc b/deps/v8/test/cctest/test-debug.cc
index ab27f394e9..192dce7b9f 100644
--- a/deps/v8/test/cctest/test-debug.cc
+++ b/deps/v8/test/cctest/test-debug.cc
@@ -8185,3 +8185,36 @@ TEST(DebugStepNextTailCallEliminiation) {
ExpectString("JSON.stringify(log)",
"[\"a4\",\"b2\",\"c4\",\"e0\",\"e0\",\"e0\",\"e0\",\"f0\"]");
}
+
+size_t current_action = 0;
+StepAction actions[] = {StepNext, StepNext};
+static void DebugStepOverFunctionWithCaughtExceptionListener(
+ const v8::Debug::EventDetails& event_details) {
+ v8::DebugEvent event = event_details.GetEvent();
+ if (event != v8::Break) return;
+ ++break_point_hit_count;
+ if (current_action >= 2) return;
+ PrepareStep(actions[current_action]);
+}
+
+TEST(DebugStepOverFunctionWithCaughtException) {
+ i::FLAG_allow_natives_syntax = true;
+
+ DebugLocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ v8::HandleScope scope(isolate);
+ v8::Debug::SetDebugEventListener(
+ isolate, DebugStepOverFunctionWithCaughtExceptionListener);
+
+ break_point_hit_count = 0;
+ CompileRun(
+ "function foo() {\n"
+ " try { throw new Error(); } catch (e) {}\n"
+ "}\n"
+ "debugger;\n"
+ "foo();\n"
+ "foo();\n");
+
+ v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr);
+ CHECK_EQ(break_point_hit_count, 4);
+}