This change add the ability to restart the vm through the service
protocol. All isolates are killed, and then the main isolate is
restarted cooperatively by the embedder.
This change also fixes the message handler to prevent it from
accidentally ignoring vm shutdown messages.
Previously, we would stop handling messages whenever we hit an error
(such as a compile error or an unhandled exception). This would leave
shutdown requests sitting the oob queue, neglected.
We now process *all* oob requests, up to the first shutdown request.
When we hit a shutdown request, we clear the oob queue and process no
more messages.
To make all of this work, we had to change the return value of
HandleMessage from bool to a new enum type, allowing the message
handler to distinguish *normal* error cases from the more rarified
shutdown and restart cases.
R=johnmccutchan@google.com, zra@google.com
Review URL: https://codereview.chromium.org/1371193005 .
deprecated isolate based API.)
- Update all code impacted by this change. E.g. DARTSCOPE
- TEST_CASE now passes the current thread as a parameter to the unit test.
BUG=
R=asiva@google.com
Review URL: https://codereview.chromium.org//1310463005 .
- 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 .
* Numeric ids will not be converted to strings.
* String ids will be escaped, so an id of '"' doesn't produce invalid
JSON.
* List or map ids will be rejected.
* Null ids will produce no response.
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//1255003003 .
This matches the JSON-RPC 2.0 spec:
http://www.jsonrpc.org/specification#response_object
While this is technically a breaking change, it seems very unlikely that
any consumers were validating this form of the parameter. The
documentation was already inconsistent about whether it was hyphenated,
and the only code likely to be using would be written against the
JSON-RPC 2.0 spec itself, and would reject the old format anyway.
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//1256023003 .
- Allow for multiple breakpoints in the service protocol.
The info isn't actually provided or used yet.
- Drop index for list elements returned by the protocol. Flatten structure.
- Drop index for context elements. Keep sub-structure so we
can choose to add extra slot info later.
- Errors now have ids and kinds.
- exception and stacktrace move from @Error to Error.
- All heap Objects now include class/size.
- Changed BoundedType.type and TypeRef.type to different names.
Turns out we already have a "type" property that conflicts.
BUG=
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//1152753005
In JSON RPC, error results and regular results are distinguished structurally. We now do this in the service protocol instead of returning a regular result with the "Error" type.
VM:
- Add PrintError method to JSONStream. Use this to generate all errors in the service protocol.
- Fix some bugs with "limit" parameter handling.
- Change return value for heap rpcs when they find a collected/expired reference.
- Update tests.
Observatory:
- Add app.handleExceptions -- this is a widely-used exception handler that puts up a notification when there is an uncaught/unexpected exception. Added a top-level zone catch that uses this handler, as well as explicit uses of this handler at various points in the code. Most pages use this implicitly or explictly, except for the debugger page, which displays exceptions in the console.
[ General rule, when a function returns a Future, generally let the error pass through. If a function does async work but doesn't return the Future, then it should handle errors explicitly by calling app.handleExceptions, etc. ]
- Fixed notifications. They were generally broken. Some hard-coded type names needed to be fixed, some hacks needed to be removed.
- Add a new class RpcException and a variety of subclasses which capture the error cases when making an rpc.
- Redo refresh buttons so their callbacks return Futures instead of taking a "done" closure. Cleaner. Allows us to move error handling outside of the callback.
- Drop ServiceError, ServiceException and the associated views.
- Redo notifications so that event and exception notifications are supported.
- No longer null out the vm when it is disconnected.
- Remove notifications when we visit the vm-connect page. Only show the "Proceeding will lose current page" dialog when we aren't on the vm-connect page already.
- Improve error message on cpu profile page when profiling is disabled on the VM.
- Allow variables to wrap on debugger page.
- Make eval-box and eval-link tolerant of errors during rpc. Make the errors display nicely.
- When a breakpoint is marked "not possible", make sure it disappears. This got broken during script view refactor.
- Drop vm's errors and exceptions streams. No longer needed.
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//1120133002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45792 260f80e4-7a28-3924-810f-c04153c831b5
- 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
- Log the parameters to RPCs
- Display messages like stack frames
- handler function and script visible
- message preview instead of local variables
- Expanded and previewed messages do not collapse when stepping within the existing message
- Mark patch classes as finalized to avoid ASSERT on class_finalizer.cc:2358 **
- Support iterating over message queues
- Support printing the message queue as JSON
- Inhibit OOB messages from being handled if we are iterating over the message queue
- avoids dead lock when looking up port handler (done in Dart code with message handler locked) and a stack overflow trigger to handle OOB messages
- make getObject understand message ids
- Fix dartbug.com/23355
** Need to discuss with Ivan and Matthias (reviewed code differs from committed code but matches my fix):
https://codereview.chromium.org//828353002https://code.google.com/p/dart/source/detail?r=42612R=turnidge@google.com
Review URL: https://codereview.chromium.org//1122503003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45505 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
- Add the "isolate" command which allows the user to switch isolate by name or number. Supports completion.
- Add the "isolate name" command which allows the user to rename an isolate. Add the "setName" method to the service protocol to support this. Isolates now have a debugger_name() in the vm.
- The new IsolateUpdate event notifies the client when an isolate name changes.
- When an isolate is updated, update the page's isolate too, so the navbar is accurate.
- Update isolate summary to display isolate number.
- Rework how the isolate's name is computed because we were getting garbagey names in the IsolateStart event (SpawnState was not yet set).
- Make sure that the debugger doesn't subscribe to events multiple times.
- "info isolates" is now "isolate list".
- Rework reporting of vm and isolate startTime in the service protocol and in Observatory.
- Fix bug in command completion when subcommands and other completions share common prefixes.
- Rework isolate accounting in the VM object in Observatory. We now create Isolates in getFromMap rather than from IsolateStart events, per se. Rewrite the isolate updating code.
- IsolateStart and IsolateExit events are now owned by the Isolate itself, rather than the vm.
- Return the actual result in pause/resume/etc.
- Add assertion in JSONStream::PrintProperty64 that the result fits in a javascript double. Sigh.
- Stop sending GC events for the service isolate. Add assertions to guard against this happening in the future.
- Misc improvements in error reporting.
Review URL: https://codereview.chromium.org//1007863003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44718 260f80e4-7a28-3924-810f-c04153c831b5
Profiler improvements:
- Track Functions in profile and build Function based trie
- Associate code objects with functions
- Created cpu_profile.dart library
- Major speed improvements for disassembly view
- Fix truncation of disassembly comments
- Ability to get code object ticks from disassembly view
- Inlining mini-map in disassembly view.
- Remove a bunch of unused data from profile service response
- In some cases a caller PC that is better than the PC marker is inserted into the stack trace
- Inlined functions are expanded
- Ability to clear profile
- New flag '--keep_code' which keeps deoptimized code around for use by the profiler.
General fixes:
- Fix caching in service library
- Remove pubspec.yaml before running pub get
R=asiva@google.com, rmacnak@google.com
Review URL: https://codereview.chromium.org//928833003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44067 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
We now return a "type" property and an optional "_vmType" property for
each response. We use this to "hide" vm implementation specifics in
the VM Service protocol.
For example, before we might have returned an integer reference with type
"@Smi". Now it would have the type "@int" and the _vmType "@Smi".
This also allows us to hide funky vm internal types behind the generic
"Object" type.
Updated the protocol.md file somewhat to describe a notion of "private
properties".
Updated the Observatory and unit tests.
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org//547703002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40044 260f80e4-7a28-3924-810f-c04153c831b5
Two types of metrics:
* Counter - a measured value
* Gauge - A measured value with a min and max
Follow up CLs for the backend:
* Support for internal VM metrics (implemented in C++ but visible over the service).
Follow up CLs for the frontend:
* Query list of metrics
* Get latest value of a metric
* Collect values over time and graph them.
I'd like some feedback on the API and the data reported.
R=koda@google.com
Review URL: https://codereview.chromium.org//409213004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38793 260f80e4-7a28-3924-810f-c04153c831b5