Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
675b9615
Unverified
Commit
675b9615
authored
3 years ago
by
Danny Tuppeny
Committed by
GitHub
3 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unpause and remove breakpoints when detaching from Flutter process with DAP (#101695)
parent
b0864737
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
6 deletions
+40
-6
flutter_adapter.dart
...flutter_tools/lib/src/debug_adapters/flutter_adapter.dart
+6
-0
flutter_adapter_test.dart
...integration.shard/debug_adapter/flutter_adapter_test.dart
+26
-4
test_support.dart
...ls/test/integration.shard/debug_adapter/test_support.dart
+8
-2
No files found.
packages/flutter_tools/lib/src/debug_adapters/flutter_adapter.dart
View file @
675b9615
...
...
@@ -205,6 +205,9 @@ class FlutterDebugAdapter extends DartDebugAdapter<FlutterLaunchRequestArguments
/// quickly and therefore may leave orphaned processes.
@override
Future
<
void
>
disconnectImpl
()
async
{
if
(
isAttach
)
{
await
preventBreakingAndResume
();
}
terminatePids
(
ProcessSignal
.
sigkill
);
}
...
...
@@ -379,6 +382,9 @@ class FlutterDebugAdapter extends DartDebugAdapter<FlutterLaunchRequestArguments
/// Called by [terminateRequest] to request that we gracefully shut down the app being run (or in the case of an attach, disconnect).
@override
Future
<
void
>
terminateImpl
()
async
{
if
(
isAttach
)
{
await
preventBreakingAndResume
();
}
terminatePids
(
ProcessSignal
.
sigterm
);
await
_process
?.
exitCode
;
}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/integration.shard/debug_adapter/flutter_adapter_test.dart
View file @
675b9615
...
...
@@ -380,13 +380,35 @@ void main() {
stoppedFuture
,
dap
.
client
.
setBreakpoint
(
breakpointFilePath
,
breakpointLine
),
],
eagerError:
true
);
final
int
threadId
=
(
await
stoppedFuture
).
threadId
!;
});
testWithoutContext
(
'resumes and removes breakpoints on detach'
,
()
async
{
final
Uri
vmServiceUri
=
await
testProcess
.
vmServiceUri
;
// Launch the app and wait for it to print "topLevelFunction".
await
Future
.
wait
(<
Future
<
void
>>[
dap
.
client
.
stdoutOutput
.
firstWhere
((
String
output
)
=>
output
.
startsWith
(
'topLevelFunction'
)),
dap
.
client
.
start
(
launch:
()
=>
dap
.
client
.
attach
(
cwd:
project
.
dir
.
path
,
toolArgs:
<
String
>[
'-d'
,
'flutter-tester'
],
vmServiceUri:
vmServiceUri
.
toString
(),
),
),
],
eagerError:
true
);
// Remove the breakpoint and resume.
await
dap
.
client
.
clearBreakpoints
(
breakpointFilePath
);
await
dap
.
client
.
continue_
(
threadId
);
// Set a breakpoint and expect to hit it.
final
Future
<
StoppedEventBody
>
stoppedFuture
=
dap
.
client
.
stoppedEvents
.
firstWhere
((
StoppedEventBody
e
)
=>
e
.
reason
==
'breakpoint'
);
await
Future
.
wait
(<
Future
<
void
>>[
stoppedFuture
,
dap
.
client
.
setBreakpoint
(
breakpointFilePath
,
breakpointLine
),
],
eagerError:
true
);
// Detach.
await
dap
.
client
.
terminate
();
// Ensure we get additional output (confirming the process resumed).
await
testProcess
.
output
.
first
;
});
});
}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/integration.shard/debug_adapter/test_support.dart
View file @
675b9615
...
...
@@ -63,6 +63,11 @@ class SimpleFlutterRunner {
unawaited
(
process
.
exitCode
.
then
(
_handleExitCode
));
}
final
StreamController
<
String
>
_output
=
StreamController
<
String
>.
broadcast
();
/// A broadcast stream of any non-JSON output from the process.
Stream
<
String
>
get
output
=>
_output
.
stream
;
void
_handleExitCode
(
int
code
)
{
if
(!
_vmServiceUriCompleter
.
isCompleted
)
{
_vmServiceUriCompleter
.
completeError
(
'Flutter process ended without producing a VM Service URI'
);
...
...
@@ -91,8 +96,9 @@ class SimpleFlutterRunner {
}
}
}
on
FormatException
{
// `flutter run` writes a lot of text to stdout so just ignore anything
// that's not valid JSON.
// `flutter run` writes a lot of text to stdout that isn't daemon messages
// (not valid JSON), so just pass that one for tests that may want it.
_output
.
add
(
outputLine
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment