public UnixShellPortLaunchOptions(string startRemoteDebuggerCommand, Microsoft.VisualStudio.Debugger.Interop.UnixPortSupplier.IDebugUnixShellPort unixPort, MIMode miMode, BaseLaunchOptions baseLaunchOptions, string getClrDbgUrl = null, string remoteDebuggerInstallationDirectory = null, string remoteDebuggerInstallationSubDirectory = null, string clrdbgVersion = null) { this.UnixPort = unixPort; this.DebuggerMIMode = miMode; if (!string.IsNullOrWhiteSpace(getClrDbgUrl)) { GetClrDbgUrl = getClrDbgUrl; } if (!string.IsNullOrWhiteSpace(remoteDebuggerInstallationDirectory)) { DebuggerInstallationDirectory = remoteDebuggerInstallationDirectory; } if (!string.IsNullOrWhiteSpace(remoteDebuggerInstallationSubDirectory)) { ClrDbgInstallationSubDirectory = remoteDebuggerInstallationSubDirectory; } if (!string.IsNullOrWhiteSpace(clrdbgVersion)) { ClrDbgVersion = clrdbgVersion; } if (string.IsNullOrEmpty(startRemoteDebuggerCommand)) { switch (miMode) { case MIMode.Gdb: startRemoteDebuggerCommand = "gdb --interpreter=mi"; break; case MIMode.Lldb: // TODO: Someday we should likely use a download script here too startRemoteDebuggerCommand = "lldb-mi --interpreter=mi"; break; case MIMode.Clrdbg: string debuggerHomeDirectory; if (DebuggerInstallationDirectory.StartsWith("/", StringComparison.OrdinalIgnoreCase)) { debuggerHomeDirectory = DebuggerInstallationDirectory; } else { string userHomeDirectory = UnixPort.GetUserHomeDirectory(); debuggerHomeDirectory = string.Format(CultureInfo.InvariantCulture, "{0}/{1}", userHomeDirectory, DebuggerInstallationDirectory); } if (!HasSuccessfulPreviousLaunch(this)) { startRemoteDebuggerCommand = string.Format(CultureInfo.InvariantCulture, ClrdbgFirstLaunchCommand, debuggerHomeDirectory, ClrDbgVersion, ClrDbgInstallationSubDirectory); } else { startRemoteDebuggerCommand = string.Format(CultureInfo.InvariantCulture, ClrdbgSubsequentLaunchCommand, debuggerHomeDirectory, ClrDbgVersion, ClrDbgInstallationSubDirectory); } break; default: throw new ArgumentOutOfRangeException("miMode"); } } this.StartRemoteDebuggerCommand = startRemoteDebuggerCommand; if (baseLaunchOptions != null) { this.InitializeCommonOptions(baseLaunchOptions); this.BaseOptions = baseLaunchOptions; } }
protected void InitializeCommonOptions(Xml.LaunchOptions.BaseLaunchOptions source) { if (this.ExePath == null) { string exePath = source.ExePath; if (!string.IsNullOrWhiteSpace(exePath)) { this.ExePath = exePath; } } if (this.TargetArchitecture == TargetArchitecture.Unknown) { this.TargetArchitecture = ConvertTargetArchitectureAttribute(source.TargetArchitecture); } Debug.Assert((uint)MIMode.Gdb == (uint)Xml.LaunchOptions.MIMode.gdb, "Enum values don't line up!"); Debug.Assert((uint)MIMode.Lldb == (uint)Xml.LaunchOptions.MIMode.lldb, "Enum values don't line up!"); Debug.Assert((uint)MIMode.Clrdbg == (uint)Xml.LaunchOptions.MIMode.clrdbg, "Enum values don't line up!"); this.DebuggerMIMode = (MIMode)source.MIMode; if (string.IsNullOrEmpty(this.ExeArguments)) { this.ExeArguments = source.ExeArguments; } if (string.IsNullOrEmpty(this.WorkingDirectory)) { this.WorkingDirectory = source.WorkingDirectory; } if (string.IsNullOrEmpty(this.VisualizerFile)) { this.VisualizerFile = source.VisualizerFile; } this.SetupCommands = LaunchCommand.CreateCollectionFromXml(source.SetupCommands); if (source.CustomLaunchSetupCommands != null) { this.CustomLaunchSetupCommands = LaunchCommand.CreateCollectionFromXml(source.CustomLaunchSetupCommands); } Debug.Assert((uint)LaunchCompleteCommand.ExecRun == (uint)Xml.LaunchOptions.BaseLaunchOptionsLaunchCompleteCommand.execrun); Debug.Assert((uint)LaunchCompleteCommand.ExecContinue == (uint)Xml.LaunchOptions.BaseLaunchOptionsLaunchCompleteCommand.execcontinue); Debug.Assert((uint)LaunchCompleteCommand.None == (uint)Xml.LaunchOptions.BaseLaunchOptionsLaunchCompleteCommand.None); this.LaunchCompleteCommand = (LaunchCompleteCommand)source.LaunchCompleteCommand; string additionalSOLibSearchPath = source.AdditionalSOLibSearchPath; if (!string.IsNullOrEmpty(additionalSOLibSearchPath)) { if (string.IsNullOrEmpty(this.AdditionalSOLibSearchPath)) { this.AdditionalSOLibSearchPath = additionalSOLibSearchPath; } else { this.AdditionalSOLibSearchPath = string.Concat(this.AdditionalSOLibSearchPath, ";", additionalSOLibSearchPath); } } }
protected void InitializeCommonOptions(Xml.LaunchOptions.BaseLaunchOptions source) { if (this.ExePath == null) { string exePath = source.ExePath; if (!string.IsNullOrWhiteSpace(exePath)) { this.ExePath = exePath; } } if (this.TargetArchitecture == TargetArchitecture.Unknown && source.TargetArchitectureSpecified) { this.TargetArchitecture = ConvertTargetArchitectureAttribute(source.TargetArchitecture); } Debug.Assert((uint)MIMode.Gdb == (uint)Xml.LaunchOptions.MIMode.gdb, "Enum values don't line up!"); Debug.Assert((uint)MIMode.Lldb == (uint)Xml.LaunchOptions.MIMode.lldb, "Enum values don't line up!"); Debug.Assert((uint)MIMode.Clrdbg == (uint)Xml.LaunchOptions.MIMode.clrdbg, "Enum values don't line up!"); this.DebuggerMIMode = (MIMode)source.MIMode; if (string.IsNullOrEmpty(this.ExeArguments)) { this.ExeArguments = source.ExeArguments; } if (string.IsNullOrEmpty(this.WorkingDirectory)) { this.WorkingDirectory = source.WorkingDirectory; } if (string.IsNullOrEmpty(this.VisualizerFile)) { this.VisualizerFile = source.VisualizerFile; } this.ShowDisplayString = source.ShowDisplayString; this.WaitDynamicLibLoad = source.WaitDynamicLibLoad; this.SetupCommands = LaunchCommand.CreateCollectionFromXml(source.SetupCommands); if (source.CustomLaunchSetupCommands != null) { this.CustomLaunchSetupCommands = LaunchCommand.CreateCollectionFromXml(source.CustomLaunchSetupCommands); } Debug.Assert((uint)LaunchCompleteCommand.ExecRun == (uint)Xml.LaunchOptions.BaseLaunchOptionsLaunchCompleteCommand.execrun); Debug.Assert((uint)LaunchCompleteCommand.ExecContinue == (uint)Xml.LaunchOptions.BaseLaunchOptionsLaunchCompleteCommand.execcontinue); Debug.Assert((uint)LaunchCompleteCommand.None == (uint)Xml.LaunchOptions.BaseLaunchOptionsLaunchCompleteCommand.None); this.LaunchCompleteCommand = (LaunchCompleteCommand)source.LaunchCompleteCommand; string additionalSOLibSearchPath = source.AdditionalSOLibSearchPath; if (!string.IsNullOrEmpty(additionalSOLibSearchPath)) { if (string.IsNullOrEmpty(this.AdditionalSOLibSearchPath)) { this.AdditionalSOLibSearchPath = additionalSOLibSearchPath; } else { this.AdditionalSOLibSearchPath = string.Concat(this.AdditionalSOLibSearchPath, ";", additionalSOLibSearchPath); } } if (string.IsNullOrEmpty(this.AbsolutePrefixSOLibSearchPath)) { this.AbsolutePrefixSOLibSearchPath = source.AbsolutePrefixSOLibSearchPath; } if (source.DebugChildProcessesSpecified) { this.DebugChildProcesses = source.DebugChildProcesses; } this.ProcessId = source.ProcessId; this.CoreDumpPath = source.CoreDumpPath; // Ensure that CoreDumpPath and ProcessId are not specified at the same time if (!String.IsNullOrEmpty(source.CoreDumpPath) && source.ProcessIdSpecified) { throw new InvalidLaunchOptionsException(String.Format(CultureInfo.InvariantCulture, MICoreResources.Error_CannotSpecifyBoth, nameof(source.CoreDumpPath), nameof(source.ProcessId))); } }