Chromium Code Reviews| 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 if ((ctx_slot < ctx_.num_variables()) && (ctx_slot >= 0)) { |
| 539 *value = ctx_.At(ctx_slot); | |
| 540 } else { | |
|
hausner
2013/08/26 15:27:48
Maybe add a comment here describing that we only g
siva
2013/08/26 16:55:39
Created an issue https://code.google.com/p/dart/is
| |
| 541 *value = Symbols::New("<unknown>"); | |
| 542 } | |
| 539 } else { | 543 } else { |
| 540 ASSERT(level_diff > 0); | 544 ASSERT(level_diff > 0); |
| 541 Context& ctx = Context::Handle(ctx_.raw()); | 545 Context& ctx = Context::Handle(ctx_.raw()); |
| 542 while (level_diff > 0) { | 546 while (level_diff > 0 && !ctx.IsNull()) { |
| 543 ASSERT(!ctx.IsNull()); | |
| 544 level_diff--; | 547 level_diff--; |
| 545 ctx = ctx.parent(); | 548 ctx = ctx.parent(); |
| 546 } | 549 } |
| 547 ASSERT(!ctx.IsNull()); | 550 if (!ctx.IsNull() && |
| 548 *value = ctx.At(ctx_slot); | 551 ((ctx_slot < ctx_.num_variables()) && (ctx_slot >= 0))) { |
| 552 *value = ctx.At(ctx_slot); | |
| 553 } else { | |
| 554 *value = Symbols::New("<unknown>"); | |
|
hausner
2013/08/26 15:27:48
ditto.
siva
2013/08/26 16:55:39
Ditto.
On 2013/08/26 15:27:48, hausner wrote:
| |
| 555 } | |
| 549 } | 556 } |
| 550 } | 557 } |
| 551 } | 558 } |
| 552 | 559 |
| 553 | 560 |
| 554 RawArray* ActivationFrame::GetLocalVariables() { | 561 RawArray* ActivationFrame::GetLocalVariables() { |
| 555 GetDescIndices(); | 562 GetDescIndices(); |
| 556 intptr_t num_variables = desc_indices_.length(); | 563 intptr_t num_variables = desc_indices_.length(); |
| 557 String& var_name = String::Handle(); | 564 String& var_name = String::Handle(); |
| 558 Instance& value = Instance::Handle(); | 565 Instance& value = Instance::Handle(); |
| (...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1870 } | 1877 } |
| 1871 | 1878 |
| 1872 | 1879 |
| 1873 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 1880 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
| 1874 ASSERT(bpt->next() == NULL); | 1881 ASSERT(bpt->next() == NULL); |
| 1875 bpt->set_next(code_breakpoints_); | 1882 bpt->set_next(code_breakpoints_); |
| 1876 code_breakpoints_ = bpt; | 1883 code_breakpoints_ = bpt; |
| 1877 } | 1884 } |
| 1878 | 1885 |
| 1879 } // namespace dart | 1886 } // namespace dart |
| OLD | NEW |