| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "include/dart_debugger_api.h" | 5 #include "include/dart_debugger_api.h" |
| 6 #include "platform/assert.h" | 6 #include "platform/assert.h" |
| 7 #include "vm/dart_api_impl.h" | 7 #include "vm/dart_api_impl.h" |
| 8 #include "vm/thread.h" | 8 #include "vm/thread.h" |
| 9 #include "vm/unit_test.h" | 9 #include "vm/unit_test.h" |
| 10 | 10 |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 void TestStepIntoHandler(Dart_IsolateId isolate_id, | 354 void TestStepIntoHandler(Dart_IsolateId isolate_id, |
| 355 const Dart_CodeLocation& location) { | 355 const Dart_CodeLocation& location) { |
| 356 Dart_StackTrace trace; | 356 Dart_StackTrace trace; |
| 357 Dart_GetStackTrace(&trace); | 357 Dart_GetStackTrace(&trace); |
| 358 const char* expected_bpts[] = { | 358 const char* expected_bpts[] = { |
| 359 "main", | 359 "main", |
| 360 "foo", | 360 "foo", |
| 361 "f1", | 361 "f1", |
| 362 "foo", | 362 "foo", |
| 363 "X.X.", | 363 "X.X.", |
| 364 "X.X.", |
| 364 "foo", | 365 "foo", |
| 365 "X.kvmk", | 366 "X.kvmk", |
| 366 "f2", | 367 "f2", |
| 367 "X.kvmk", | 368 "X.kvmk", |
| 369 "X.kvmk", |
| 368 "foo", | 370 "foo", |
| 369 "main" | 371 "main" |
| 370 }; | 372 }; |
| 371 const intptr_t expected_bpts_length = ARRAY_SIZE(expected_bpts); | 373 const intptr_t expected_bpts_length = ARRAY_SIZE(expected_bpts); |
| 372 intptr_t trace_len; | 374 intptr_t trace_len; |
| 373 Dart_Handle res = Dart_StackTraceLength(trace, &trace_len); | 375 Dart_Handle res = Dart_StackTraceLength(trace, &trace_len); |
| 374 EXPECT_VALID(res); | 376 EXPECT_VALID(res); |
| 375 EXPECT(breakpoint_hit_counter < expected_bpts_length); | 377 EXPECT(breakpoint_hit_counter < expected_bpts_length); |
| 376 Dart_ActivationFrame frame; | 378 Dart_ActivationFrame frame; |
| 377 res = Dart_GetActivationFrame(trace, 0, &frame); | 379 res = Dart_GetActivationFrame(trace, 0, &frame); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 " return o.kvmk(3, c:5); \n" | 413 " return o.kvmk(3, c:5); \n" |
| 412 "} \n" | 414 "} \n" |
| 413 " \n" | 415 " \n" |
| 414 "main() { \n" | 416 "main() { \n" |
| 415 " return foo(); \n" | 417 " return foo(); \n" |
| 416 "} \n"; | 418 "} \n"; |
| 417 | 419 |
| 418 LoadScript(kScriptChars); | 420 LoadScript(kScriptChars); |
| 419 Dart_SetPausedEventHandler(&TestStepIntoHandler); | 421 Dart_SetPausedEventHandler(&TestStepIntoHandler); |
| 420 | 422 |
| 421 // Set a breakpoint in function f1, then repeatedly step out until | |
| 422 // we get to main. We should see one breakpoint each in f1, | |
| 423 // foo, main, but not in f2. | |
| 424 SetBreakpointAtEntry("", "main"); | 423 SetBreakpointAtEntry("", "main"); |
| 425 | |
| 426 breakpoint_hit = false; | 424 breakpoint_hit = false; |
| 427 breakpoint_hit_counter = 0; | 425 breakpoint_hit_counter = 0; |
| 428 Dart_Handle retval = Invoke("main"); | 426 Dart_Handle retval = Invoke("main"); |
| 429 EXPECT_VALID(retval); | 427 EXPECT_VALID(retval); |
| 430 EXPECT(Dart_IsInteger(retval)); | 428 EXPECT(Dart_IsInteger(retval)); |
| 431 int64_t int_value = 0; | 429 int64_t int_value = 0; |
| 432 Dart_IntegerToInt64(retval, &int_value); | 430 Dart_IntegerToInt64(retval, &int_value); |
| 433 EXPECT_EQ(7, int_value); | 431 EXPECT_EQ(7, int_value); |
| 434 EXPECT(breakpoint_hit == true); | 432 EXPECT(breakpoint_hit == true); |
| 435 } | 433 } |
| (...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1524 breakpoint_hit_counter = 0; | 1522 breakpoint_hit_counter = 0; |
| 1525 Dart_SetExceptionPauseInfo(kPauseOnAllExceptions); | 1523 Dart_SetExceptionPauseInfo(kPauseOnAllExceptions); |
| 1526 | 1524 |
| 1527 Dart_Handle retval = Invoke("main"); | 1525 Dart_Handle retval = Invoke("main"); |
| 1528 EXPECT(Dart_IsError(retval)); | 1526 EXPECT(Dart_IsError(retval)); |
| 1529 EXPECT(Dart_IsUnhandledExceptionError(retval)); | 1527 EXPECT(Dart_IsUnhandledExceptionError(retval)); |
| 1530 EXPECT_EQ(1, breakpoint_hit_counter); | 1528 EXPECT_EQ(1, breakpoint_hit_counter); |
| 1531 } | 1529 } |
| 1532 | 1530 |
| 1533 } // namespace dart | 1531 } // namespace dart |
| OLD | NEW |