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_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" |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
275 uintptr_t last_frame_pointer = 0; | 275 uintptr_t last_frame_pointer = 0; |
276 uintptr_t frame_pointer; | 276 uintptr_t frame_pointer; |
277 for (int i = 0; i < trace_len; i++) { | 277 for (int i = 0; i < trace_len; i++) { |
278 Dart_ActivationFrame frame; | 278 Dart_ActivationFrame frame; |
279 res = Dart_GetActivationFrame(trace, i, &frame); | 279 res = Dart_GetActivationFrame(trace, i, &frame); |
280 EXPECT_TRUE(res); | 280 EXPECT_TRUE(res); |
281 | 281 |
282 res = Dart_ActivationFrameGetFramePointer(frame, &frame_pointer); | 282 res = Dart_ActivationFrameGetFramePointer(frame, &frame_pointer); |
283 EXPECT_TRUE(res); | 283 EXPECT_TRUE(res); |
284 if (i > 0) { | 284 if (i > 0) { |
285 #if !defined(TARGET_ARCH_DBC) | |
285 // We expect the stack to grow from high to low addresses. | 286 // We expect the stack to grow from high to low addresses. |
286 EXPECT_GT(frame_pointer, last_frame_pointer); | 287 EXPECT_GT(frame_pointer, last_frame_pointer); |
288 #else | |
289 // On DBC stack grows upwards from low to high addresses. | |
290 EXPECT_LT(frame_pointer, last_frame_pointer); | |
291 #endif | |
287 } | 292 } |
288 last_frame_pointer = frame_pointer; | 293 last_frame_pointer = frame_pointer; |
289 if (i < expected_frames) { | 294 if (i < expected_frames) { |
290 VerifyStackFrame(frame, func_names[i], local_vars[i], skip_null_expects); | 295 VerifyStackFrame(frame, func_names[i], local_vars[i], skip_null_expects); |
291 } else { | 296 } else { |
292 VerifyStackFrame(frame, NULL, Dart_Null(), skip_null_expects); | 297 VerifyStackFrame(frame, NULL, Dart_Null(), skip_null_expects); |
293 } | 298 } |
294 } | 299 } |
295 } | 300 } |
296 | 301 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
486 FLAG_optimization_counter_threshold = saved_threshold; | 491 FLAG_optimization_counter_threshold = saved_threshold; |
487 FLAG_use_osr = saved_osr; | 492 FLAG_use_osr = saved_osr; |
488 } | 493 } |
489 | 494 |
490 | 495 |
491 TEST_CASE(Debug_InspectStack_NotOptimized) { | 496 TEST_CASE(Debug_InspectStack_NotOptimized) { |
492 InspectStackTest(false); | 497 InspectStackTest(false); |
493 } | 498 } |
494 | 499 |
495 | 500 |
501 #if !defined(TARGET_ARCH_DBC) | |
zra
2016/04/08 22:37:35
enable and mark in status file?
Vyacheslav Egorov (Google)
2016/04/11 10:49:10
Done.
| |
496 TEST_CASE(Debug_InspectStack_Optimized) { | 502 TEST_CASE(Debug_InspectStack_Optimized) { |
497 // Ensure code gets optimized. | 503 // Ensure code gets optimized. |
498 FLAG_background_compilation = false; | 504 FLAG_background_compilation = false; |
499 InspectStackTest(true); | 505 InspectStackTest(true); |
500 } | 506 } |
507 #endif | |
501 | 508 |
502 | 509 |
503 static void InspectStackWithClosureTest(bool optimize) { | 510 static void InspectStackWithClosureTest(bool optimize) { |
504 const char* kScriptChars = | 511 const char* kScriptChars = |
505 "void breakpointNow() {\n" | 512 "void breakpointNow() {\n" |
506 "}\n" | 513 "}\n" |
507 "int helper(int a, int b, bool stop) {\n" | 514 "int helper(int a, int b, bool stop) {\n" |
508 " if (b == 99 && stop) {\n" | 515 " if (b == 99 && stop) {\n" |
509 " breakpointNow();\n" | 516 " breakpointNow();\n" |
510 " }\n" | 517 " }\n" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
584 FLAG_optimization_counter_threshold = saved_threshold; | 591 FLAG_optimization_counter_threshold = saved_threshold; |
585 FLAG_use_osr = saved_osr; | 592 FLAG_use_osr = saved_osr; |
586 } | 593 } |
587 | 594 |
588 | 595 |
589 TEST_CASE(Debug_InspectStackWithClosure_NotOptimized) { | 596 TEST_CASE(Debug_InspectStackWithClosure_NotOptimized) { |
590 InspectStackWithClosureTest(false); | 597 InspectStackWithClosureTest(false); |
591 } | 598 } |
592 | 599 |
593 | 600 |
601 #if !defined(TARGET_ARCH_DBC) | |
zra
2016/04/08 22:37:34
ditto
Vyacheslav Egorov (Google)
2016/04/11 10:49:10
Done.
| |
594 TEST_CASE(Debug_InspectStackWithClosure_Optimized) { | 602 TEST_CASE(Debug_InspectStackWithClosure_Optimized) { |
595 // Ensure code gets optimized. | 603 // Ensure code gets optimized. |
596 FLAG_background_compilation = false; | 604 FLAG_background_compilation = false; |
597 InspectStackWithClosureTest(true); | 605 InspectStackWithClosureTest(true); |
598 } | 606 } |
607 #endif | |
599 | 608 |
600 | 609 |
601 void TestStepOutHandler(Dart_IsolateId isolate_id, | 610 void TestStepOutHandler(Dart_IsolateId isolate_id, |
602 intptr_t bp_id, | 611 intptr_t bp_id, |
603 const Dart_CodeLocation& location) { | 612 const Dart_CodeLocation& location) { |
604 Dart_StackTrace trace; | 613 Dart_StackTrace trace; |
605 Dart_GetStackTrace(&trace); | 614 Dart_GetStackTrace(&trace); |
606 const char* expected_bpts[] = {"f1", "foo", "main"}; | 615 const char* expected_bpts[] = {"f1", "foo", "main"}; |
607 const intptr_t expected_bpts_length = ARRAY_SIZE(expected_bpts); | 616 const intptr_t expected_bpts_length = ARRAY_SIZE(expected_bpts); |
608 intptr_t trace_len; | 617 intptr_t trace_len; |
(...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2330 " null, 5, 17, 5, 18, 9, 19, 12," | 2339 " null, 5, 17, 5, 18, 9, 19, 12," |
2331 " null, 6, 21, 1," | 2340 " null, 6, 21, 1," |
2332 " null, 8, 24, 1, 25, 5, 26, 6, 27, 8," | 2341 " null, 8, 24, 1, 25, 5, 26, 6, 27, 8," |
2333 " null, 9, 29, 1]", | 2342 " null, 9, 29, 1]", |
2334 tokens_cstr); | 2343 tokens_cstr); |
2335 } | 2344 } |
2336 | 2345 |
2337 #endif | 2346 #endif |
2338 | 2347 |
2339 } // namespace dart | 2348 } // namespace dart |
OLD | NEW |