Commit Graph

494 Commits

Author SHA1 Message Date
John McCutchan cd116d861b Fix service tests
BUG=

Review-Url: https://codereview.chromium.org/2568963002 .
2016-12-12 12:43:01 -08:00
Ben Konyi 35a49bc1ff Created methods to surface zone memory information for each isolate and thread in JSON.
BUG=
R=asiva@google.com, johnmccutchan@google.com, zra@google.com

Review URL: https://codereview.chromium.org/2554983002 .
2016-12-12 09:56:49 -08:00
Todd Turnidge e0d350aa27 Implement rewind on all platforms except for dbc.
BUG=

Review URL: https://codereview.chromium.org/2534413005 .
2016-12-01 17:19:31 -08:00
Ryan Macnak 0cf02040f8 Add a version of heap snapshots that use only fields and stack frames as roots and only include instances.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2502283003 .
2016-11-28 16:00:06 -08:00
Todd Turnidge 193ddba4db Revert "Implement rewind: drop one or more frames from the debugger."
This reverts commit af1875be91.

BUG=

Review URL: https://codereview.chromium.org/2521413002 .
2016-11-22 16:05:26 -08:00
Todd Turnidge af1875be91 Implement rewind: drop one or more frames from the debugger.
Not yet implemented on dbc.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2523053002 .
2016-11-22 15:26:08 -08:00
John McCutchan f43b48e34d Support reloading from source on top of a script snapshot.
- [x] Add arguments `rootLibUri` and `packagesUri` to the reload service rpc. These allow the uri of the root library and the .packages files to be overridden.
- [x] When pairing libraries during reload, support the base url changing.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2512483002 .
2016-11-17 11:29:12 -08:00
Ryan Macnak d4b5793307 Enable service tests for app snapshots.
Issue #27806

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2496993002 .
2016-11-15 16:12:59 -08:00
Zachary Anderson a1bcf051d8 clang-format runtime/vm
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2481873005 .
2016-11-08 13:54:47 -08:00
John McCutchan 63e4f69e5e Provide an API to dart:developer to control the web server hosting the Service Protocol
- [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 .
2016-10-31 12:32:23 -07:00
Ryan Macnak 61bf8abd75 Make fatal out of memory messages uniform.
Add checks in a few more places with large allocations.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2418323002 .
2016-10-19 16:37:59 -07:00
John McCutchan 2d0a08baf9 Make reloadSources service RPC public
- [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 .
2016-10-13 07:45:56 -07:00
John McCutchan 48c6f19600 Respect setLibraryDebuggable
- [x] Mark all libraries debuggable by default
- [x] Mark all dart:_* libraries as not debuggable by default
- [x] Respect setLibraryDebuggable
- [x] Add set library debuggable test case
- [x] Do not allow dart:_* libraries to be marked debuggable

Fixes https://github.com/dart-lang/sdk/issues/27370

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2361183002 .
2016-09-23 10:45:51 -07:00
Todd Turnidge ec6d9efc38 Fix an off-by-one error in vmservice expression evaluation.
Closes #25973

R=hausner@google.com

Review URL: https://codereview.chromium.org/2298773003 .
2016-09-06 12:50:14 -07:00
Ryan Macnak e46b3cd994 Treat background finalization as another GC task so it won't run in parallel with the marker.
Prevents a race between the marker and finalizer when the handle is freed (fixes #27029).

Disallow creating weak handles for immediate objects. We don't distinguish these from free handles, so their callbacks are never run.

Don't report freed handles over the vm service.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2281193002 .
2016-08-29 16:47:56 -07:00
Ryan Macnak d644dc0661 Prevent the allInstances array from creating spurious references on future heap queries.
Also prevent spurious references to Fields from retaining path's work array.

Fixes #27156

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2278223002 .
2016-08-25 11:26:15 -07:00
John McCutchan d8eb5ffb57 Do not allow a hot reload if the isolate has a sticky error
BUG=
R=turnidge@google.com

Review URL: https://codereview.chromium.org/2278613002 .
2016-08-24 11:31:46 -07:00
Ryan Macnak cdb7b03ee0 vm-service: Reduce copying involved in sending binary events (e.g., heap snapshot).
Issue #27092

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2273463002 .
2016-08-23 10:02:33 -07:00
Ryan Macnak d418dde65b Reduce copying in sending service responses.
Add missing safepoint transitions.

Issue #27092
Likely contributes to Issue #27010

dart2js hello
Peak RSS at first Observatory visit -> Peak RSS after visiting timeline (with endless recorder)
Before 215M -> 321M
After 182M -> 233M

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2254543006 .
2016-08-18 10:34:50 -07:00
Ryan Macnak 80e4763a21 Observatory: Report peak process memory usage.
BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2250793004 .
2016-08-17 13:38:52 -07:00
Carlo Bernaschina a58c34254d Compacting _GetRetainingPath result avoiding some internal structures.
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2231313002 .
2016-08-12 13:42:04 -07:00
John McCutchan 501c9896c1 Refactor how we report reload results
- [x] Give the IsolateReloadContext a JSONStream.
- [x] Remove the sticky reload error from the isolate.
- [x] Print all reasons for cancelling when we fail.

R=turnidge@google.com

Review URL: https://codereview.chromium.org/2196723002 .
2016-08-01 12:30:39 -07:00
Todd Turnidge 1166f83bf6 Only reload libraries when they may have been modified.
We now check all of the scripts which make up a library.  If any
script is modified, then we consider that library to be modified.  We
also consider any library which imports a modified library to be
modified.  To propagate this info efficiently, we build and discard
the imported-by graph when beginning a reload.

The embedder must provide a FileModifiedCallback in order to support
the detection of modified scripts.

In order to detect changes to package: libraries, we have modified the
embedder interface to provide the resolved url when possible, so that
we don't need to re-resolve package uris when checking for reload.
This change is incompatible and all embedders will need to be updated.

We now support a "force" flag when reloading sources.  This causes all
libraries to be reloaded regardless of whether the underlying scripts
have been updated.

Closes #26919

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2186423002 .
2016-07-29 11:23:18 -07:00
Ryan Macnak 2c7983a1d1 vm-service: Include pauseEvent even when running without debugger support.
Pausing the isolate at event boundries, such as --pause-isolates-on-start, doesn't require debugger support.

Fix crash in getStack RPC when running the JIT with --support-debugger=false.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2180613002 .
2016-07-25 09:24:30 -07:00
Todd Turnidge f7242f2137 Reimplement devfs in dart. Implementation now writes to disk.
BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2120473004 .
2016-07-01 14:57:32 -07:00
John McCutchan 51ace86544 Bug fixes for hot reload
- [x] Report the reload error synchronously from the _reloadSources RPC.
- [x] Add sticky reload error to an isolate so we can report the error.
- [x] Remove redundant 'OnStackReload'.
- [x] Fix a bug where a class could have a field added but we wouldn't reject it.
- [x] Add unit test for above bug fix.
- [x] Enable reload via the service protocol with a live stack.

R=fschneider@google.com

Review URL: https://codereview.chromium.org/2070873002 .
2016-06-16 11:02:35 -07:00
John McCutchan 1a4c2005cc DevFS initial implementation.
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 .
2016-06-10 12:33:50 -07:00
Todd Turnidge 055231cee0 Allow embedder service request handlers to return JSON-RPC errors.
BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2041293003 .
2016-06-07 15:47:37 -07:00
Ryan Macnak 3f8c0bb0a9 Don't overload FreeListElement for become.
R=asiva@google.com, johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2026643004 .
2016-06-02 10:57:34 -07:00
Ryan Macnak 435b371cb7 Make the object store visible in Observatory.
R=turnidge@google.com

Review URL: https://codereview.chromium.org/2012333002 .
2016-06-01 13:00:22 -07:00
Ryan Macnak 7bdf01560a Speculatively revert "Make the object store visible in Observatory."
This reverts commit 2eb8408969.

TBR=turnidge@google.com

Review URL: https://codereview.chromium.org/2002253005 .
2016-05-25 17:33:52 -07:00
Ryan Macnak 2eb8408969 Make the object store visible in Observatory.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2005983002 .
2016-05-25 11:12:32 -07:00
Siva Annamalai 5de775a823 - Canonicalize generic types in a global isolate hash
table, this ensures that we do not linearly walk through
  a large type list in the class calling the expensive
  'Type::Equals' method (some applications have close to
  1304 generic types in them)

- Use the stand hash table implementation for TypeArguments
  canonicalization instead of a custom hash table

R=johnmccutchan@google.com, regis@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/1965493004 .
2016-05-17 14:35:23 -07:00
John McCutchan 48c8ffa7f3 Initial isolate reload support
This is a cut of the work that Todd and I collaborated on in the reload branch.

In this CL, we've dropped the loader port hacks, in other words, on stack reloading in the standalone embedder does not work yet.

- [x] Support for hot reloading of isolate source code
- [x] Unit test harness and many tests
- [x] Service protocol and Observatory support
- [x] Product build does not include support for hot reloading.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1965823002 .
2016-05-17 12:19:06 -07:00
Todd Turnidge 5e196ada5d VMMustBePaused -> IsolateMustBePaused
Closes #24537

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1973303003 .
2016-05-16 11:19:22 -07:00
John McCutchan b895aa5154 Improve CPU Profile View
Service:

- [x] Add "_profilerMode" to VM response. "VM" or "Dart" depending on --profile-vm flag.
- [x] Output a tree where VM tag are treated as executing "exit frame" functions when profiling Dart.
- [x] tick "exit frame" tag functions when profiling Dart.

Observatory:

- [x] don't include option for VM tags when profiling Dart.
- [x] default to no tags when profiling Dart.

- [x] indent the colored bar closer to the down arrow.
- [x] don't show percentages for user tag rows.

- [x] Update cpu profile table view to use virtual tree.
- [x] Update class allocation view to use virtual tree.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1851293005 .
2016-05-13 10:07:19 -07:00
Todd Turnidge 6b28b4f7ef Remove DebuggerEvent. Refactor remaining code.
BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1978603002 .
2016-05-13 09:49:31 -07:00
Todd Turnidge 956ac4c183 Fix getSourceReport's forceCompile option for unused classes.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1916243002 .
2016-05-04 11:02:06 -07:00
Ivan Posva c434931517 - Remove --coverage_dir flag and old-style coverage service requests.
BUG=

Review URL: https://codereview.chromium.org/1846443002 .
2016-04-07 16:24:49 -07:00
John McCutchan 1c4f63df6c Print the isolate's sticky error if it has one.
- Bump protocol version to 3.4 to match service.md.
- Added note in changelog about 'none' pause event.
- Print the isolate's sticky error if it has one.

Fixes #26203

Review URL: https://codereview.chromium.org/1862903003 .
2016-04-07 15:31:50 -07:00
Ryan Macnak 87e8bc2c96 VM: Evaluate-in-frame should happen in the scope of the method class, not the receiver class.
BUG=http://dartbug.com/26161
R=hausner@google.com

Review URL: https://codereview.chromium.org/1854243002 .
2016-04-04 15:22:57 -07:00
Srdjan Mitrovic 40d8eee81e Remove unnecessary isolate argument from some visitors
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org/1838373002 .
2016-03-29 14:47:51 -07:00
Ryan Macnak 00eff0ff6a Improve error message when attempting to evaluate against a VM-internal object (e.g., a MegamorphicCache's table).
Don't accumulate object annotations on the disassembly when refreshing a Code view.

BUG=http://dartbug.com/26008
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1835393002 .
2016-03-28 14:51:06 -07:00
Ryan Macnak 6eaa45058c Perform a full GC by default when requesting a heap snapshot.
Prevents the snapshot from include objects that are only weakly
reachable.

BUG=http://dartbug.com/25994
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1811713002 .
2016-03-17 11:11:38 -07:00
John McCutchan c65114b6b4 Timeline API fixes for Flutter
API changes:

- Remove isolate specific Timeline APIs.
- Remove Dart_EmbedderTimelineGetTimeline callback.
- Add Dart_TimelineEvent so that arbitrary trace events can be added.

Internal changes:

- Remove isolate specific streams which were never used or controllable from outside the VM.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1811613002 .
2016-03-16 12:18:46 -07:00
John McCutchan ffbd0b763a Add profile data to getSourceReport
- Add new getSourceReport kind 'Profile'.
- Add "profileTicks" to source ranges that have profile data.
- "profileTicks" is organized as three arrays: positions, inclusive ticks, and exclusive ticks. These arrays are indexed together.
- Keep source positions in profile sorted by token position value.
- Misc improvements to debug printing in profiler.
- Add unit test for profile getSourceReport.

R=turnidge@google.com

Review URL: https://codereview.chromium.org/1779333004 .
2016-03-14 07:04:23 -07:00
John McCutchan 32abe2ce55 Stream blocks of timeline events over the service protocol. Can be used to monitor long running programs without buffering all events inside the VM.
- 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 .
2016-03-04 12:30:50 -08:00
John McCutchan 49dc7e557b Fix some service protocol isolate life cycle races that were discovered by the Flutter testing tool.
Fixes #25902

Issue #1

Assuming --pause-isolates-on-start, there is a window of time after an isolate is made runnable and before it pauses at the first message that we say the isolate is "resumed".

- Fix issue #1 by claiming the isolate is paused on start if it will eventually pause on start.
- Also, handle the resume command for this state by clearing the 'should pause on start' bit.

Issue #2

Before an isolate is made runnable we say the isolate is "resumed".

- Fix issue #2 by introducing a new pause event "None".

R=turnidge@google.com

Review URL: https://codereview.chromium.org/1756393002 .
2016-03-03 11:30:41 -08:00
Todd Turnidge 5d83c5ec9b Print isolate properly in debug output for IsolateRunnable events.
Be a bit more verbose in test_helper to help us track down some test hangs.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1760963002 .
2016-03-03 09:53:44 -08:00
Todd Turnidge 45ec466ce5 Make getSourceReport public.
BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1753903003 .
2016-03-02 10:26:27 -08:00