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

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

Issue 1894263002: [Debugger] Fix StepNext over function with caught exception (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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 | « src/debug/debug.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 ab27f394e9aa3eae108605022cccad977051a5dc..192dce7b9f635fa9c7f421bf2729bb3e1244635f 100644
--- a/test/cctest/test-debug.cc
+++ b/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);
+}
« no previous file with comments | « src/debug/debug.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698