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 7171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7182 | 7182 |
7183 int break_id = CcTest::i_isolate()->debug()->break_id(); | 7183 int break_id = CcTest::i_isolate()->debug()->break_id(); |
7184 char script[128]; | 7184 char script[128]; |
7185 i::Vector<char> script_vector(script, sizeof(script)); | 7185 i::Vector<char> script_vector(script, sizeof(script)); |
7186 SNPrintF(script_vector, "%%GetFrameCount(%d)", break_id); | 7186 SNPrintF(script_vector, "%%GetFrameCount(%d)", break_id); |
7187 v8::Local<v8::Value> result = CompileRun(script); | 7187 v8::Local<v8::Value> result = CompileRun(script); |
7188 | 7188 |
7189 int frame_count = result->Int32Value(); | 7189 int frame_count = result->Int32Value(); |
7190 CHECK_EQ(expected_frame_count, frame_count); | 7190 CHECK_EQ(expected_frame_count, frame_count); |
7191 | 7191 |
| 7192 uint32_t last_frame_pointer_high; |
| 7193 uint32_t last_frame_pointer_low; |
7192 for (int i = 0; i < frame_count; i++) { | 7194 for (int i = 0; i < frame_count; i++) { |
7193 // The 5. element in the returned array of GetFrameDetails contains the | 7195 // The 5. element in the returned array of GetFrameDetails contains the |
7194 // source position of that frame. | 7196 // source position of that frame. |
7195 SNPrintF(script_vector, "%%GetFrameDetails(%d, %d)[5]", break_id, i); | 7197 SNPrintF(script_vector, "%%GetFrameDetails(%d, %d)[5]", break_id, i); |
7196 v8::Local<v8::Value> result = CompileRun(script); | 7198 v8::Local<v8::Value> result = CompileRun(script); |
7197 CHECK_EQ(expected_line_number[i], | 7199 CHECK_EQ(expected_line_number[i], |
7198 i::Script::GetLineNumber(source_script, result->Int32Value())); | 7200 i::Script::GetLineNumber(source_script, result->Int32Value())); |
| 7201 |
| 7202 // The 8. element in the returned array of GetFrameDetails contains the |
| 7203 // high address of the frame pointer. |
| 7204 SNPrintF(script_vector, "%%GetFrameDetails(%d, %d)[8]", break_id, i); |
| 7205 uint32_t frame_pointer_high = CompileRun(script)->Uint32Value(); |
| 7206 |
| 7207 // The 9. element in the returned array of GetFrameDetails contains the |
| 7208 // low address of the frame pointer. |
| 7209 SNPrintF(script_vector, "%%GetFrameDetails(%d, %d)[9]", break_id, i); |
| 7210 uint32_t frame_pointer_low = CompileRun(script)->Uint32Value(); |
| 7211 |
| 7212 if (i > 0) { |
| 7213 // We expect the stack to grow from high to low addresses. |
| 7214 CHECK(last_frame_pointer_high < frame_pointer_high || |
| 7215 last_frame_pointer_low <= frame_pointer_low); |
| 7216 } |
| 7217 last_frame_pointer_high = frame_pointer_high; |
| 7218 last_frame_pointer_low = frame_pointer_low; |
7199 } | 7219 } |
7200 v8::Debug::SetDebugEventListener(NULL); | 7220 v8::Debug::SetDebugEventListener(NULL); |
7201 v8::V8::TerminateExecution(CcTest::isolate()); | 7221 v8::V8::TerminateExecution(CcTest::isolate()); |
7202 } | 7222 } |
7203 | 7223 |
7204 | 7224 |
7205 TEST(DebugBreakInline) { | 7225 TEST(DebugBreakInline) { |
7206 i::FLAG_allow_natives_syntax = true; | 7226 i::FLAG_allow_natives_syntax = true; |
7207 DebugLocalContext env; | 7227 DebugLocalContext env; |
7208 v8::HandleScope scope(env->GetIsolate()); | 7228 v8::HandleScope scope(env->GetIsolate()); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7415 v8::Isolate* isolate = env->GetIsolate(); | 7435 v8::Isolate* isolate = env->GetIsolate(); |
7416 v8::HandleScope scope(isolate); | 7436 v8::HandleScope scope(isolate); |
7417 v8::Debug::SetDebugEventListener(DebugBreakTriggerTerminate); | 7437 v8::Debug::SetDebugEventListener(DebugBreakTriggerTerminate); |
7418 TerminationThread terminator(isolate); | 7438 TerminationThread terminator(isolate); |
7419 terminator.Start(); | 7439 terminator.Start(); |
7420 v8::TryCatch try_catch; | 7440 v8::TryCatch try_catch; |
7421 v8::Debug::DebugBreak(isolate); | 7441 v8::Debug::DebugBreak(isolate); |
7422 CompileRun("while (true);"); | 7442 CompileRun("while (true);"); |
7423 CHECK(try_catch.HasTerminated()); | 7443 CHECK(try_catch.HasTerminated()); |
7424 } | 7444 } |
OLD | NEW |