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

Side by Side Diff: runtime/vm/debugger.cc

Issue 8983034: Getting value of local variables on stack trace (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/debugger.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/code_index_table.h" 7 #include "vm/code_index_table.h"
8 #include "vm/code_patcher.h" 8 #include "vm/code_patcher.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/flags.h" 10 #include "vm/flags.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 160
161 void ActivationFrame::GetLocalVariables() { 161 void ActivationFrame::GetLocalVariables() {
162 if (var_descriptors_ == NULL) { 162 if (var_descriptors_ == NULL) {
163 const Code& code = Code::Handle(DartFunction().code()); 163 const Code& code = Code::Handle(DartFunction().code());
164 var_descriptors_ = 164 var_descriptors_ =
165 &LocalVarDescriptors::ZoneHandle(code.var_descriptors()); 165 &LocalVarDescriptors::ZoneHandle(code.var_descriptors());
166 intptr_t activation_token_pos = TokenIndex(); 166 intptr_t activation_token_pos = TokenIndex();
167 intptr_t desc_len = var_descriptors_->Length(); 167 intptr_t desc_len = var_descriptors_->Length();
168 for (int i = 0; i < desc_len; i++) { 168 for (int i = 0; i < desc_len; i++) {
169 intptr_t begin_pos, end_pos; 169 intptr_t scope_id, begin_pos, end_pos;
170 var_descriptors_->GetRange(i, &begin_pos, &end_pos); 170 var_descriptors_->GetScopeInfo(i, &scope_id, &begin_pos, &end_pos);
171 if ((begin_pos <= activation_token_pos) && 171 if ((begin_pos <= activation_token_pos) &&
172 (activation_token_pos <= end_pos)) { 172 (activation_token_pos <= end_pos)) {
173 desc_indices_.Add(i); 173 desc_indices_.Add(i);
174 } 174 }
175 } 175 }
176 } 176 }
177 } 177 }
178 178
179 179
180 intptr_t ActivationFrame::NumLocalVariables() { 180 intptr_t ActivationFrame::NumLocalVariables() {
181 GetLocalVariables(); 181 GetLocalVariables();
182 return desc_indices_.length(); 182 return desc_indices_.length();
183 } 183 }
184 184
185 185
186 void ActivationFrame::VariableAt(intptr_t i, 186 void ActivationFrame::VariableAt(intptr_t i,
187 String* name, 187 String* name,
188 intptr_t* token_pos, 188 intptr_t* token_pos,
189 intptr_t* end_pos, 189 intptr_t* end_pos,
190 Instance* value) { 190 Instance* value) {
191 GetLocalVariables(); 191 GetLocalVariables();
192 ASSERT(i < desc_indices_.length()); 192 ASSERT(i < desc_indices_.length());
193 ASSERT(name != NULL); 193 ASSERT(name != NULL);
194 intptr_t desc_index = desc_indices_[i]; 194 intptr_t desc_index = desc_indices_[i];
195 *name ^= var_descriptors_->GetName(desc_index); 195 *name ^= var_descriptors_->GetName(desc_index);
196 var_descriptors_->GetRange(i, token_pos, end_pos); 196 intptr_t scope_id;
197 var_descriptors_->GetScopeInfo(i, &scope_id, token_pos, end_pos);
197 ASSERT(value != NULL); 198 ASSERT(value != NULL);
198 *value = GetLocalVarValue(var_descriptors_->GetSlotIndex(i)); 199 *value = GetLocalVarValue(var_descriptors_->GetSlotIndex(i));
199 } 200 }
200 201
201 202
202 RawInstance* ActivationFrame::Value(const String& variable_name) {
203 UNIMPLEMENTED();
204 return NULL;
205 }
206
207
208 const char* ActivationFrame::ToCString() { 203 const char* ActivationFrame::ToCString() {
209 const char* kFormat = "Function: '%s' url: '%s' line: %d"; 204 const char* kFormat = "Function: '%s' url: '%s' line: %d";
210 205
211 const Function& func = DartFunction(); 206 const Function& func = DartFunction();
212 const String& url = String::Handle(SourceUrl()); 207 const String& url = String::Handle(SourceUrl());
213 intptr_t line = LineNumber(); 208 intptr_t line = LineNumber();
214 const char* func_name = Debugger::QualifiedFunctionName(func); 209 const char* func_name = Debugger::QualifiedFunctionName(func);
215 210
216 intptr_t len = 211 intptr_t len =
217 OS::SNPrint(NULL, 0, kFormat, func_name, url.ToCString(), line); 212 OS::SNPrint(NULL, 0, kFormat, func_name, url.ToCString(), line);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 398
404 399
405 void Debugger::AddBreakpoint(Breakpoint* bpt) { 400 void Debugger::AddBreakpoint(Breakpoint* bpt) {
406 ASSERT(bpt->next() == NULL); 401 ASSERT(bpt->next() == NULL);
407 bpt->set_next(this->breakpoints_); 402 bpt->set_next(this->breakpoints_);
408 this->breakpoints_ = bpt; 403 this->breakpoints_ = bpt;
409 } 404 }
410 405
411 406
412 } // namespace dart 407 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/debugger.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698