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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 return SetBreakPoint(v8::Utils::OpenHandle(*fun), position); | 175 return SetBreakPoint(v8::Utils::OpenHandle(*fun), position); |
176 } | 176 } |
177 | 177 |
178 | 178 |
179 // Set a break point in a function using the Debug object and return the | 179 // Set a break point in a function using the Debug object and return the |
180 // associated break point number. | 180 // associated break point number. |
181 static int SetBreakPointFromJS(v8::Isolate* isolate, | 181 static int SetBreakPointFromJS(v8::Isolate* isolate, |
182 const char* function_name, | 182 const char* function_name, |
183 int line, int position) { | 183 int line, int position) { |
184 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; | 184 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; |
185 OS::SNPrintF(buffer, | 185 SNPrintF(buffer, |
186 "debug.Debug.setBreakPoint(%s,%d,%d)", | 186 "debug.Debug.setBreakPoint(%s,%d,%d)", |
187 function_name, line, position); | 187 function_name, line, position); |
188 buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0'; | 188 buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0'; |
189 v8::Handle<v8::String> str = v8::String::NewFromUtf8(isolate, buffer.start()); | 189 v8::Handle<v8::String> str = v8::String::NewFromUtf8(isolate, buffer.start()); |
190 return v8::Script::Compile(str)->Run()->Int32Value(); | 190 return v8::Script::Compile(str)->Run()->Int32Value(); |
191 } | 191 } |
192 | 192 |
193 | 193 |
194 // Set a break point in a script identified by id using the global Debug object. | 194 // Set a break point in a script identified by id using the global Debug object. |
195 static int SetScriptBreakPointByIdFromJS(v8::Isolate* isolate, int script_id, | 195 static int SetScriptBreakPointByIdFromJS(v8::Isolate* isolate, int script_id, |
196 int line, int column) { | 196 int line, int column) { |
197 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; | 197 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; |
198 if (column >= 0) { | 198 if (column >= 0) { |
199 // Column specified set script break point on precise location. | 199 // Column specified set script break point on precise location. |
200 OS::SNPrintF(buffer, | 200 SNPrintF(buffer, |
201 "debug.Debug.setScriptBreakPointById(%d,%d,%d)", | 201 "debug.Debug.setScriptBreakPointById(%d,%d,%d)", |
202 script_id, line, column); | 202 script_id, line, column); |
203 } else { | 203 } else { |
204 // Column not specified set script break point on line. | 204 // Column not specified set script break point on line. |
205 OS::SNPrintF(buffer, | 205 SNPrintF(buffer, |
206 "debug.Debug.setScriptBreakPointById(%d,%d)", | 206 "debug.Debug.setScriptBreakPointById(%d,%d)", |
207 script_id, line); | 207 script_id, line); |
208 } | 208 } |
209 buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0'; | 209 buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0'; |
210 { | 210 { |
211 v8::TryCatch try_catch; | 211 v8::TryCatch try_catch; |
212 v8::Handle<v8::String> str = | 212 v8::Handle<v8::String> str = |
213 v8::String::NewFromUtf8(isolate, buffer.start()); | 213 v8::String::NewFromUtf8(isolate, buffer.start()); |
214 v8::Handle<v8::Value> value = v8::Script::Compile(str)->Run(); | 214 v8::Handle<v8::Value> value = v8::Script::Compile(str)->Run(); |
215 CHECK(!try_catch.HasCaught()); | 215 CHECK(!try_catch.HasCaught()); |
216 return value->Int32Value(); | 216 return value->Int32Value(); |
217 } | 217 } |
218 } | 218 } |
219 | 219 |
220 | 220 |
221 // Set a break point in a script identified by name using the global Debug | 221 // Set a break point in a script identified by name using the global Debug |
222 // object. | 222 // object. |
223 static int SetScriptBreakPointByNameFromJS(v8::Isolate* isolate, | 223 static int SetScriptBreakPointByNameFromJS(v8::Isolate* isolate, |
224 const char* script_name, int line, | 224 const char* script_name, int line, |
225 int column) { | 225 int column) { |
226 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; | 226 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; |
227 if (column >= 0) { | 227 if (column >= 0) { |
228 // Column specified set script break point on precise location. | 228 // Column specified set script break point on precise location. |
229 OS::SNPrintF(buffer, | 229 SNPrintF(buffer, |
230 "debug.Debug.setScriptBreakPointByName(\"%s\",%d,%d)", | 230 "debug.Debug.setScriptBreakPointByName(\"%s\",%d,%d)", |
231 script_name, line, column); | 231 script_name, line, column); |
232 } else { | 232 } else { |
233 // Column not specified set script break point on line. | 233 // Column not specified set script break point on line. |
234 OS::SNPrintF(buffer, | 234 SNPrintF(buffer, |
235 "debug.Debug.setScriptBreakPointByName(\"%s\",%d)", | 235 "debug.Debug.setScriptBreakPointByName(\"%s\",%d)", |
236 script_name, line); | 236 script_name, line); |
237 } | 237 } |
238 buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0'; | 238 buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0'; |
239 { | 239 { |
240 v8::TryCatch try_catch; | 240 v8::TryCatch try_catch; |
241 v8::Handle<v8::String> str = | 241 v8::Handle<v8::String> str = |
242 v8::String::NewFromUtf8(isolate, buffer.start()); | 242 v8::String::NewFromUtf8(isolate, buffer.start()); |
243 v8::Handle<v8::Value> value = v8::Script::Compile(str)->Run(); | 243 v8::Handle<v8::Value> value = v8::Script::Compile(str)->Run(); |
244 CHECK(!try_catch.HasCaught()); | 244 CHECK(!try_catch.HasCaught()); |
245 return value->Int32Value(); | 245 return value->Int32Value(); |
246 } | 246 } |
247 } | 247 } |
248 | 248 |
249 | 249 |
250 // Clear a break point. | 250 // Clear a break point. |
251 static void ClearBreakPoint(int break_point) { | 251 static void ClearBreakPoint(int break_point) { |
252 v8::internal::Isolate* isolate = CcTest::i_isolate(); | 252 v8::internal::Isolate* isolate = CcTest::i_isolate(); |
253 v8::internal::Debug* debug = isolate->debug(); | 253 v8::internal::Debug* debug = isolate->debug(); |
254 debug->ClearBreakPoint( | 254 debug->ClearBreakPoint( |
255 Handle<Object>(v8::internal::Smi::FromInt(break_point), isolate)); | 255 Handle<Object>(v8::internal::Smi::FromInt(break_point), isolate)); |
256 } | 256 } |
257 | 257 |
258 | 258 |
259 // Clear a break point using the global Debug object. | 259 // Clear a break point using the global Debug object. |
260 static void ClearBreakPointFromJS(v8::Isolate* isolate, | 260 static void ClearBreakPointFromJS(v8::Isolate* isolate, |
261 int break_point_number) { | 261 int break_point_number) { |
262 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; | 262 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; |
263 OS::SNPrintF(buffer, | 263 SNPrintF(buffer, |
264 "debug.Debug.clearBreakPoint(%d)", | 264 "debug.Debug.clearBreakPoint(%d)", |
265 break_point_number); | 265 break_point_number); |
266 buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0'; | 266 buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0'; |
267 v8::Script::Compile(v8::String::NewFromUtf8(isolate, buffer.start()))->Run(); | 267 v8::Script::Compile(v8::String::NewFromUtf8(isolate, buffer.start()))->Run(); |
268 } | 268 } |
269 | 269 |
270 | 270 |
271 static void EnableScriptBreakPointFromJS(v8::Isolate* isolate, | 271 static void EnableScriptBreakPointFromJS(v8::Isolate* isolate, |
272 int break_point_number) { | 272 int break_point_number) { |
273 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; | 273 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; |
274 OS::SNPrintF(buffer, | 274 SNPrintF(buffer, |
275 "debug.Debug.enableScriptBreakPoint(%d)", | 275 "debug.Debug.enableScriptBreakPoint(%d)", |
276 break_point_number); | 276 break_point_number); |
277 buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0'; | 277 buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0'; |
278 v8::Script::Compile(v8::String::NewFromUtf8(isolate, buffer.start()))->Run(); | 278 v8::Script::Compile(v8::String::NewFromUtf8(isolate, buffer.start()))->Run(); |
279 } | 279 } |
280 | 280 |
281 | 281 |
282 static void DisableScriptBreakPointFromJS(v8::Isolate* isolate, | 282 static void DisableScriptBreakPointFromJS(v8::Isolate* isolate, |
283 int break_point_number) { | 283 int break_point_number) { |
284 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; | 284 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; |
285 OS::SNPrintF(buffer, | 285 SNPrintF(buffer, |
286 "debug.Debug.disableScriptBreakPoint(%d)", | 286 "debug.Debug.disableScriptBreakPoint(%d)", |
287 break_point_number); | 287 break_point_number); |
288 buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0'; | 288 buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0'; |
289 v8::Script::Compile(v8::String::NewFromUtf8(isolate, buffer.start()))->Run(); | 289 v8::Script::Compile(v8::String::NewFromUtf8(isolate, buffer.start()))->Run(); |
290 } | 290 } |
291 | 291 |
292 | 292 |
293 static void ChangeScriptBreakPointConditionFromJS(v8::Isolate* isolate, | 293 static void ChangeScriptBreakPointConditionFromJS(v8::Isolate* isolate, |
294 int break_point_number, | 294 int break_point_number, |
295 const char* condition) { | 295 const char* condition) { |
296 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; | 296 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; |
297 OS::SNPrintF(buffer, | 297 SNPrintF(buffer, |
298 "debug.Debug.changeScriptBreakPointCondition(%d, \"%s\")", | 298 "debug.Debug.changeScriptBreakPointCondition(%d, \"%s\")", |
299 break_point_number, condition); | 299 break_point_number, condition); |
300 buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0'; | 300 buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0'; |
301 v8::Script::Compile(v8::String::NewFromUtf8(isolate, buffer.start()))->Run(); | 301 v8::Script::Compile(v8::String::NewFromUtf8(isolate, buffer.start()))->Run(); |
302 } | 302 } |
303 | 303 |
304 | 304 |
305 static void ChangeScriptBreakPointIgnoreCountFromJS(v8::Isolate* isolate, | 305 static void ChangeScriptBreakPointIgnoreCountFromJS(v8::Isolate* isolate, |
306 int break_point_number, | 306 int break_point_number, |
307 int ignoreCount) { | 307 int ignoreCount) { |
308 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; | 308 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; |
309 OS::SNPrintF(buffer, | 309 SNPrintF(buffer, |
310 "debug.Debug.changeScriptBreakPointIgnoreCount(%d, %d)", | 310 "debug.Debug.changeScriptBreakPointIgnoreCount(%d, %d)", |
311 break_point_number, ignoreCount); | 311 break_point_number, ignoreCount); |
312 buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0'; | 312 buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0'; |
313 v8::Script::Compile(v8::String::NewFromUtf8(isolate, buffer.start()))->Run(); | 313 v8::Script::Compile(v8::String::NewFromUtf8(isolate, buffer.start()))->Run(); |
314 } | 314 } |
315 | 315 |
316 | 316 |
317 // Change break on exception. | 317 // Change break on exception. |
318 static void ChangeBreakOnException(bool caught, bool uncaught) { | 318 static void ChangeBreakOnException(bool caught, bool uncaught) { |
319 v8::internal::Debug* debug = CcTest::i_isolate()->debug(); | 319 v8::internal::Debug* debug = CcTest::i_isolate()->debug(); |
320 debug->ChangeBreakOnException(v8::internal::BreakException, caught); | 320 debug->ChangeBreakOnException(v8::internal::BreakException, caught); |
321 debug->ChangeBreakOnException(v8::internal::BreakUncaughtException, uncaught); | 321 debug->ChangeBreakOnException(v8::internal::BreakUncaughtException, uncaught); |
(...skipping 2295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2617 pos1 += strlen(prefix); | 2617 pos1 += strlen(prefix); |
2618 char* pos2 = strchr(pos1, '"'); | 2618 char* pos2 = strchr(pos1, '"'); |
2619 if (pos2 == NULL) { | 2619 if (pos2 == NULL) { |
2620 return false; | 2620 return false; |
2621 } | 2621 } |
2622 Vector<char> buf(buffer, buffer_size); | 2622 Vector<char> buf(buffer, buffer_size); |
2623 int len = static_cast<int>(pos2 - pos1); | 2623 int len = static_cast<int>(pos2 - pos1); |
2624 if (len > buffer_size - 1) { | 2624 if (len > buffer_size - 1) { |
2625 len = buffer_size - 1; | 2625 len = buffer_size - 1; |
2626 } | 2626 } |
2627 OS::StrNCpy(buf, pos1, len); | 2627 StrNCpy(buf, pos1, len); |
2628 buffer[buffer_size - 1] = '\0'; | 2628 buffer[buffer_size - 1] = '\0'; |
2629 return true; | 2629 return true; |
2630 } | 2630 } |
2631 | 2631 |
2632 | 2632 |
2633 struct EvaluateResult { | 2633 struct EvaluateResult { |
2634 static const int kBufferSize = 20; | 2634 static const int kBufferSize = 20; |
2635 char buffer[kBufferSize]; | 2635 char buffer[kBufferSize]; |
2636 }; | 2636 }; |
2637 | 2637 |
(...skipping 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4361 // 3 is PropertyKind.Named | PropertyKind.Indexed; | 4361 // 3 is PropertyKind.Named | PropertyKind.Indexed; |
4362 source = "both_mirror.properties(3).length"; | 4362 source = "both_mirror.properties(3).length"; |
4363 CHECK_EQ(5, CompileRun(source)->Int32Value()); | 4363 CHECK_EQ(5, CompileRun(source)->Int32Value()); |
4364 | 4364 |
4365 // Get the interceptor properties for the object with only named interceptor. | 4365 // Get the interceptor properties for the object with only named interceptor. |
4366 CompileRun("var named_values = named_mirror.properties()"); | 4366 CompileRun("var named_values = named_mirror.properties()"); |
4367 | 4367 |
4368 // Check that the properties are interceptor properties. | 4368 // Check that the properties are interceptor properties. |
4369 for (int i = 0; i < 3; i++) { | 4369 for (int i = 0; i < 3; i++) { |
4370 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; | 4370 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; |
4371 OS::SNPrintF(buffer, | 4371 SNPrintF(buffer, |
4372 "named_values[%d] instanceof debug.PropertyMirror", i); | 4372 "named_values[%d] instanceof debug.PropertyMirror", i); |
4373 CHECK(CompileRun(buffer.start())->BooleanValue()); | 4373 CHECK(CompileRun(buffer.start())->BooleanValue()); |
4374 | 4374 |
4375 OS::SNPrintF(buffer, "named_values[%d].propertyType()", i); | 4375 SNPrintF(buffer, "named_values[%d].propertyType()", i); |
4376 CHECK_EQ(v8::internal::INTERCEPTOR, | 4376 CHECK_EQ(v8::internal::INTERCEPTOR, |
4377 CompileRun(buffer.start())->Int32Value()); | 4377 CompileRun(buffer.start())->Int32Value()); |
4378 | 4378 |
4379 OS::SNPrintF(buffer, "named_values[%d].isNative()", i); | 4379 SNPrintF(buffer, "named_values[%d].isNative()", i); |
4380 CHECK(CompileRun(buffer.start())->BooleanValue()); | 4380 CHECK(CompileRun(buffer.start())->BooleanValue()); |
4381 } | 4381 } |
4382 | 4382 |
4383 // Get the interceptor properties for the object with only indexed | 4383 // Get the interceptor properties for the object with only indexed |
4384 // interceptor. | 4384 // interceptor. |
4385 CompileRun("var indexed_values = indexed_mirror.properties()"); | 4385 CompileRun("var indexed_values = indexed_mirror.properties()"); |
4386 | 4386 |
4387 // Check that the properties are interceptor properties. | 4387 // Check that the properties are interceptor properties. |
4388 for (int i = 0; i < 2; i++) { | 4388 for (int i = 0; i < 2; i++) { |
4389 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; | 4389 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; |
4390 OS::SNPrintF(buffer, | 4390 SNPrintF(buffer, |
4391 "indexed_values[%d] instanceof debug.PropertyMirror", i); | 4391 "indexed_values[%d] instanceof debug.PropertyMirror", i); |
4392 CHECK(CompileRun(buffer.start())->BooleanValue()); | 4392 CHECK(CompileRun(buffer.start())->BooleanValue()); |
4393 } | 4393 } |
4394 | 4394 |
4395 // Get the interceptor properties for the object with both types of | 4395 // Get the interceptor properties for the object with both types of |
4396 // interceptors. | 4396 // interceptors. |
4397 CompileRun("var both_values = both_mirror.properties()"); | 4397 CompileRun("var both_values = both_mirror.properties()"); |
4398 | 4398 |
4399 // Check that the properties are interceptor properties. | 4399 // Check that the properties are interceptor properties. |
4400 for (int i = 0; i < 5; i++) { | 4400 for (int i = 0; i < 5; i++) { |
4401 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; | 4401 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; |
4402 OS::SNPrintF(buffer, "both_values[%d] instanceof debug.PropertyMirror", i); | 4402 SNPrintF(buffer, "both_values[%d] instanceof debug.PropertyMirror", i); |
4403 CHECK(CompileRun(buffer.start())->BooleanValue()); | 4403 CHECK(CompileRun(buffer.start())->BooleanValue()); |
4404 } | 4404 } |
4405 | 4405 |
4406 // Check the property names. | 4406 // Check the property names. |
4407 source = "both_values[0].name() == 'a'"; | 4407 source = "both_values[0].name() == 'a'"; |
4408 CHECK(CompileRun(source)->BooleanValue()); | 4408 CHECK(CompileRun(source)->BooleanValue()); |
4409 | 4409 |
4410 source = "both_values[1].name() == 'b'"; | 4410 source = "both_values[1].name() == 'b'"; |
4411 CHECK(CompileRun(source)->BooleanValue()); | 4411 CHECK(CompileRun(source)->BooleanValue()); |
4412 | 4412 |
(...skipping 2730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7143 break_point_hit_count_deoptimize = j; | 7143 break_point_hit_count_deoptimize = j; |
7144 if (j == 6) { | 7144 if (j == 6) { |
7145 break_point_hit_count_deoptimize = kBreaksPerTest; | 7145 break_point_hit_count_deoptimize = kBreaksPerTest; |
7146 } | 7146 } |
7147 | 7147 |
7148 break_point_hit_count = 0; | 7148 break_point_hit_count = 0; |
7149 max_break_point_hit_count = kBreaksPerTest; | 7149 max_break_point_hit_count = kBreaksPerTest; |
7150 terminate_after_max_break_point_hit = true; | 7150 terminate_after_max_break_point_hit = true; |
7151 | 7151 |
7152 EmbeddedVector<char, 1024> buffer; | 7152 EmbeddedVector<char, 1024> buffer; |
7153 OS::SNPrintF(buffer, | 7153 SNPrintF(buffer, |
7154 "function f() {%s%s%s}", | 7154 "function f() {%s%s%s}", |
7155 loop_head, loop_bodies[i], loop_tail); | 7155 loop_head, loop_bodies[i], loop_tail); |
7156 | 7156 |
7157 // Function with infinite loop. | 7157 // Function with infinite loop. |
7158 CompileRun(buffer.start()); | 7158 CompileRun(buffer.start()); |
7159 | 7159 |
7160 // Set the debug break to enter the debugger as soon as possible. | 7160 // Set the debug break to enter the debugger as soon as possible. |
7161 v8::Debug::DebugBreak(CcTest::isolate()); | 7161 v8::Debug::DebugBreak(CcTest::isolate()); |
7162 | 7162 |
7163 // Call function with infinite loop. | 7163 // Call function with infinite loop. |
7164 CompileRun("f();"); | 7164 CompileRun("f();"); |
7165 CHECK_EQ(kBreaksPerTest, break_point_hit_count); | 7165 CHECK_EQ(kBreaksPerTest, break_point_hit_count); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7224 int expected_frame_count = 4; | 7224 int expected_frame_count = 4; |
7225 int expected_line_number[] = {1, 4, 7, 12}; | 7225 int expected_line_number[] = {1, 4, 7, 12}; |
7226 | 7226 |
7227 i::Handle<i::Object> compiled_script = v8::Utils::OpenHandle(*inline_script); | 7227 i::Handle<i::Object> compiled_script = v8::Utils::OpenHandle(*inline_script); |
7228 i::Handle<i::Script> source_script = i::Handle<i::Script>(i::Script::cast( | 7228 i::Handle<i::Script> source_script = i::Handle<i::Script>(i::Script::cast( |
7229 i::JSFunction::cast(*compiled_script)->shared()->script())); | 7229 i::JSFunction::cast(*compiled_script)->shared()->script())); |
7230 | 7230 |
7231 int break_id = CcTest::i_isolate()->debug()->break_id(); | 7231 int break_id = CcTest::i_isolate()->debug()->break_id(); |
7232 char script[128]; | 7232 char script[128]; |
7233 i::Vector<char> script_vector(script, sizeof(script)); | 7233 i::Vector<char> script_vector(script, sizeof(script)); |
7234 OS::SNPrintF(script_vector, "%%GetFrameCount(%d)", break_id); | 7234 SNPrintF(script_vector, "%%GetFrameCount(%d)", break_id); |
7235 v8::Local<v8::Value> result = CompileRun(script); | 7235 v8::Local<v8::Value> result = CompileRun(script); |
7236 | 7236 |
7237 int frame_count = result->Int32Value(); | 7237 int frame_count = result->Int32Value(); |
7238 CHECK_EQ(expected_frame_count, frame_count); | 7238 CHECK_EQ(expected_frame_count, frame_count); |
7239 | 7239 |
7240 for (int i = 0; i < frame_count; i++) { | 7240 for (int i = 0; i < frame_count; i++) { |
7241 // The 5. element in the returned array of GetFrameDetails contains the | 7241 // The 5. element in the returned array of GetFrameDetails contains the |
7242 // source position of that frame. | 7242 // source position of that frame. |
7243 OS::SNPrintF(script_vector, "%%GetFrameDetails(%d, %d)[5]", break_id, i); | 7243 SNPrintF(script_vector, "%%GetFrameDetails(%d, %d)[5]", break_id, i); |
7244 v8::Local<v8::Value> result = CompileRun(script); | 7244 v8::Local<v8::Value> result = CompileRun(script); |
7245 CHECK_EQ(expected_line_number[i], | 7245 CHECK_EQ(expected_line_number[i], |
7246 i::Script::GetLineNumber(source_script, result->Int32Value())); | 7246 i::Script::GetLineNumber(source_script, result->Int32Value())); |
7247 } | 7247 } |
7248 v8::Debug::SetDebugEventListener(NULL); | 7248 v8::Debug::SetDebugEventListener(NULL); |
7249 v8::V8::TerminateExecution(CcTest::isolate()); | 7249 v8::V8::TerminateExecution(CcTest::isolate()); |
7250 } | 7250 } |
7251 | 7251 |
7252 | 7252 |
7253 TEST(DebugBreakInline) { | 7253 TEST(DebugBreakInline) { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7464 TEST(DebugBreakOffThreadTerminate) { | 7464 TEST(DebugBreakOffThreadTerminate) { |
7465 DebugLocalContext env; | 7465 DebugLocalContext env; |
7466 v8::Isolate* isolate = env->GetIsolate(); | 7466 v8::Isolate* isolate = env->GetIsolate(); |
7467 v8::HandleScope scope(isolate); | 7467 v8::HandleScope scope(isolate); |
7468 v8::Debug::SetDebugEventListener(DebugBreakTriggerTerminate); | 7468 v8::Debug::SetDebugEventListener(DebugBreakTriggerTerminate); |
7469 TerminationThread terminator(isolate); | 7469 TerminationThread terminator(isolate); |
7470 terminator.Start(); | 7470 terminator.Start(); |
7471 v8::Debug::DebugBreak(isolate); | 7471 v8::Debug::DebugBreak(isolate); |
7472 CompileRun("while (true);"); | 7472 CompileRun("while (true);"); |
7473 } | 7473 } |
OLD | NEW |