For example, running this sample, pausing the isolate, and stepping
would crash, whereas we would expect to pause in the ServerSocket.listen
callback.
```
import 'dart:io';
main() {
ServerSocket.bind('127.0.0.1', 22000).then((s) {
s.listen((m) { // Should pause here on socket connection after step.
print(m);
});
});
}
```
Fixes#35601.
Change-Id: I2155de1cface159f92734d3112b6e17c35ab7550
Reviewed-on: https://dart-review.googlesource.com/c/89780
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
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>
This reverts commit e76ea5b604.
1. Remove unused dart debugger API entrypoints which are not used anymore
as this API has been deprecated and dartium was the last user.
2. Some unit tests are using some of these API entrypoints, so moved them
over to a test file which will be linked into run_vm_tests
Change-Id: I5a486b98e4b97eb4df2e58d9cc0ba603e96c2e32
Reviewed-on: https://dart-review.googlesource.com/11180
Reviewed-by: Siva Annamalai <asiva@google.com>
as this API has been deprecated and dartium was the last user.
2. Some unit tests are using some of these API entrypoints, so moved them
over to a test file which will be linked into run_vm_tests
Change-Id: I3343b23d082400da3c803cf81ea80dfaa5e426cf
Reviewed-on: https://dart-review.googlesource.com/7942
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
This CL includes db26c89347 (patch set #1)
with fix (patch set #2):
* Include simulator.h explicitly where it is required as it is no
longer included implicitly through other header files.
Original review: https://codereview.chromium.org/2995803002/
When running on the simulator for arm/arm64, compare-and-swap operations
used in VM were synchronized with simulator using mutex.
It heavily impacts performance when doing parallel marking due to high
contention (see #30317).
This synchronization was implemented in order to make simulated
LDREX/STREX instructions aware of CAS performed in VM.
This CL drops this synchronization between VM and simulator:
CAS operations in VM become regular, and simulator remembers value loaded
with load-exclusive and performs CAS when doing store-exclusive to catch
any concurrent modifications.
Speeds up gen_snapshot of flutter benchmark complex_layout from 9.2s
to 8.0s on my MacBook.
R=asiva@google.com
Review-Url: https://codereview.chromium.org/2999853002 .
- Add deopt ids to DebugStepInstr and StrictCompareInstr since the debugger can stop there.
- Add missing pc descriptor in DBC's StringInterpolateInstr.
Re-enable async_debugger, which had been crashing flakily from context mismatches.
R=vegorov@google.com
Review-Url: https://codereview.chromium.org/2903993002 .
Related to #29145.
Fixes#29199.
1. Missing source positions in async and async* functions (synthetic code)
2. Added unit tests for issues #28980 and added asyns stack trace testing flags to existing test.
3. Handle uninitialized Completer object when collecting async stack traces.
Still missing is the correct calculation of context levels in ActivationFrame::ContextLevel. This is planned for a separate CL.
R=johnmccutchan@google.com
Review-Url: https://codereview.chromium.org/2786503003 .
- [x] Include the (non-empty) awaiter stack trace in every `getStack` RPC.
- [x] Append the causal stack trace to the final frame of the awaiter stack trace.
- [x] Unit test for awaiter stack trace.
BUG=
R=rmacnak@google.com
Review-Url: https://codereview.chromium.org/2782703002 .
Original CL: https://codereview.chromium.org/2692803006/
Original commit message:
Tracking the awaiter return call stack:
- [x] Each async function closure now knows who is awaiting on their
return. This is effectively the asynchronous equivalent of the 'frame pointer'.
- [x] Each async* function closure now knows how is listening on their
stream. This is effectively the asynchronous equivalent of the 'frame pointer'.
Detecting uncaught exceptions in async functions:
- [x] Code object keeps a map from :await_jump_var to token position
- [x] Exception Handlers keep track if they are generated (as part of compilation) or directly from user code
- [x] Debugger maps :await_jump_var to a specific try index
R=johnmccutchan@google.com
Review-Url: https://codereview.chromium.org/2725623003 .
Tracking the awaiter return call stack:
- [x] Each async function closure now knows who is awaiting on their
return. This is effectively the asynchronous equivalent of the 'frame pointer'.
- [x] Each async* function closure now knows how is listening on their
stream. This is effectively the asynchronous equivalent of the 'frame pointer'.
Detecting uncaught exceptions in async functions:
- [x] Code object keeps a map from :await_jump_var to token position
- [x] Exception Handlers keep track if they are generated (as part of compilation) or directly from user code
- [x] Debugger maps :await_jump_var to a specific try index
Fixes#27242R=rmacnak@google.com
Review-Url: https://codereview.chromium.org/2692803006 .
UX improvements:
- [x] Stop printing the suffix <%s_async_body> and <%s_async_gen_body> for the generated closures.
Fixes#28743
- [x] Don't include the duplicate frame below the asynchronous suspension marker.
Fixes#28742
Bug fixes:
- [x] Fix service protocol enum naming so that it is consistent with other enums.
Fixes#28726
Misc:
- [x] Stop using package:stack_trace now that the VM does it for us.
BUG=
R=asiva@google.com, devoncarew@google.com, rmacnak@google.com
Review-Url: https://codereview.chromium.org/2690683002 .
Delete Breakpoint objects from the C heap when they are no longer needed.
Also delete inactive code breakpoint objects more aggressively.
This should fix the memory leaks reported in #28348.
General cleanup of breakpoint handling code and comments.
BUG=#28348
R=rmacnak@google.com
Review-Url: https://codereview.chromium.org/2689623002 .
This CL improves the stack traces that accompany exceptions. Whenever an
async function is entered, we remember how we got there. This is similar
in spirit to package:stack_trace but the implementation is more efficient
and memory usage can be more easily reasoned about.
Tracking causal stack traces:
- [x] Upon entry to an async function, capture the synchronous stack trace prefix and store it into the closure.
- [x] Upon entry to an async* function, capture the synchronous stack trace prefix and store it into the closure.
- [x] Before returning from an async function, clear the Thread's asynchronous stack trace.
- [x] After resuming an async function, load the sychronous stack trace prefix into the Thread.
- [x] Filter stack traces to remove async machinery.
Service protocol changes:
- [x] Send causal async stack trace.
Observatory changes:
- [x] Display causal async stack trace below async functions.
Fixes https://github.com/dart-lang/sdk/issues/27661R=asiva@google.com, rmacnak@google.com
Comparisons: https://docs.google.com/a/google.com/document/d/10r6jEqr8OCiDZ4y9SYU_uOimcHiOGAZMly2ghTErALI/edit?usp=sharing
Review-Url: https://codereview.chromium.org/2646443005 .
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] Add three public fields to the "BoundVariable" service type: declarationTokenPos, visibleStartTokenPos, and visibleEndTokenPos. (naming suggestions welcome!)
- [x] Extend LocalVarDescriptors to hold the declaration token position (it already had the scope visibility boundaries).
- [x] Extend ContextScope to hold the declaration token position.
- [x] Add a unit test which verifies this works for local variables, function parameters, and closure captured variables.
Fixes https://github.com/dart-lang/sdk/issues/25569
BUG=
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/2419013004 .
- [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 .
When setting a breakpoint at a fast Smi op, replace the fast Smi op instruction with a Nop so we don't skip the following DebugBreak in the Smi case and don't attempt to increment an ICData counter through pool slot 0.
R=zra@google.com
Review URL: https://codereview.chromium.org/2194493002 .
Additions to service protocol:
- PauseEvent includes an "atAsyncContinuation" boolean value.
- Resume command can take an 'OverAsyncContinuation' step mode.
- Breakpoints have an optional 'isSyntheticAsyncContinuation' boolean value.
Added low level step_over_await_test.
Issuing the OverAsyncContinuation resume command does the following:
- Adds a synthetic breakpoint (#1) to the async closure.
- Resumes the isolate.
- When we hit #1, the VM issues a StepOver and then reports us paused at #1.
At the next resume command, the VM will remove #1.
R=rmacnak@google.com
Review URL: https://codereview.chromium.org/1699153002 .