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

Unified Diff: runtime/vm/debugger.cc

Issue 13948009: Fix issue 9744 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger.cc
===================================================================
--- runtime/vm/debugger.cc (revision 21173)
+++ runtime/vm/debugger.cc (working copy)
@@ -262,7 +262,6 @@
break;
}
}
- ASSERT(token_pos_ >= 0);
}
return token_pos_;
}
@@ -270,8 +269,7 @@
intptr_t ActivationFrame::PcDescIndex() {
if (pc_desc_index_ < 0) {
- TokenPos();
- ASSERT(pc_desc_index_ >= 0);
+ TokenPos(); // Sets pc_desc_index_ as a side effect.
}
return pc_desc_index_;
}
@@ -279,13 +277,17 @@
intptr_t ActivationFrame::TryIndex() {
intptr_t desc_index = PcDescIndex();
- return pc_desc_.TryIndex(desc_index);
+ if (desc_index < 0) {
+ return -1;
+ } else {
+ return pc_desc_.TryIndex(desc_index);
+ }
}
intptr_t ActivationFrame::LineNumber() {
// Compute line number lazily since it causes scanning of the script.
- if (line_number_ < 0) {
+ if ((line_number_ < 0) && (TokenPos() >= 0)) {
const Script& script = Script::Handle(SourceScript());
intptr_t ignore_column;
script.GetTokenLocation(TokenPos(), &line_number_, &ignore_column);
@@ -308,6 +310,12 @@
ASSERT(!code_.is_optimized());
context_level_ = 0;
intptr_t pc_desc_idx = PcDescIndex();
+ // TODO(hausner): What to do if there is no descriptor entry
+ // for the code position of the frame? For now say we are at context
+ // level 0.
+ if (pc_desc_idx < 0) {
+ return context_level_;
+ }
ASSERT(!pc_desc_.IsNull());
if (pc_desc_.DescriptorKind(pc_desc_idx) == PcDescriptors::kReturn) {
// Special case: the context chain has already been deallocated.
@@ -316,6 +324,7 @@
}
intptr_t innermost_begin_pos = 0;
intptr_t activation_token_pos = TokenPos();
+ ASSERT(activation_token_pos >= 0);
GetVarDescriptors();
intptr_t var_desc_len = var_descriptors_.Length();
for (int cur_idx = 0; cur_idx < var_desc_len; cur_idx++) {
@@ -406,8 +415,15 @@
return;
}
+ intptr_t activation_token_pos = TokenPos();
+ if (activation_token_pos < 0) {
+ // We don't have a token position for this frame, so can't determine
+ // which variables are visible.
+ vars_initialized_ = true;
+ return;
+ }
+
GrowableArray<String*> var_names(8);
- intptr_t activation_token_pos = TokenPos();
intptr_t var_desc_len = var_descriptors_.Length();
for (int cur_idx = 0; cur_idx < var_desc_len; cur_idx++) {
ASSERT(var_names.length() == desc_indices_.length());
@@ -992,6 +1008,7 @@
intptr_t lowest_pc_index = -1;
for (int i = 0; i < desc.Length(); i++) {
intptr_t desc_token_pos = desc.TokenPos(i);
+ ASSERT(desc_token_pos >= 0);
if (desc_token_pos < first_token_pos) {
continue;
}
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698