@@ -15,7 +15,6 @@ import 'package:path/path.dart' as path;
1515import 'package:vm_service/vm_service.dart' as vm;
1616
1717import '../../../dds.dart' ;
18- import '../../../dds_launcher.dart' ;
1918import '../../rpc_error_codes.dart' ;
2019import '../base_debug_adapter.dart' ;
2120import '../isolate_manager.dart' ;
@@ -354,12 +353,6 @@ abstract class DartDebugAdapter<TL extends LaunchRequestArguments,
354353 /// value should contain trailing slashes.
355354 final orgDartlangSdkMappings = < String , Uri > {};
356355
357- /// The DDS instance that was started and that [vmService] is connected to.
358- ///
359- /// `null` if the session is running in noDebug mode of the connection has not
360- /// yet been made or has been shut down.
361- DartDevelopmentServiceLauncher ? _dds;
362-
363356 /// The [DartInitializeRequestArguments] provided by the client in the
364357 /// `initialize` request.
365358 ///
@@ -369,12 +362,6 @@ abstract class DartDebugAdapter<TL extends LaunchRequestArguments,
369362 /// Whether to use IPv6 for DAP/Debugger services.
370363 final bool ipv6;
371364
372- /// Whether to enable DDS for launched applications.
373- final bool enableDds;
374-
375- /// Whether to enable authentication codes for the VM Service/DDS.
376- final bool enableAuthCodes;
377-
378365 /// A logger for printing diagnostic information.
379366 final Logger ? logger;
380367
@@ -491,8 +478,10 @@ abstract class DartDebugAdapter<TL extends LaunchRequestArguments,
491478 DartDebugAdapter (
492479 ByteStreamServerChannel channel, {
493480 this .ipv6 = false ,
494- this .enableDds = true ,
495- this .enableAuthCodes = true ,
481+ @Deprecated ('DAP never spawns DDS now, this `enableDds` does nothing' )
482+ bool enableDds = true ,
483+ @Deprecated ('DAP never spawns DDS now, this `enableAuthCodes` does nothing' )
484+ bool enableAuthCodes = true ,
496485 this .logger,
497486 Function ? onError,
498487 }) : super (channel, onError: onError) {
@@ -649,59 +638,12 @@ abstract class DartDebugAdapter<TL extends LaunchRequestArguments,
649638 }
650639 }
651640
652- /// Attempts to start a DDS instance to connect to the VM Service at [uri] .
653- ///
654- /// Returns the URI to connect the debugger to (whether it's a newly spawned
655- /// DDS or there was an existing one).
656- ///
657- /// If we failed to start DDS for a reason other than one already existed for
658- /// that VM Service we will return `null` and initiate a shutdown with the
659- /// exception printed to the user.
660- ///
661- /// If a new DDS instance was started, it is assigned to [_dds] .
662- Future <Uri ?> _startOrReuseDds (Uri uri) async {
663- try {
664- final dds = await startDds (uri);
665- _dds = dds;
666- return dds.wsUri;
667- } catch (error, stack) {
668- if (error is DartDevelopmentServiceException &&
669- error.errorCode ==
670- DartDevelopmentServiceException .existingDdsInstanceError) {
671- // If there's an existing DDS instance, we will just continue
672- // but need to map the URI to the ws: version.
673- return vmServiceUriToWebSocket (uri);
674- } else {
675- // Otherwise, we failed to start DDS for an unknown reason and
676- // consider this a fatal error. Handle terminating here (so we can
677- // print this error/stack)...
678- _handleDebuggerInitializationError (
679- 'Failed to start DDS for $uri ' , error, stack);
680- // ... and return no URI as a signal to the caller.
681- return null ;
682- }
683- }
684- }
685-
686641 /// Connects to the VM Service at [uri] and initializes debugging.
687642 ///
688643 /// This is the implementation for [connectDebugger] which is executed in a
689644 /// try/catch.
690645 Future <void > _connectDebuggerImpl (Uri uri) async {
691- if (enableDds) {
692- // Start up a DDS instance for this VM.
693- logger? .call ('Starting a DDS instance for $uri ' );
694- final targetUri = await _startOrReuseDds (uri);
695- if (targetUri == null ) {
696- // If we got no URI, this is a fatal error and we can skip everything
697- // else. The detailed error would have been printed from
698- // [_startOrReuseDds].
699- return ;
700- }
701- uri = targetUri;
702- } else {
703- uri = vmServiceUriToWebSocket (uri);
704- }
646+ uri = vmServiceUriToWebSocket (uri);
705647
706648 logger? .call ('Connecting to debugger at $uri ' );
707649 sendConsoleOutput ('Connecting to VM Service at $uri ' );
@@ -771,31 +713,6 @@ abstract class DartDebugAdapter<TL extends LaunchRequestArguments,
771713 _debuggerInitializedCompleter.complete ();
772714 }
773715
774- /// Handlers an error during debugger initialization (such as exceptions
775- /// trying to call `getSupportedProtocols` or `getVM` ) by sending it to the
776- /// client and shutting down.
777- ///
778- /// Without this, the exceptions may go unhandled and just terminate the debug
779- /// adapter, which may not be visible to the user. For example VS Code does
780- /// not expose stderr of a debug adapter process. With this change, the
781- /// exception will show up in the Debug Console before the debug session
782- /// terminates.
783- void _handleDebuggerInitializationError (
784- String reason, Object ? error, StackTrace stack) {
785- final message = '$reason \n $error \n $stack ' ;
786- logger? .call (message);
787- isTerminating = true ;
788- sendConsoleOutput (message);
789- shutdown ();
790- }
791-
792- Future <DartDevelopmentServiceLauncher > startDds (Uri uri) {
793- return DartDevelopmentServiceLauncher .start (
794- remoteVmServiceUri: vmServiceUriToHttp (uri),
795- enableAuthCodes: enableAuthCodes,
796- );
797- }
798-
799716 // This is intended for subclasses to override to provide a URI converter to
800717 // resolve package URIs to local paths.
801718 UriConverter ? uriConverter () {
@@ -1070,7 +987,6 @@ abstract class DartDebugAdapter<TL extends LaunchRequestArguments,
1070987 isTerminating = true ;
1071988
1072989 await disconnectImpl ();
1073- await shutdownDebugee ();
1074990 sendResponse ();
1075991
1076992 await shutdown ();
@@ -1688,25 +1604,11 @@ abstract class DartDebugAdapter<TL extends LaunchRequestArguments,
16881604 sendResponse (SetExceptionBreakpointsResponseBody ());
16891605 }
16901606
1691- /// Shuts down/detaches from the debugee and cleans up.
1692- ///
1693- /// This is called by [disconnectRequest] and [terminateRequest] but may also
1694- /// be called if the client just disconnects from the server without calling
1695- /// either.
1696- ///
1697- /// This method must tolerate being called multiple times.
1698- @nonVirtual
1699- Future <void > shutdownDebugee () async {
1700- await _dds? .shutdown ();
1701- _dds = null ;
1702- }
1703-
17041607 /// Shuts down the debug adapter, including terminating/detaching from the
17051608 /// debugee if required.
17061609 @override
17071610 @nonVirtual
17081611 Future <void > shutdown () async {
1709- await shutdownDebugee ();
17101612 await _waitForPendingOutputEvents ();
17111613 handleSessionTerminate ();
17121614
@@ -2008,7 +1910,6 @@ abstract class DartDebugAdapter<TL extends LaunchRequestArguments,
20081910 isTerminating = true ;
20091911
20101912 await terminateImpl ();
2011- await shutdownDebugee ();
20121913 sendResponse ();
20131914
20141915 await shutdown ();
0 commit comments