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

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

Issue 2872503004: vm-service: Add optional 'scope' parameter to 'evaluate' and 'evaluateInFrame'. (Closed)
Patch Set: . 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
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 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 static bool IsSyntheticVariableName(const String& var_name) { 1277 static bool IsSyntheticVariableName(const String& var_name) {
1278 return (var_name.Length() >= 1) && (var_name.CharAt(0) == ':'); 1278 return (var_name.Length() >= 1) && (var_name.CharAt(0) == ':');
1279 } 1279 }
1280 1280
1281 1281
1282 static bool IsPrivateVariableName(const String& var_name) { 1282 static bool IsPrivateVariableName(const String& var_name) {
1283 return (var_name.Length() >= 1) && (var_name.CharAt(0) == '_'); 1283 return (var_name.Length() >= 1) && (var_name.CharAt(0) == '_');
1284 } 1284 }
1285 1285
1286 1286
1287 RawObject* ActivationFrame::Evaluate(const String& expr) { 1287 RawObject* ActivationFrame::Evaluate(const String& expr,
1288 const GrowableObjectArray& param_names,
1289 const GrowableObjectArray& param_values) {
1288 GetDescIndices(); 1290 GetDescIndices();
1289 const GrowableObjectArray& param_names =
1290 GrowableObjectArray::Handle(GrowableObjectArray::New());
1291 const GrowableObjectArray& param_values =
1292 GrowableObjectArray::Handle(GrowableObjectArray::New());
1293 String& name = String::Handle(); 1291 String& name = String::Handle();
1292 String& existing_name = String::Handle();
1294 Object& value = Instance::Handle(); 1293 Object& value = Instance::Handle();
1295 intptr_t num_variables = desc_indices_.length(); 1294 intptr_t num_variables = desc_indices_.length();
1296 for (intptr_t i = 0; i < num_variables; i++) { 1295 for (intptr_t i = 0; i < num_variables; i++) {
1297 TokenPosition ignore; 1296 TokenPosition ignore;
1298 VariableAt(i, &name, &ignore, &ignore, &ignore, &value); 1297 VariableAt(i, &name, &ignore, &ignore, &ignore, &value);
1299 if (!name.Equals(Symbols::This()) && !IsSyntheticVariableName(name)) { 1298 if (!name.Equals(Symbols::This()) && !IsSyntheticVariableName(name)) {
1300 if (IsPrivateVariableName(name)) { 1299 if (IsPrivateVariableName(name)) {
1301 name = String::ScrubName(name); 1300 name = String::ScrubName(name);
1302 } 1301 }
1303 param_names.Add(name); 1302 bool conflict = false;
1304 param_values.Add(value); 1303 for (intptr_t j = 0; j < param_names.Length(); j++) {
1304 existing_name ^= param_names.At(j);
1305 if (name.Equals(existing_name)) {
1306 conflict = true;
1307 break;
1308 }
1309 }
1310 if (!conflict) {
1311 param_names.Add(name);
1312 param_values.Add(value);
1313 }
siva 2017/05/18 20:56:48 if there are conflicts what happens do we get an e
rmacnak 2017/05/19 00:56:44 This code says if there is a local 'x' and value i
1305 } 1314 }
1306 } 1315 }
1307 1316
1308 if (function().is_static()) { 1317 if (function().is_static()) {
1309 const Class& cls = Class::Handle(function().Owner()); 1318 const Class& cls = Class::Handle(function().Owner());
1310 return cls.Evaluate(expr, Array::Handle(Array::MakeArray(param_names)), 1319 return cls.Evaluate(expr, Array::Handle(Array::MakeArray(param_names)),
1311 Array::Handle(Array::MakeArray(param_values))); 1320 Array::Handle(Array::MakeArray(param_values)));
1312 } else { 1321 } else {
1313 const Object& receiver = Object::Handle(GetReceiver()); 1322 const Object& receiver = Object::Handle(GetReceiver());
1314 const Class& method_cls = Class::Handle(function().origin()); 1323 const Class& method_cls = Class::Handle(function().origin());
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 bpt->Disable(); 1657 bpt->Disable();
1649 delete bpt; 1658 delete bpt;
1650 } 1659 }
1651 if (NeedsIsolateEvents()) { 1660 if (NeedsIsolateEvents()) {
1652 ServiceEvent event(isolate_, ServiceEvent::kIsolateExit); 1661 ServiceEvent event(isolate_, ServiceEvent::kIsolateExit);
1653 InvokeEventHandler(&event); 1662 InvokeEventHandler(&event);
1654 } 1663 }
1655 } 1664 }
1656 1665
1657 1666
1658 void Debugger::OnIsolateRunnable() { 1667 void Debugger::OnIsolateRunnable() {}
1659 }
1660 1668
1661 1669
1662 static RawFunction* ResolveLibraryFunction(const Library& library, 1670 static RawFunction* ResolveLibraryFunction(const Library& library,
1663 const String& fname) { 1671 const String& fname) {
1664 ASSERT(!library.IsNull()); 1672 ASSERT(!library.IsNull());
1665 const Object& object = Object::Handle(library.ResolveName(fname)); 1673 const Object& object = Object::Handle(library.ResolveName(fname));
1666 if (!object.IsNull() && object.IsFunction()) { 1674 if (!object.IsNull() && object.IsFunction()) {
1667 return Function::Cast(object).raw(); 1675 return Function::Cast(object).raw();
1668 } 1676 }
1669 return Function::null(); 1677 return Function::null();
(...skipping 2715 matching lines...) Expand 10 before | Expand all | Expand 10 after
4385 4393
4386 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 4394 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
4387 ASSERT(bpt->next() == NULL); 4395 ASSERT(bpt->next() == NULL);
4388 bpt->set_next(code_breakpoints_); 4396 bpt->set_next(code_breakpoints_);
4389 code_breakpoints_ = bpt; 4397 code_breakpoints_ = bpt;
4390 } 4398 }
4391 4399
4392 #endif // !PRODUCT 4400 #endif // !PRODUCT
4393 4401
4394 } // namespace dart 4402 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/debugger.h ('k') | runtime/vm/debugger_api_impl.cc » ('j') | runtime/vm/service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698