OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 8167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8178 v8::Debug::SetTailCallEliminationEnabled(isolate, false); | 8178 v8::Debug::SetTailCallEliminationEnabled(isolate, false); |
8179 CompileRun( | 8179 CompileRun( |
8180 "log = []; \n" | 8180 "log = []; \n" |
8181 "Debug.setListener(listener); \n" | 8181 "Debug.setListener(listener); \n" |
8182 "f(5); \n" | 8182 "f(5); \n" |
8183 "Debug.setListener(null); // Break f \n"); | 8183 "Debug.setListener(null); // Break f \n"); |
8184 ExpectNull("exception"); | 8184 ExpectNull("exception"); |
8185 ExpectString("JSON.stringify(log)", | 8185 ExpectString("JSON.stringify(log)", |
8186 "[\"a4\",\"b2\",\"c4\",\"e0\",\"e0\",\"e0\",\"e0\",\"f0\"]"); | 8186 "[\"a4\",\"b2\",\"c4\",\"e0\",\"e0\",\"e0\",\"e0\",\"f0\"]"); |
8187 } | 8187 } |
| 8188 |
| 8189 size_t current_action = 0; |
| 8190 StepAction actions[] = {StepNext, StepNext}; |
| 8191 static void DebugStepOverFunctionWithCaughtExceptionListener( |
| 8192 const v8::Debug::EventDetails& event_details) { |
| 8193 v8::DebugEvent event = event_details.GetEvent(); |
| 8194 if (event != v8::Break) return; |
| 8195 ++break_point_hit_count; |
| 8196 if (current_action >= 2) return; |
| 8197 PrepareStep(actions[current_action]); |
| 8198 } |
| 8199 |
| 8200 TEST(DebugStepOverFunctionWithCaughtException) { |
| 8201 i::FLAG_allow_natives_syntax = true; |
| 8202 |
| 8203 DebugLocalContext env; |
| 8204 v8::Isolate* isolate = env->GetIsolate(); |
| 8205 v8::HandleScope scope(isolate); |
| 8206 v8::Debug::SetDebugEventListener( |
| 8207 isolate, DebugStepOverFunctionWithCaughtExceptionListener); |
| 8208 |
| 8209 break_point_hit_count = 0; |
| 8210 CompileRun( |
| 8211 "function foo() {\n" |
| 8212 " try { throw new Error(); } catch (e) {}\n" |
| 8213 "}\n" |
| 8214 "debugger;\n" |
| 8215 "foo();\n" |
| 8216 "foo();\n"); |
| 8217 |
| 8218 v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); |
| 8219 CHECK_EQ(break_point_hit_count, 4); |
| 8220 } |
OLD | NEW |