Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: runtime/vm/debugger_api_impl_test.cc

Issue 1670623002: Add extra tracing to Debug_InterruptIsolate test. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/json_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_mirrors_api.h" 5 #include "include/dart_mirrors_api.h"
6 #include "include/dart_tools_api.h" 6 #include "include/dart_tools_api.h"
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/lockers.h" 9 #include "vm/lockers.h"
10 #include "vm/unit_test.h" 10 #include "vm/unit_test.h"
11 11
12 namespace dart { 12 namespace dart {
13 13
14 DECLARE_FLAG(bool, background_compilation); 14 DECLARE_FLAG(bool, background_compilation);
15 DECLARE_FLAG(int, optimization_counter_threshold); 15 DECLARE_FLAG(int, optimization_counter_threshold);
16 DECLARE_FLAG(bool, use_osr); 16 DECLARE_FLAG(bool, use_osr);
17 DECLARE_FLAG(bool, trace_shutdown);
17 18
18 #ifndef PRODUCT 19 #ifndef PRODUCT
19 20
20 static bool breakpoint_hit = false; 21 static bool breakpoint_hit = false;
21 static int breakpoint_hit_counter = 0; 22 static int breakpoint_hit_counter = 0;
22 static Dart_Handle script_lib = NULL; 23 static Dart_Handle script_lib = NULL;
23 24
24 static const bool verbose = true; 25 static const bool verbose = true;
25 26
26 static void LoadScript(const char* source) { 27 static void LoadScript(const char* source) {
(...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 EXPECT_VALID(result); 1507 EXPECT_VALID(result);
1507 1508
1508 Dart_Handle retval = Invoke("main"); 1509 Dart_Handle retval = Invoke("main");
1509 EXPECT_VALID(retval); 1510 EXPECT_VALID(retval);
1510 Dart_ExitScope(); 1511 Dart_ExitScope();
1511 Dart_ShutdownIsolate(); 1512 Dart_ShutdownIsolate();
1512 } 1513 }
1513 1514
1514 1515
1515 TEST_CASE(Debug_InterruptIsolate) { 1516 TEST_CASE(Debug_InterruptIsolate) {
1517 bool saved_flag = FLAG_trace_shutdown;
1518 FLAG_trace_shutdown = true;
1516 sync = new Monitor(); 1519 sync = new Monitor();
1517 Dart_SetIsolateEventHandler(&TestInterruptIsolate); 1520 Dart_SetIsolateEventHandler(&TestInterruptIsolate);
1518 EXPECT(interrupt_isolate_id == ILLEGAL_ISOLATE_ID); 1521 EXPECT(interrupt_isolate_id == ILLEGAL_ISOLATE_ID);
1519 Dart_SetPausedEventHandler(InterruptIsolateHandler); 1522 Dart_SetPausedEventHandler(InterruptIsolateHandler);
1520 int result = OSThread::Start("DebugInterruptIsolate", InterruptIsolateRun, 0); 1523 int result = OSThread::Start("DebugInterruptIsolate", InterruptIsolateRun, 0);
1521 EXPECT_EQ(0, result); 1524 EXPECT_EQ(0, result);
1522 1525
1523 // Wait for the test isolate to be created. 1526 // Wait for the test isolate to be created.
1524 { 1527 {
1528 OS::PrintErr("Waiting for isolate to be created\n");
1525 MonitorLocker ml(sync); 1529 MonitorLocker ml(sync);
1526 while (interrupt_isolate_id == ILLEGAL_ISOLATE_ID) { 1530 while (interrupt_isolate_id == ILLEGAL_ISOLATE_ID) {
1527 ml.Wait(); 1531 ml.Wait();
1528 } 1532 }
1529 } 1533 }
1530 EXPECT(interrupt_isolate_id != ILLEGAL_ISOLATE_ID); 1534 EXPECT(interrupt_isolate_id != ILLEGAL_ISOLATE_ID);
1531 1535
1532 Dart_Isolate isolate = Dart_GetIsolate(interrupt_isolate_id); 1536 Dart_Isolate isolate = Dart_GetIsolate(interrupt_isolate_id);
1533 EXPECT(isolate != NULL); 1537 EXPECT(isolate != NULL);
1534 Dart_InterruptIsolate(isolate); 1538 Dart_InterruptIsolate(isolate);
1535 1539
1536 // Wait for the test isolate to be interrupted. 1540 // Wait for the test isolate to be interrupted.
1537 { 1541 {
1542 OS::PrintErr("Waiting for isolate to be interrupted\n");
1538 MonitorLocker ml(sync); 1543 MonitorLocker ml(sync);
1539 while (!isolate_interrupted || !pause_event_handled) { 1544 while (!isolate_interrupted || !pause_event_handled) {
1540 ml.Wait(); 1545 ml.Wait();
1541 } 1546 }
1542 } 1547 }
1543 EXPECT(isolate_interrupted); 1548 EXPECT(isolate_interrupted);
1544 EXPECT(pause_event_handled); 1549 EXPECT(pause_event_handled);
1545 1550
1546 // Wait for the test isolate to shutdown. 1551 // Wait for the test isolate to shutdown.
1547 { 1552 {
1553 OS::PrintErr("Waiting for isolate to be shut down\n");
1548 MonitorLocker ml(sync); 1554 MonitorLocker ml(sync);
1549 while (interrupt_isolate_id != ILLEGAL_ISOLATE_ID) { 1555 while (interrupt_isolate_id != ILLEGAL_ISOLATE_ID) {
1550 ml.Wait(); 1556 ml.Wait();
1551 } 1557 }
1552 } 1558 }
1553 EXPECT(interrupt_isolate_id == ILLEGAL_ISOLATE_ID); 1559 EXPECT(interrupt_isolate_id == ILLEGAL_ISOLATE_ID);
1560 OS::PrintErr("Complete\n");
1561 FLAG_trace_shutdown = saved_flag;
1554 } 1562 }
1555 1563
1556 1564
1557 static void StackTraceDump1BreakpointHandler( 1565 static void StackTraceDump1BreakpointHandler(
1558 Dart_IsolateId isolate_id, 1566 Dart_IsolateId isolate_id,
1559 intptr_t bp_id, 1567 intptr_t bp_id,
1560 const Dart_CodeLocation& location) { 1568 const Dart_CodeLocation& location) {
1561 Dart_StackTrace trace; 1569 Dart_StackTrace trace;
1562 Dart_GetStackTrace(&trace); 1570 Dart_GetStackTrace(&trace);
1563 const int kStackTraceLen = 4; 1571 const int kStackTraceLen = 4;
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
2325 " null, 5, 17, 5, 18, 9, 19, 12," 2333 " null, 5, 17, 5, 18, 9, 19, 12,"
2326 " null, 6, 21, 1," 2334 " null, 6, 21, 1,"
2327 " null, 8, 24, 1, 25, 5, 26, 6, 27, 8," 2335 " null, 8, 24, 1, 25, 5, 26, 6, 27, 8,"
2328 " null, 9, 29, 1]", 2336 " null, 9, 29, 1]",
2329 tokens_cstr); 2337 tokens_cstr);
2330 } 2338 }
2331 2339
2332 #endif 2340 #endif
2333 2341
2334 } // namespace dart 2342 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/json_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698