If there is registered expression compiler, VM debugger uses it to compile expressions. Otherwise, it will fallback to use kernel service compiler.
This is needed to support Flutter use case where compiler is running on developer's host machine, not on the device where VM is running.
Bug: dartbug.com/31981
Change-Id: I8bdfc8ab45a57c306169abe189f1e24e1b0bcf40
Reviewed-on: https://dart-review.googlesource.com/57520
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Moved the responsibility to provide MaxRSS and CurrentRSS from the VM to
the embedder.
The embedder can opt-it by setting a Dart_GetEmbedderInformation
callback using the public Dart_SetEmbedderInformationCallback API.
The implementation of the Dart_GetEmbedderInformation should mandatory
fill the version field and the ones it is able to fill.
The name field must reference a constant C style string, it will not be
freed by the VM code.
R=zra@google.com
Review-Url: https://codereview.chromium.org/2996803002 .
A new RPC is introduced `_registerService` which allow clients to
register new services that are accessible from all the other clients.
Each registered endpoint is identified by 3 strings:
- `service`
a non empty string which identifies the provided service
(e.g. `HotReload`, `OpenFile`)
- `alias`
an alias for that particular endpoint used by clients to identify it
(e.g. `Flutter`, `IntelliJ`)
- `method` __generated__
the RPC method that should be invoked from a client to request it
A new _stream_ `_Service` is introduce, and two related events:
- `ServiceRegistered`
which is triggered when a new client is registered.
All the related information (`service`, `alias`, `method`) are sent.
- `ServiceUnregistered`
which is triggered when a client, which previously registered a
service, disconnects.
Just `service` and `method` are sent.
Related https://github.com/dart-lang/sdk/issues/30023R=asiva@google.com, bkonyi@google.com
Review-Url: https://codereview.chromium.org/2980733003 .
- [x] Add `ServiceProtocolnfo` class to dart:developer.
- [x] Add `Service` class to dart:developer.
- [x] Add `Service.getInfo` static method to dart:developer.
- [x] Add `Service.controlWebServer` static method to dart:developer.
API:
```dart
/// Information about the service protocol.
class ServiceProtocolInfo {
/// The major version of the protocol.
final int majorVersion;
/// The minor version of the protocol.
final int minorVersion;
/// The Uri to access the service. If the web server is not running, this
/// will be null.
final Uri serverUri;
}
/// Access information about the service protocol and control the web server.
class Service {
/// Get information about the service protocol.
static Future<ServiceProtocolInfo> getInfo();
/// Control the web server that the service protocol is accessed through.
static Future<ServiceProtocolInfo> controlWebServer({bool enable: false});
}
```
... and add a randomly generated authentication token path prefix that must be passed in to access the service protocol.
Old base url:
Observatory listening on http://127.0.0.1:54804/
New base url:
Observatory listening on http://127.0.0.1:54804/<token>/
For example:
Observatory listening on http://127.0.0.1:54804/PTwjm8Ii8qg=/
Many tools will need to be updated.
Fixes#23320
BUG=
R=asiva@google.com, rmacnak@google.com
Review URL: https://codereview.chromium.org/2438613002 .
i.e. #ifndef VM_WHATEVER -> #ifndef RUNTIME_VM_WHATEVER
This lets us remove a hack from the PRESUBMIT.py script that existed
for reasons that are no longer valid, and sets us up to add some
presubmit checks for the GN build.
R=asiva@google.com, rmacnak@google.com
Review URL: https://codereview.chromium.org/2450713004 .
- [x] Make `reloadSources` RPC public.
- [x] Add an optional 'pause' parameter to `reloadSources`. When set to true, the isolate will enter the debug pause loop immediately after reloading sources and before resuming execution. This makes it possible for debugger clients to set breakpoints before resuming.
- [x] Add reload_sources_test which tests pausing after reload.
- [x] Fix a bug in `GetVarDescriptors` where a null code object could be used.
R=turnidge@google.com
Review URL: https://codereview.chromium.org/2411153002 .
This cl implements an experimental filesystem maintained in the vm, called dart-devfs. This will allow service protocol users to read and write source files while the vm is running. This is needed for the reload support for flutter.
R=turnidge@google.com
Review URL: https://codereview.chromium.org/2059883003 .
- Rename TimelineEventStreamingRecorder to TimelineEventCallbackRecorder. Note that this should only be used for tests.
- Add 'Timeline' service event stream.
- Send a 'TimelineEvents' event on the 'Timeline' stream whenever a TimelineEventBlock is finished and the 'Timeline' stream is subscribed to.
- Simple service protocol test.
R=turnidge@google.com
Review URL: https://codereview.chromium.org/1765563002 .
- Add dart:developer.postEvent for posting events to the service protocol.
- Add 'Extension' service protocol event stream.
- Unit test.
- Update service.md
- Bug fix for logging stream.
R=turnidge@google.com
Review URL: https://codereview.chromium.org/1537523002 .
- Provide a new callback to Dart_Initialize that will be called when the service isolate needs the Observatory assets
- Move asset management code out of embedder and into common dart:_vmservice
- Use the tar format as the archive format
- Add build script to generate .cc file containing the archive
- Add a simple tar parser to service isolate
This makes it possible for embedders to not bake Observatory into their executable but instead load it off disk or over the network. The standalone embedder still links Observatory into the executable.
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/1411853003 .
- Initialize and shutdown timeline recorder with VM.
- Allocate global blocks for timeline events without an isolate.
- Stop storing the Stream pointer inside a TimelineEvent.
- Store category name in TimelineEvent.
- Store isolate pointer in TimelineEvent.
- TimelineEventRecorder::WriteTo is full VM dump.
- Allow JSONStream to be used without an isolate.
- When a ThreadRegistry is deleted, Finish all open timeline blocks.
- PrintJSON takes a filter.
R=rmacnak@google.com
Review URL: https://codereview.chromium.org//1294023009 .
- Move contents of dart_debugger_api.h into dart_tools_api.h
- Make dart_debugger_api.h forward to dart_tools_api.h
- Move some (service, timeline) bits of dart_api.h into dart_tools_api.h.
R=asiva@google.com
Review URL: https://codereview.chromium.org//1185983005.
This time I am committing the protocol changes first and saving the
Observatory changes for a second cl.
------
We currently support 5 streams: Isolate, Debug, GC, _Echo, and _Graph.
Only generate events when at least one client is listening to the
corresponding event stream.
Only send events to the clients that actually request them.
BUG=
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//1166433008
We currently support 5 streams: Isolate, Debug, GC, _Echo, and _Graph.
Only generate events when at least one client is listening to the
corresponding event stream.
Only send events to the clients that actually request them.
Implement this all as Dart streams in the service lib.
Update tests. Fix a race in async_generator_..._test that was biting me.
Review URL: https://codereview.chromium.org//1143783003
- Add ServiceIdZone interface for getting temporary ids.
- Add RingServiceIdZone which uses the isolate's object id ring.
- Add GrowableServiceIdZone which uses a growable array.
- Unit tests for ServiceIdZones.
- JSONStream has a service id zone.
- Default service id zone is ring with eager id allocation.
- All service RPCs can include a _serviceIdZone parameter.
- Value of _serviceIdZone can be Ring.NewId or Ring.ExistingId.
- All ObjectIdRing usage in object.cc has been replaced with `jsobj.AddServiceId("id", *this);`
- Add a policy for id reuse to ObjectIdRing::GetIdForObject
- ObjectIdRing can dump its contents to JSON.
- Add _dumpRingRequests RPC which dumps the isolate's ring.
- _getCrashDump includes complete object id ring.
R=turnidge@google.com
Review URL: https://codereview.chromium.org//1132323002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45754 260f80e4-7a28-3924-810f-c04153c831b5
Before a response looked like this...
{ result:<string> id:* }
...where result was always a json encoded string. This meant that
users of the service protocol had to json decode both the outer
message and the result, which was silly.
Now a response looks like this:
{ result:<map> id:* }
This means that users of the service protocol only need to decode once.
We have changed event formats as well. Previously, an event looked like this:
{ result:<string> }
(Essentially a result without an id.) The result was json encoded,
requiring the user to double-decode.
Now an event looks like this:
{ event:<map> }
This allows us to distinguish events from rpc results and avoids
double-decoding. It also avoids having an id-less rpc result mistaken
for an event.
------------
Some details and associated changes:
- Unify GCEvent and ServiceEvent in the VM.
- Move sequence number handling out of dart code and into JSONStream
in the VM. Plumbing. I needed to do this to avoid double-encoding.
Some of the dart code gets a bit simpler.
- Update C++ tests to have a sequence number.
- Change format of method/params used in Error responses to be more json-y.
- Strip out double decoding in the service lib.
- Improvements to tests. I was running into some races and other issues.
- Fail fast when we run into a message decoding problem. Instead of
returning a service exception, we now disconnect from the vm.
- VMDisconnected => ConnectionClosed.
- Add some support for a reason string when disconnecting from the vm
in the service library.
Review URL: https://codereview.chromium.org//1093043004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45378 260f80e4-7a28-3924-810f-c04153c831b5
Implement in-frame evaluation in the vm service.
Add a notion of 'current frame' and use it across the debugger,
particularly in source-location based commands (break, clear).
Change the expansion logic for frames, so that by default only the
current frame is shown. When a user expands a frame it is now pinned.
Change command line parsing so that internal whitespace is preserved. We need this to properly evaluate expressions with internal whitespace.
Fix a deadlock in the debugger message loop.
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//993613002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44353 260f80e4-7a28-3924-810f-c04153c831b5
--------
VM
Add a new ServiceEvent class in the vm. Rework the event type names.
Add BreakpointAdded, BreakpointResolved, and BreakpointRemoved
service events.
Record the top frame for kIsolateInterrupted and kExceptionThrown
debugger events.
Send a top frame in more Pause* events.
Send breakpoint list with the Isolate response. Remove the
getBreakpoints method from the vm service.
Move Resume events into debugger.cc.
Rework MessageHandler a bit so that we can send PauseStart and
PauseExit notifications.
--------
Observatory
Move some event handler from Application to Isolate.
Rewrite breakpoint tracking code to use the new breakpoint events.
Change run state tracking in Isolate.
Change getFromMap so that it applies updates if the map isn't a ref.
Use getFromMap instead of new ServiceObject in invokeRpc. This
fixes some duplicate ServiceObject problems.
Review URL: https://codereview.chromium.org//979823003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44268 260f80e4-7a28-3924-810f-c04153c831b5
Service
- Remove support for old-style service requests.
- Drop 'arguments' from JsonStream and ServiceRequestHandler.
- Json-rpc inspired renaming: command->method, options->params all over.
- Implement getFlagList, setFlag, getObjectByAddress.
- Add helpers PrintMissingParamError and PrintInvalidParamError
to make our error messages more regular.
- Update tests.
- Service_SetSource removed for now. John will resurrect.
Observatory
- Drop all Deprecated 'get' functions. We now use json rpc for everything.
- Drop 'link' and 'relativeLink' from ServiceObject -- they were
ui-specific and they are no longer meaningful anyways. Use 'id' instead.
- New pages: VMPage, FlagsPage, InspectPage, ErrorPage. All urls
used by Observatory are now 'new school' and have a proper
prefix. ErrorPage is the new catch-all.
- Pages now use a Uri instead of a url String. This lets them
grab query parameters more easily.
- SimplePage replaces IsolateSuffixPage.
- We now use gotoLink() or makeLink() to make our navigation
links. gotoLink gets some optional parameters to make it
easier to construct links to ServiceObjects.
- Rework mouse clicks on the heap map to use getObjectByAddress.
- Remove the breakpoint_list. It wasn't working. I'll add it back later.
- Silence logging of getIsolateMetric/getVMMetric.
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//897193002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43514 260f80e4-7a28-3924-810f-c04153c831b5