Skip to content

Commit 9c18545

Browse files
derekxu16Commit Queue
authored andcommitted
[VM/Service] Fix the behaviour of the pause parameter of ReloadSources
The changes to `pkg/vm_service/test/reload_sources_test.dart` in this CL make it fail if running on a VM that does not also include the changes to `runtime/vm/service.cc` in this CL. This happens because: 1) `pause_post_service_request` gets carried over from the RPC on line 44 of `pkg/vm_service/test/reload_sources_test.dart`, and the isolate will actually pause after the `getIsolate` RPC within the `isolateIsRunning` test on line 51 2) `pause_post_service_request` gets carried over from the RPC on line 54, and the isolate will actually pause after the `getIsolate` RPC within the `isolateIsRunning` test on line 60 3) `isolateIsRunning` on line 64 will fail TEST=pkg/vm_service/test/reload_sources_test.dart Change-Id: Id6486c485b1e22599cb920c0874aac0c1aa731c9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397020 Commit-Queue: Derek Xu <[email protected]> Reviewed-by: Ben Konyi <[email protected]>
1 parent 3ffde1e commit 9c18545

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

pkg/vm_service/test/reload_sources_test.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,11 @@ final tests = <IsolateTest>[
4444
reloadSources(pause: true),
4545
// Ensure that we are still stopped at a breakpoint.
4646
hasStoppedAtBreakpoint,
47+
stoppedAtLine(LINE_A),
4748
// Resume the isolate into the while loop.
4849
resumeIsolate,
50+
// Verify that it is running.
51+
isolateIsRunning,
4952
// Reload sources and request to pause post reload. The pause request will
5053
// be respected because we are not already paused.
5154
reloadSources(pause: true),

runtime/vm/service.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4002,10 +4002,15 @@ void Service::CheckForPause(Isolate* isolate, JSONStream* stream) {
40024002
}
40034003

40044004
ErrorPtr Service::MaybePause(Isolate* isolate, const Error& error) {
4005+
const bool should_pause_post_current_service_request =
4006+
isolate->should_pause_post_service_request();
4007+
if (should_pause_post_current_service_request) {
4008+
// Ensure that we do not accidentally pause post the next service request.
4009+
isolate->set_should_pause_post_service_request(false);
4010+
}
40054011
// Don't pause twice.
40064012
if (!isolate->IsPaused()) {
4007-
if (isolate->should_pause_post_service_request()) {
4008-
isolate->set_should_pause_post_service_request(false);
4013+
if (should_pause_post_current_service_request) {
40094014
if (!error.IsNull()) {
40104015
// Before pausing, restore the sticky error. The debugger will return it
40114016
// from PausePostRequest.

0 commit comments

Comments
 (0)