| 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 "vm/debugger.h" | 5 #include "vm/debugger.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 | 8 |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 intptr_t frame_ctx_level = ContextLevel(); | 528 intptr_t frame_ctx_level = ContextLevel(); |
| 529 if (ctx_.IsNull()) { | 529 if (ctx_.IsNull()) { |
| 530 *value = Symbols::New("<unknown>"); | 530 *value = Symbols::New("<unknown>"); |
| 531 return; | 531 return; |
| 532 } | 532 } |
| 533 // The context level of the variable. | 533 // The context level of the variable. |
| 534 intptr_t var_ctx_level = var_info.scope_id; | 534 intptr_t var_ctx_level = var_info.scope_id; |
| 535 intptr_t level_diff = frame_ctx_level - var_ctx_level; | 535 intptr_t level_diff = frame_ctx_level - var_ctx_level; |
| 536 intptr_t ctx_slot = var_info.index; | 536 intptr_t ctx_slot = var_info.index; |
| 537 if (level_diff == 0) { | 537 if (level_diff == 0) { |
| 538 *value = ctx_.At(ctx_slot); | 538 // TODO(12767) : Need to ensure that we end up with the correct context |
| 539 // here so that this check can be an assert. |
| 540 if ((ctx_slot < ctx_.num_variables()) && (ctx_slot >= 0)) { |
| 541 *value = ctx_.At(ctx_slot); |
| 542 } else { |
| 543 *value = Symbols::New("<unknown>"); |
| 544 } |
| 539 } else { | 545 } else { |
| 540 ASSERT(level_diff > 0); | 546 ASSERT(level_diff > 0); |
| 541 Context& ctx = Context::Handle(ctx_.raw()); | 547 Context& ctx = Context::Handle(ctx_.raw()); |
| 542 while (level_diff > 0) { | 548 while (level_diff > 0 && !ctx.IsNull()) { |
| 543 ASSERT(!ctx.IsNull()); | |
| 544 level_diff--; | 549 level_diff--; |
| 545 ctx = ctx.parent(); | 550 ctx = ctx.parent(); |
| 546 } | 551 } |
| 547 ASSERT(!ctx.IsNull()); | 552 // TODO(12767) : Need to ensure that we end up with the correct context |
| 548 *value = ctx.At(ctx_slot); | 553 // here so that this check can be assert. |
| 554 if (!ctx.IsNull() && |
| 555 ((ctx_slot < ctx_.num_variables()) && (ctx_slot >= 0))) { |
| 556 *value = ctx.At(ctx_slot); |
| 557 } else { |
| 558 *value = Symbols::New("<unknown>"); |
| 559 } |
| 549 } | 560 } |
| 550 } | 561 } |
| 551 } | 562 } |
| 552 | 563 |
| 553 | 564 |
| 554 RawArray* ActivationFrame::GetLocalVariables() { | 565 RawArray* ActivationFrame::GetLocalVariables() { |
| 555 GetDescIndices(); | 566 GetDescIndices(); |
| 556 intptr_t num_variables = desc_indices_.length(); | 567 intptr_t num_variables = desc_indices_.length(); |
| 557 String& var_name = String::Handle(); | 568 String& var_name = String::Handle(); |
| 558 Instance& value = Instance::Handle(); | 569 Instance& value = Instance::Handle(); |
| (...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1870 } | 1881 } |
| 1871 | 1882 |
| 1872 | 1883 |
| 1873 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 1884 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
| 1874 ASSERT(bpt->next() == NULL); | 1885 ASSERT(bpt->next() == NULL); |
| 1875 bpt->set_next(code_breakpoints_); | 1886 bpt->set_next(code_breakpoints_); |
| 1876 code_breakpoints_ = bpt; | 1887 code_breakpoints_ = bpt; |
| 1877 } | 1888 } |
| 1878 | 1889 |
| 1879 } // namespace dart | 1890 } // namespace dart |
| OLD | NEW |