Index: test/cctest/test-debug.cc |
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc |
index c0ea7072fed35bd782f377a8b2d974bc9d32dc98..51e6f85aff80a857bf4ba5b4a69ac991e230d540 100644 |
--- a/test/cctest/test-debug.cc |
+++ b/test/cctest/test-debug.cc |
@@ -7286,4 +7286,54 @@ TEST(DebugBreakLoop) { |
} |
+static void DebugBreakInlineListener(v8::DebugEvent event, |
+ v8::Handle<v8::Object> exec_state, |
+ v8::Handle<v8::Object> event_data, |
+ v8::Handle<v8::Value> data) { |
+ if (event != v8::Break) return; |
+ |
+ int break_id = v8::internal::Isolate::Current()->debug()->break_id(); |
+ char script[128]; |
+ i::Vector<char> script_vector(script, sizeof(script)); |
+ OS::SNPrintF(script_vector, "%%GetFrameCount(%d)", break_id); |
+ v8::Local<v8::Value> result = CompileRun(script); |
+ int frame_count = result->Int32Value(); |
+ int previous = -1; |
+ for (int i = 0; i < frame_count; i++) { |
+ // The 5. element in the returned array of GetFrameDetails contains the |
+ // source position of that frame. |
+ OS::SNPrintF(script_vector, "%%GetFrameDetails(%d, %d)[5]", break_id, i); |
+ v8::Local<v8::Value> result = CompileRun(script); |
+ // Each frame's source position has to be different from the previous one. |
Søren Gjesse
2012/01/30 12:26:57
Maybe put in expected lines
int expected_line[..]
|
+ CHECK_NE(previous, result->Int32Value()); |
+ previous = result->Int32Value(); |
+ } |
+ v8::Debug::SetDebugEventListener(NULL); |
+ v8::V8::TerminateExecution(); |
+} |
+ |
+ |
+TEST(DebugBreakInline) { |
+ i::FLAG_allow_natives_syntax = true; |
+ v8::HandleScope scope; |
+ DebugLocalContext env; |
+ const char* source = |
+ "function debug(b) { \n" |
+ " if (b) debugger; \n" |
+ "} \n" |
+ "function f(b) { \n" |
+ " debug(b) \n" |
+ "}; \n" |
+ "function g(b) { \n" |
+ " f(b); \n" |
+ "}; \n" |
+ "g(false); \n" |
+ "g(false); \n" |
+ "%OptimizeFunctionOnNextCall(g); \n" |
+ "g(true);"; |
+ v8::Debug::SetDebugEventListener(DebugBreakInlineListener); |
+ CompileRun(source); |
+} |
+ |
+ |
#endif // ENABLE_DEBUGGER_SUPPORT |