Commit Graph

585 Commits

Author SHA1 Message Date
Todd Turnidge 0d501ad53d VM restart + shutdown fixes
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 .
2015-10-06 11:27:26 -07:00
Srdjan Mitrovic 8c7a94e9f4 Preparation for moving reusable handles to thread and more cleanups: isolate -> thread based handle allocation.
BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org/1384403002 .
2015-10-06 10:17:12 -07:00
Ryan Macnak d7b46bf5c1 Don't use a special var descriptor for :async_op since it can now be either stack or context allocated.
BUG=http://dartbug.com/24439
R=regis@google.com

Review URL: https://codereview.chromium.org//1361423004 .
2015-09-25 13:47:41 -07:00
Todd Turnidge c553cd065a Distinguish internal kill messages from user-initiated kill messages.
BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1361213003 .
2015-09-24 10:22:05 -07:00
Todd Turnidge 66f9abc7e3 Refactor isolate interrupts to use OOB messages instead of interrupt bits.
Closes #24349

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1344993002 .
2015-09-23 12:13:25 -07:00
Florian Schneider bac82e2592 VM: New calling convention for generated code.
Instead of calling code object directly, call indirectly and
pass the code object in a register. The object pool is then loaded from
the code object. This is another preparation step for making generated code
relocatable.

All non-ia32 platforms:
No entry patching.

ARM:
PC marker (now code object) moves to the same place as on x64 (below saved PP, above saved FP).
R9 is now used as PP, R10 as CODE_REG.

BUG=
R=koda@google.com, rmacnak@google.com

Committed: https://github.com/dart-lang/sdk/commit/1d343e5a7b75168fb6c9f86b64c55173cdbdc9b2

Review URL: https://codereview.chromium.org//1192103004 .
2015-09-19 13:21:09 +02:00
Florian Schneider 7af7a2db87 Revert "VM: New calling convention for generated code."
This reverts commit 1d343e5a7b.

Because of Windows test failures.

BUG=
TBR=whesse@google.com

Review URL: https://codereview.chromium.org//1343373003 .
2015-09-16 13:46:05 +02:00
Florian Schneider 1d343e5a7b VM: New calling convention for generated code.
Instead of calling code object directly, call indirectly and
pass the code object in a register. The object pool is then loaded from
the code object. This is another preparation step for making generated code
relocatable.

All non-ia32 platforms:
No entry patching.

ARM:
PC marker (now code object) moves to the same place as on x64 (below saved PP, above saved FP).
R9 is now used as PP, R10 as CODE_REG.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1192103004 .
2015-09-16 13:05:58 +02:00
Matthias Hausner 7720e0bed7 Set empty LocalVarDescriptors on execute-once functions
Fixes VM crash when debugger stops while execute-once functions
are on the stack, e.g. when evaluating initializer expressions
of compile-time constants.

BUG=24323
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1336363003 .
2015-09-14 16:26:04 -07:00
Zachary Anderson 16393ee9c6 Uses SNPRINT macro where possible. Otherwise uses #define for format.
I was able to convert 49 SNPrint(NULL, 0, ...) patterns to use the
macro. I had to use a #define for the format string 5 times due to
uses that didn't fit the macro.

2 occurences of SNPrint(NULL, 0, ...) had >=2 possibilities for the
format string based on runtime values, and I didn't try to convert
them.

Fixed ~10 format strings.

BUG=
R=iposva@google.com

Review URL: https://codereview.chromium.org//1331623002 .
2015-09-11 00:18:14 -07:00
Todd Turnidge dee6ddf966 Support column-based breakpoints in the VM and Observatory.
BUG=
R=hausner@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org//1312763010 .
2015-09-09 09:01:13 -07:00
Siva Annamalai 79ef28317f Changes to prepare for allowing script snapshots to be taken after running the main application:
- Rename accessors of class Field to make it more apparent as to what is being accessed (static field values or instance field offsets
- Use precompiled initializer state (Used only during precompilation) to also store saved initial value of static fields (Used only during application snapshot   generation)

BUG=
R=hausner@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org//1289643005 .
2015-09-04 11:03:46 -07:00
John McCutchan d0882dd363 Remember when an isolate was paused and subtly display it in Obseravatory
- Display paused time as tooltip over "paused" word.
- Send a timestamp with every ServiceEvent.
- Unit tests verifying that paused on start, exit, and breakpoint timestamps are stable.
- Remember the pause time in DebuggerEvent.
- Remember the pause time in MessageHandler.
- Updated service protocol documentation.

R=turnidge@google.com

Review URL: https://codereview.chromium.org//1311503004 .
2015-08-26 10:57:59 -07:00
Ryan Macnak 07b6dad1f5 Automagically change the meaning of 'next' to 'async-next' when paused at an async function at await/yield.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1299083002 .
2015-08-18 15:36:13 -07:00
Todd Turnidge 256b044857 Allow stepping when paused at isolate start.
Fix tests.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1285643004 .
2015-08-10 14:26:01 -07:00
Todd Turnidge 64216a8cd0 Revert "Allow stepping when paused at isolate start."
This reverts commit 319214f58b.

BUG=

Review URL: https://codereview.chromium.org//1286493003 .
2015-08-10 10:29:31 -07:00
Todd Turnidge 319214f58b Allow stepping when paused at isolate start.
BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1276243004 .
2015-08-10 09:52:55 -07:00
Ryan Macnak 0979a7b23e Async-step, first cut.
Also fix inclusion of internal variables from outer scopes in var descriptors.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1241673003 .
2015-07-16 13:05:37 -07:00
Todd Turnidge e4684c7627 Provide stdout and stderr output in the Observatory debugger.
Implement two new streams, 'Stdout' and 'Stderr' in the service protocol.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1232193003 .
2015-07-14 12:54:07 -07:00
Daniel Andersson c089a152ac Migrate most uses of Isolate::current_zone to Thread::zone.
After https://codereview.chromium.org/1204303003/ is submitted, the last remaining uses can go.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1220193009 .
2015-07-08 09:59:32 -07:00
Ryan Macnak 723334d344 UI for setting/clearing closure-specific breakpoints.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1191133002.
2015-06-18 14:01:19 -07:00
Zachary Anderson fcd4c59430 Fixes crashes in VM isolate shutdown.
If null is not initialized before the VM Isolate's ObjectStore, the
ObjectStore's fields are initialized to kHeapObjectTag, which causes
a crash in VM Isolate shutdown.

There is also a crash when the VM Isolate is signaled with the
shutdown event, so this CL removes adding a Debugger to the
VM Isolate, so that there is no need to shut it down, and send
the signal.

NB: This change does *not* actually enable shutdown. It just fixes
crashes that would happen if it were enabled.

BUG=
R=iposva@google.com, johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1168933002.
2015-06-17 10:14:18 -07:00
Ryan Macnak 392a83221f Allow setting break-on-exceptions option over the service protocol. Add command to Observatory's debugger.
Decide whether to cache service objects based on the fixedId property.

Be more tolerant of eval scripts and functions.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1174313002.
2015-06-15 12:05:23 -07:00
Todd Turnidge 996f012707 2nd attempt at adding streamListen/streamCancel to the service protocol.
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
2015-06-04 09:57:22 -07:00
Todd Turnidge 6c2ebfcc60 Switch to using SourceLocation universally in service protocol.
Add <location-link> and <location-inset> to provide links and insets
for a location.

Make Frame, Message, and SourceLocation first class in service lib.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1150303004
2015-06-03 09:02:40 -07:00
Srdjan Mitrovic ed73a3d151 With --noopt run unoptimized code through optimizer, more optimizations can be done later.
BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org//1149713002
2015-05-28 10:05:46 -07:00
Florian Schneider e0621416f8 Remove unused pc descriptor types.
kClosureCall and kOptStaticCall are not needed anymore.
Closure calls are implemented as instance calls - the ClosureCall instruction
 only occurs in the synthetic FunctionImpl.call dispatcher - and does not correspond
to a source location where breakpoints can be set.

kOptStaticCall is not needed because breakpoints can only be set in unoptimized
code. kOther is used instead.

This also removes an unused PC descriptor at closure calls from unoptimized
code.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org//1160063002
2015-05-28 14:27:37 +02:00
Ryan Macnak 13592ca9b7 Fix use-after-free deleting from linked list.
TBR=koda@google.com

Review URL: https://codereview.chromium.org//1151263004
2015-05-27 13:22:05 -07:00
Ryan Macnak 74dfae69e3 Reapply "Per-closure breakpoints; restructure breakpoint implementation to keep a list of conditions."
Fix copying breakpoints over to a new location when a latent location is resolved.

Fix bad assumption that BreakpointLocationAtLine always returns non-null result.

Review URL: https://codereview.chromium.org//1149983003
2015-05-27 09:59:33 -07:00
John McCutchan b7534facef Include 'fixedId' key when printing service ids
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1157173005
2015-05-26 16:56:31 -07:00
Todd Turnidge 8d24372339 Revert "Add the streamListen and streamCancel rpcs to the vm service."
This reverts commit 0967b63073.

Conflicts:
	runtime/observatory/tests/service/graph_test.dart
	runtime/vm/service.cc

BUG=

Review URL: https://codereview.chromium.org//1152283005
2015-05-26 15:22:39 -07:00
Todd Turnidge 0967b63073 Add the streamListen and streamCancel rpcs to the vm service.
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
2015-05-26 13:52:35 -07:00
Ryan Macnak e674f0dc62 Revert "Per-closure breakpoints; restructure breakpoint implementation to keep a list of conditions."
This reverts commit d37149ad3b.

Review URL: https://codereview.chromium.org//1145053004
2015-05-21 17:20:57 -07:00
Ryan Macnak d37149ad3b Per-closure breakpoints; restructure breakpoint implementation to keep a list of conditions.
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1146173003
2015-05-21 16:52:08 -07:00
John McCutchan 5401622c8a Ensure that the ThreadInterrupter is awake after debugging
When possible the ThreadInterrupter enters a deep sleep mode (to conserve CPU usage). We wake the ThreadInterrupter up whenever we schedule an isolate on a thread, but, two edges cases that were not covered:

* After explicitly starting an isolate that was paused with --pause-isolates-on-start the thread interrupter may not wake up.

* After continuing an isolate that was being single stepped.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1142283003
2015-05-20 06:49:35 -07:00
John McCutchan 51d8bae199 Revert "Hide Isolate pointer from embedder"
This reverts commit 014e694ba7.

Revert "Fix fall out from hide isolate pointer change"

This reverts commit 966aafbc81.

Revert "Fix build"

This reverts commit d7b03ba7b0.

BUG=

Review URL: https://codereview.chromium.org//1140263005
2015-05-19 11:41:42 -07:00
Matthias Hausner 92534a1f35 Fix debugger
Make sure we find async closures when looking to resolve
pending breakpoints.

R=asiva@google.com

Review URL: https://codereview.chromium.org//1142883002
2015-05-18 16:40:44 -07:00
John McCutchan 014e694ba7 Hide Isolate pointer from embedder
BUG=
R=iposva@google.com

Review URL: https://codereview.chromium.org//1130753006
2015-05-18 14:06:10 -07:00
johnmccutchan@google.com 8c10ef0558 Show tooltip with local variable value in Observatory debugger
- Add LocalVariableAnnotation to script-inset
- Tweak shortName for a closure
- Teach Script how to find local variable locations (not perfect yet)
- Send tokenPos and endTokenPos for debugger local variables

Performance improvements:
- Reduced script-inset update/computeAnnotations calls from 5 to 1 for each stack frame that is opened

R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1126363005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45725 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-12 02:41:43 +00:00
johnmccutchan@google.com 1f851efdbb Rename 'dart:debugger' to 'dart:developer'
- Rename 'dart:debugger' to 'dart:developer'
- Make 'breakHere' and 'breakHereIf' top level functions.

R=iposva@google.com

Review URL: https://codereview.chromium.org//1132113002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45658 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 21:24:57 +00:00
srdjan@google.com 3744661bc4 Lazily generate local var descriptors.
R=hausner@google.com

Review URL: https://codereview.chromium.org//1128803002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45581 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-07 04:16:50 +00:00
johnmccutchan@google.com a19cd071e5 Add 'dart:debugger' library
- Add the 'dart:debugger' library.
- Add the 'Debugger' class.
- Add explicit Dart breakpoint triggered by a call to: Debugger.breakHere();
- Add Debugger.breakHereIf(bool expr)

R=hausner@google.com, turnidge@google.com

Review URL: https://codereview.chromium.org//1116263004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45529 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-05 17:05:37 +00:00
hausner@google.com a4e1e8d61d Do not swallow compilation errors when setting breakpoint
Fixes 23352

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1127653003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45510 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-04 21:03:48 +00:00
turnidge@google.com b18024efb1 Add the --steal-breakpoints flag.
Add a test.

Update debugging_test.dart to not use line number instead of token pos to make it modestly less fragile.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1113243002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45470 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-01 17:56:35 +00:00
iposva@google.com a1854d45ac Fix http://dartbug.com/23290
- Ensure that we do have unoptimized code available when generating
  coverage information.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1107663002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45419 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-24 23:31:15 +00:00
johnmccutchan@google.com 583f48a132 Add crash dumps to service protocol and Observatory
- Add _getCrashDump RPC
- crash dump service response is map of request uris to responses, includes:
  -- getVM
  -- getFlagList
  -- for each isolate:
      -- getIsolate
      -- _getAllocationProfile
      -- getStack
- Add FakeVM to service library
- Add load crash dump to Observatory connect page
- Removes old chromium target support from connect page
- Make debugger page display stack even if libraries can't be loaded
- Fix reload of vm-connect page
- Fix polymer initialization calls

R=turnidge@google.com

Review URL: https://codereview.chromium.org//1100583006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45390 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-24 00:08:07 +00:00
johnmccutchan@google.com 52022c23fd Do not register service isolate descendants for debugging
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1096173005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45304 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-21 01:10:54 +00:00
fschneider@google.com 1fa1c69019 Remove redundant variable descriptors from optimized code.
The unoptimized code already contains a copy of these, so
we don't need to store them in two places.

R=hausner@google.com

Review URL: https://codereview.chromium.org//1077793003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45228 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-17 09:11:38 +00:00
turnidge@google.com 0edd5aae1e Some cleanups in the code that posts results to service clients.
- Remove the notion of event families and masks.  This wasn't really used.

- Change "response" to "result" in our response map to be more json-rpc-like.

- Pass events to the service isolate as Strings.

- Add more type declarations around raw data (Uint8List) responses.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1077823003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45034 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-09 21:08:38 +00:00
hausner@google.com 9613ed6300 Let debugger find async function literals
This is a fix for issue 22030.

When looking for known functions, consider even non-debuggable
functions, so that we don’t set the breakpoint too eagerly
in the outer function.

R=iposva@google.com

Review URL: https://codereview.chromium.org//1049863002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44829 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-01 00:18:11 +00:00