Example #1
0
        public static ReadOnlyCollection <LaunchCommand> CreateCollection(Xml.LaunchOptions.Command[] source)
        {
            LaunchCommand[] commandArray = source?.Select(x => new LaunchCommand(x.Value, x.Description, x.IgnoreFailures)).ToArray();
            if (commandArray == null)
            {
                commandArray = new LaunchCommand[0];
            }

            return(new ReadOnlyCollection <LaunchCommand>(commandArray));
        }
Example #2
0
        public static ReadOnlyCollection<LaunchCommand> CreateCollectionFromXml(Xml.LaunchOptions.Command[] source)
        {
            LaunchCommand[] commandArray = source?.Select(x => new LaunchCommand(x.Value, x.Description, x.IgnoreFailures)).ToArray();
            if (commandArray == null)
            {
                commandArray = new LaunchCommand[0];
            }

            return new ReadOnlyCollection<LaunchCommand>(commandArray);
        }
Example #3
0
        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);
                }
            }
        }
Example #4
0
        private void CheckCygwin(List<LaunchCommand> commands, LocalLaunchOptions localLaunchOptions)
        {
            // If running locally on windows, determine if gdb is running from cygwin
            if (localLaunchOptions != null && PlatformUtilities.IsWindows() && this.MICommandFactory.Mode == MIMode.Gdb)
            {
                // mingw will not implement this command, but to be safe, also check if the results contains the string cygwin.
                LaunchCommand lc = new LaunchCommand("show configuration", null, true, null, new Action<string>((string resStr) =>
                {
                    if (resStr.Contains("cygwin"))
                    {
                        this.IsCygwin = true;
                        this.CygwinFilePathMapper = new CygwinFilePathMapper(this);

                        _engineTelemetry.SendWindowsRuntimeEnvironment(EngineTelemetry.WindowsRuntimeEnvironment.Cygwin);
                    }
                    else
                    {
                        // Gdb on windows and not cygwin implies mingw
                        _engineTelemetry.SendWindowsRuntimeEnvironment(EngineTelemetry.WindowsRuntimeEnvironment.MinGW);
                    }
                }));
                commands.Add(lc);
            }
        }
Example #5
0
        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)));
            }
        }