| 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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 RawLocalVarDescriptors::VarInfo var_info; | 486 RawLocalVarDescriptors::VarInfo var_info; |
| 487 var_descriptors_.GetInfo(desc_index, &var_info); | 487 var_descriptors_.GetInfo(desc_index, &var_info); |
| 488 ASSERT(token_pos != NULL); | 488 ASSERT(token_pos != NULL); |
| 489 *token_pos = var_info.begin_pos; | 489 *token_pos = var_info.begin_pos; |
| 490 ASSERT(end_pos != NULL); | 490 ASSERT(end_pos != NULL); |
| 491 *end_pos = var_info.end_pos; | 491 *end_pos = var_info.end_pos; |
| 492 ASSERT(value != NULL); | 492 ASSERT(value != NULL); |
| 493 if (var_info.kind == RawLocalVarDescriptors::kStackVar) { | 493 if (var_info.kind == RawLocalVarDescriptors::kStackVar) { |
| 494 *value = GetLocalVarValue(var_info.index); | 494 *value = GetLocalVarValue(var_info.index); |
| 495 } else { | 495 } else { |
| 496 // TODO(tball): enable context variables once problem with VariableAt() is |
| 497 // fixed, where frame_ctx_level is sometimes off by 1 (issues 8593 and 8594) |
| 498 /* |
| 496 ASSERT(var_info.kind == RawLocalVarDescriptors::kContextVar); | 499 ASSERT(var_info.kind == RawLocalVarDescriptors::kContextVar); |
| 497 ASSERT(!ctx_.IsNull()); | 500 ASSERT(!ctx_.IsNull()); |
| 498 // The context level at the PC/token index of this activation frame. | 501 // The context level at the PC/token index of this activation frame. |
| 499 intptr_t frame_ctx_level = ContextLevel(); | 502 intptr_t frame_ctx_level = ContextLevel(); |
| 500 // The context level of the variable. | 503 // The context level of the variable. |
| 501 intptr_t var_ctx_level = var_info.scope_id; | 504 intptr_t var_ctx_level = var_info.scope_id; |
| 502 intptr_t level_diff = frame_ctx_level - var_ctx_level; | 505 intptr_t level_diff = frame_ctx_level - var_ctx_level; |
| 503 intptr_t ctx_slot = var_info.index; | 506 intptr_t ctx_slot = var_info.index; |
| 504 if (level_diff == 0) { | 507 if (level_diff == 0) { |
| 505 *value = ctx_.At(ctx_slot); | 508 *value = ctx_.At(ctx_slot); |
| 506 } else { | 509 } else { |
| 507 ASSERT(level_diff > 0); | 510 ASSERT(level_diff > 0); |
| 508 Context& ctx = Context::Handle(ctx_.raw()); | 511 Context& ctx = Context::Handle(ctx_.raw()); |
| 509 while (level_diff > 0) { | 512 while (level_diff > 0) { |
| 510 ASSERT(!ctx.IsNull()); | 513 ASSERT(!ctx.IsNull()); |
| 511 level_diff--; | 514 level_diff--; |
| 512 ctx = ctx.parent(); | 515 ctx = ctx.parent(); |
| 513 } | 516 } |
| 514 ASSERT(!ctx.IsNull()); | 517 ASSERT(!ctx.IsNull()); |
| 515 *value = ctx.At(ctx_slot); | 518 *value = ctx.At(ctx_slot); |
| 516 } | 519 } */ |
| 520 *value = Symbols::New("<unknown>"); |
| 517 } | 521 } |
| 518 } | 522 } |
| 519 | 523 |
| 520 | 524 |
| 521 RawArray* ActivationFrame::GetLocalVariables() { | 525 RawArray* ActivationFrame::GetLocalVariables() { |
| 522 GetDescIndices(); | 526 GetDescIndices(); |
| 523 intptr_t num_variables = desc_indices_.length(); | 527 intptr_t num_variables = desc_indices_.length(); |
| 524 String& var_name = String::Handle(); | 528 String& var_name = String::Handle(); |
| 525 Instance& value = Instance::Handle(); | 529 Instance& value = Instance::Handle(); |
| 526 const Array& list = Array::Handle(Array::New(2 * num_variables)); | 530 const Array& list = Array::Handle(Array::New(2 * num_variables)); |
| (...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1730 } | 1734 } |
| 1731 | 1735 |
| 1732 | 1736 |
| 1733 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 1737 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
| 1734 ASSERT(bpt->next() == NULL); | 1738 ASSERT(bpt->next() == NULL); |
| 1735 bpt->set_next(code_breakpoints_); | 1739 bpt->set_next(code_breakpoints_); |
| 1736 code_breakpoints_ = bpt; | 1740 code_breakpoints_ = bpt; |
| 1737 } | 1741 } |
| 1738 | 1742 |
| 1739 } // namespace dart | 1743 } // namespace dart |
| OLD | NEW |