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

Unified Diff: runtime/vm/json_stream.cc

Issue 1312763010: Support column-based breakpoints in the VM and Observatory. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: hausner review Created 5 years, 3 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 | « runtime/vm/json_stream.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/json_stream.cc
diff --git a/runtime/vm/json_stream.cc b/runtime/vm/json_stream.cc
index e0ee6b7280f10bd22e6953f590a290b2ca6056ec..f6a255d621ad024d36b7678f59353ef493e9bf7b 100644
--- a/runtime/vm/json_stream.cc
+++ b/runtime/vm/json_stream.cc
@@ -686,7 +686,7 @@ void JSONObject::AddFixedServiceId(const char* format, ...) const {
void JSONObject::AddLocation(const Script& script,
intptr_t token_pos,
- intptr_t end_token_pos) {
+ intptr_t end_token_pos) const {
JSONObject location(this, "location");
location.AddProperty("type", "SourceLocation");
location.AddProperty("script", script);
@@ -697,6 +697,49 @@ void JSONObject::AddLocation(const Script& script,
}
+void JSONObject::AddLocation(const BreakpointLocation* bpt_loc) const {
+ ASSERT(bpt_loc->IsResolved());
+
+ Isolate* isolate = Isolate::Current();
+ Library& library = Library::Handle(isolate);
+ Script& script = Script::Handle(isolate);
+ intptr_t token_pos;
+ bpt_loc->GetCodeLocation(&library, &script, &token_pos);
+ AddLocation(script, token_pos);
+}
+
+
+void JSONObject::AddUnresolvedLocation(
+ const BreakpointLocation* bpt_loc) const {
+ ASSERT(!bpt_loc->IsResolved());
+
+ Isolate* isolate = Isolate::Current();
+ Library& library = Library::Handle(isolate);
+ Script& script = Script::Handle(isolate);
+ intptr_t token_pos;
+ bpt_loc->GetCodeLocation(&library, &script, &token_pos);
+
+ JSONObject location(this, "location");
+ location.AddProperty("type", "UnresolvedSourceLocation");
+ if (!script.IsNull()) {
+ location.AddProperty("script", script);
+ } else {
+ const String& scriptUri = String::Handle(isolate, bpt_loc->url());
+ location.AddPropertyStr("scriptUri", scriptUri);
+ }
+ if (bpt_loc->requested_line_number() >= 0) {
+ // This unresolved breakpoint was specified at a particular line.
+ location.AddProperty("line", bpt_loc->requested_line_number());
+ if (bpt_loc->requested_column_number() >= 0) {
+ location.AddProperty("column",
+ bpt_loc->requested_column_number());
+ }
+ } else {
+ // This unresolved breakpoint was requested at some function entry.
+ location.AddProperty("tokenPos", token_pos);
+ }
+}
+
void JSONObject::AddPropertyF(const char* name,
const char* format, ...) const {
« no previous file with comments | « runtime/vm/json_stream.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698