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

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

Issue 2872503004: vm-service: Add optional 'scope' parameter to 'evaluate' and 'evaluateInFrame'. (Closed)
Patch Set: review Created 3 years, 7 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
« no previous file with comments | « runtime/vm/debugger.h ('k') | runtime/vm/debugger_api_impl.cc » ('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) 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 "platform/address_sanitizer.h" 9 #include "platform/address_sanitizer.h"
10 10
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 static bool IsSyntheticVariableName(const String& var_name) { 1283 static bool IsSyntheticVariableName(const String& var_name) {
1284 return (var_name.Length() >= 1) && (var_name.CharAt(0) == ':'); 1284 return (var_name.Length() >= 1) && (var_name.CharAt(0) == ':');
1285 } 1285 }
1286 1286
1287 1287
1288 static bool IsPrivateVariableName(const String& var_name) { 1288 static bool IsPrivateVariableName(const String& var_name) {
1289 return (var_name.Length() >= 1) && (var_name.CharAt(0) == '_'); 1289 return (var_name.Length() >= 1) && (var_name.CharAt(0) == '_');
1290 } 1290 }
1291 1291
1292 1292
1293 RawObject* ActivationFrame::Evaluate(const String& expr) { 1293 RawObject* ActivationFrame::Evaluate(const String& expr,
1294 const GrowableObjectArray& param_names,
1295 const GrowableObjectArray& param_values) {
1294 GetDescIndices(); 1296 GetDescIndices();
1295 const GrowableObjectArray& param_names =
1296 GrowableObjectArray::Handle(GrowableObjectArray::New());
1297 const GrowableObjectArray& param_values =
1298 GrowableObjectArray::Handle(GrowableObjectArray::New());
1299 String& name = String::Handle(); 1297 String& name = String::Handle();
1298 String& existing_name = String::Handle();
1300 Object& value = Instance::Handle(); 1299 Object& value = Instance::Handle();
1301 intptr_t num_variables = desc_indices_.length(); 1300 intptr_t num_variables = desc_indices_.length();
1302 for (intptr_t i = 0; i < num_variables; i++) { 1301 for (intptr_t i = 0; i < num_variables; i++) {
1303 TokenPosition ignore; 1302 TokenPosition ignore;
1304 VariableAt(i, &name, &ignore, &ignore, &ignore, &value); 1303 VariableAt(i, &name, &ignore, &ignore, &ignore, &value);
1305 if (!name.Equals(Symbols::This()) && !IsSyntheticVariableName(name)) { 1304 if (!name.Equals(Symbols::This()) && !IsSyntheticVariableName(name)) {
1306 if (IsPrivateVariableName(name)) { 1305 if (IsPrivateVariableName(name)) {
1307 name = String::ScrubName(name); 1306 name = String::ScrubName(name);
1308 } 1307 }
1309 param_names.Add(name); 1308 bool conflict = false;
1310 param_values.Add(value); 1309 for (intptr_t j = 0; j < param_names.Length(); j++) {
1310 existing_name ^= param_names.At(j);
1311 if (name.Equals(existing_name)) {
1312 conflict = true;
1313 break;
1314 }
1315 }
1316 // If local has the same name as a binding in the incoming scope, prefer
1317 // the one from the incoming scope, since it is logically a child scope
1318 // of the activation's current scope.
1319 if (!conflict) {
1320 param_names.Add(name);
1321 param_values.Add(value);
1322 }
1311 } 1323 }
1312 } 1324 }
1313 1325
1314 if (function().is_static()) { 1326 if (function().is_static()) {
1315 const Class& cls = Class::Handle(function().Owner()); 1327 const Class& cls = Class::Handle(function().Owner());
1316 return cls.Evaluate(expr, Array::Handle(Array::MakeArray(param_names)), 1328 return cls.Evaluate(expr, Array::Handle(Array::MakeArray(param_names)),
1317 Array::Handle(Array::MakeArray(param_values))); 1329 Array::Handle(Array::MakeArray(param_values)));
1318 } else { 1330 } else {
1319 const Object& receiver = Object::Handle(GetReceiver()); 1331 const Object& receiver = Object::Handle(GetReceiver());
1320 const Class& method_cls = Class::Handle(function().origin()); 1332 const Class& method_cls = Class::Handle(function().origin());
(...skipping 3095 matching lines...) Expand 10 before | Expand all | Expand 10 after
4416 4428
4417 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 4429 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
4418 ASSERT(bpt->next() == NULL); 4430 ASSERT(bpt->next() == NULL);
4419 bpt->set_next(code_breakpoints_); 4431 bpt->set_next(code_breakpoints_);
4420 code_breakpoints_ = bpt; 4432 code_breakpoints_ = bpt;
4421 } 4433 }
4422 4434
4423 #endif // !PRODUCT 4435 #endif // !PRODUCT
4424 4436
4425 } // namespace dart 4437 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/debugger.h ('k') | runtime/vm/debugger_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698