@@ -690,17 +690,11 @@ private async Task<List<LaunchCommand>> GetInitializeCommands()
690690 LocalLaunchOptions localLaunchOptions = _launchOptions as LocalLaunchOptions ;
691691 if ( this . IsCoreDump )
692692 {
693- // Add executable information
694- this . AddExecutablePathCommand ( commands ) ;
693+ // Load executable and core dump
694+ this . AddExecutableAndCorePathCommand ( commands ) ;
695695
696- // Important: this must occur after file-exec-and-symbols but before anything else.
696+ // Important: this must occur after executable load but before anything else.
697697 this . AddGetTargetArchitectureCommand ( commands ) ;
698-
699- // Add core dump information (linux/mac does not support quotes around this path but spaces in the path do work)
700- string coreDump = this . UseUnixPathSeparators ? _launchOptions . CoreDumpPath : this . EnsureProperPathSeparators ( _launchOptions . CoreDumpPath , true ) ;
701- string coreDumpCommand = _launchOptions . DebuggerMIMode == MIMode . Lldb ? String . Concat ( "target create --core " , coreDump ) : String . Concat ( "-target-select core " , coreDump ) ;
702- string coreDumpDescription = String . Format ( CultureInfo . CurrentCulture , ResourceStrings . LoadingCoreDumpMessage , _launchOptions . CoreDumpPath ) ;
703- commands . Add ( new LaunchCommand ( coreDumpCommand , coreDumpDescription , ignoreFailures : false ) ) ;
704698 }
705699 else if ( _launchOptions . ProcessId . HasValue )
706700 {
@@ -918,6 +912,30 @@ private void AddExecutablePathCommand(IList<LaunchCommand> commands)
918912 commands . Add ( new LaunchCommand ( "-file-exec-and-symbols " + exe , description , ignoreFailures : false , failureHandler : failureHandler ) ) ;
919913 }
920914
915+ private void AddExecutableAndCorePathCommand ( IList < LaunchCommand > commands )
916+ {
917+ string command ;
918+ if ( _launchOptions . DebuggerMIMode == MIMode . Lldb )
919+ {
920+ // LLDB requires loading the executable and the core into the same target, using one command. Quotes in the path are supported.
921+ string exePath = this . EnsureProperPathSeparators ( _launchOptions . ExePath , true ) ;
922+ string corePath = this . EnsureProperPathSeparators ( _launchOptions . CoreDumpPath , true ) ;
923+ command = String . Concat ( "file " , exePath , " -c " , corePath ) ;
924+ }
925+ else
926+ {
927+ // GDB requires loading the executable and core separately.
928+ // Note: Linux/mac do not support quotes around this path, but spaces in the path do work.
929+ this . AddExecutablePathCommand ( commands ) ;
930+ string corePathNoQuotes = this . EnsureProperPathSeparators ( _launchOptions . CoreDumpPath , true , true ) ;
931+ command = String . Concat ( "-target-select core " , corePathNoQuotes ) ;
932+ }
933+
934+ // Load core dump information
935+ string description = String . Format ( CultureInfo . CurrentCulture , ResourceStrings . LoadingCoreDumpMessage , _launchOptions . CoreDumpPath ) ;
936+ commands . Add ( new LaunchCommand ( command , description , ignoreFailures : false ) ) ;
937+ }
938+
921939 private void DetermineAndAddExecutablePathCommand ( IList < LaunchCommand > commands , UnixShellPortLaunchOptions launchOptions )
922940 {
923941 // TODO: connecting to OSX via SSH doesn't work yet. Show error after connection manager dialog gets dismissed.
0 commit comments