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

Unified Diff: runtime/vm/debugger.cc

Issue 8826007: First bits of external debugger API (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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
Index: runtime/vm/debugger.cc
===================================================================
--- runtime/vm/debugger.cc (revision 2094)
+++ runtime/vm/debugger.cc (working copy)
@@ -185,13 +185,12 @@
}
-static RawFunction* ResolveLibraryFunction(const String& fname) {
- Isolate* isolate = Isolate::Current();
- const Library& root_lib =
- Library::Handle(isolate->object_store()->root_library());
- ASSERT(!root_lib.IsNull());
+static RawFunction* ResolveLibraryFunction(
+ const Library& library,
+ const String& fname) {
+ ASSERT(!library.IsNull());
Function& function = Function::Handle();
- const Object& object = Object::Handle(root_lib.LookupObject(fname));
+ const Object& object = Object::Handle(library.LookupObject(fname));
if (!object.IsNull() && object.IsFunction()) {
function ^= object.raw();
}
@@ -199,13 +198,16 @@
}
-static RawFunction* ResolveFunction(const String& class_name,
- const String& function_name) {
- Isolate* isolate = Isolate::Current();
- const Library& root_lib =
- Library::Handle(isolate->object_store()->root_library());
- const Class& cls = Class::Handle(root_lib.LookupClass(class_name));
-
+RawFunction* Debugger::ResolveFunction(const Library& library,
+ const String& class_name,
+ const String& function_name) {
+ ASSERT(!library.IsNull());
+ ASSERT(!class_name.IsNull());
+ ASSERT(!function_name.IsNull());
+ if (class_name.Length() == 0) {
+ return ResolveLibraryFunction(library, function_name);
+ }
+ const Class& cls = Class::Handle(library.LookupClass(class_name));
Function& function = Function::Handle();
if (!cls.IsNull()) {
function = cls.LookupStaticFunction(function_name);
@@ -217,22 +219,12 @@
}
-void Debugger::SetBreakpointAtEntry(const String& class_name,
- const String& function_name) {
- Function& func = Function::Handle();
- if (class_name.IsNull() || (class_name.Length() == 0)) {
- func = ResolveLibraryFunction(function_name);
- } else {
- func = ResolveFunction(class_name, function_name);
+Breakpoint* Debugger::SetBreakpointAtEntry(const Function& target_function) {
+ ASSERT(!target_function.IsNull());
+ if (!target_function.HasCode()) {
+ Compiler::CompileFunction(target_function);
}
- if (func.IsNull()) {
- OS::Print("could not find function '%s'\n", function_name.ToCString());
- return;
- }
- if (!func.HasCode()) {
- Compiler::CompileFunction(func);
- }
- Code& code = Code::Handle(func.code());
+ Code& code = Code::Handle(target_function.code());
ASSERT(!code.IsNull());
PcDescriptors& desc = PcDescriptors::Handle(code.pc_descriptors());
for (int i = 0; i < desc.Length(); i++) {
@@ -241,12 +233,12 @@
if (kind == PcDescriptors::kIcCall) {
CodePatcher::PatchInstanceCallAt(
desc.PC(i), StubCode::BreakpointDynamicEntryPoint());
- bpt = new Breakpoint(func, i);
+ bpt = new Breakpoint(target_function, i);
} else if (kind == PcDescriptors::kOther) {
if (CodePatcher::IsDartCall(desc.PC(i))) {
CodePatcher::PatchStaticCallAt(
desc.PC(i), StubCode::BreakpointStaticEntryPoint());
- bpt = new Breakpoint(func, i);
+ bpt = new Breakpoint(target_function, i);
}
}
if (bpt != NULL) {
@@ -255,11 +247,10 @@
bpt->LineNumber(),
bpt->pc());
AddBreakpoint(bpt);
- return;
+ return bpt;
}
}
- OS::Print("no breakpoint location found in function '%s'\n",
- function_name.ToCString());
+ return NULL;
}
@@ -320,24 +311,7 @@
return;
}
initialized_ = true;
- if (!FLAG_debugger) {
- return;
- }
- if (FLAG_bpt == NULL) {
- FLAG_bpt = "main";
- }
- String& cname = String::Handle();
- String& fname = String::Handle();
- const char* dot = strchr(FLAG_bpt, '.');
- if (dot == NULL) {
- fname = String::New(FLAG_bpt);
- } else {
- fname = String::New(dot + 1);
- cname = String::New(reinterpret_cast<const uint8_t*>(FLAG_bpt),
- dot - FLAG_bpt);
- }
SetBreakpointHandler(DefaultBreakpointHandler);
- SetBreakpointAtEntry(cname, fname);
}
« runtime/bin/bin.gypi ('K') | « runtime/vm/debugger.h ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698