コード例 #1
0
ファイル: LaunchOptions.cs プロジェクト: lsgxeva/MIEngine
        static internal PipeLaunchOptions CreateFromXml(Xml.LaunchOptions.PipeLaunchOptions source)
        {
            var options = new PipeLaunchOptions(RequireAttribute(source.PipePath, "PipePath"), source.PipeArguments);
            options.InitializeCommonOptions(source);

            return options;
        }
コード例 #2
0
        private void SetWorkingDirectory(PipeLaunchOptions options, string path, string workingDir)
        {
            string rustInstallPath = env.GetRustInstallPath();

            if (String.IsNullOrWhiteSpace(workingDir))
            {
                options.WorkingDirectory = EscapePath(Path.GetDirectoryName(path));
                if (rustInstallPath != null)
                {
                    options.AdditionalSOLibSearchPath = rustInstallPath;
                }
            }
            else
            {
                options.WorkingDirectory = EscapePath(workingDir);
                // GDB won't search working directory by default, but this is expected on Windows.
                string additionalPath;
                if (rustInstallPath != null)
                {
                    additionalPath = rustInstallPath + ";" + workingDir;
                }
                else
                {
                    additionalPath = workingDir;
                }
                options.AdditionalSOLibSearchPath = additionalPath;
            }
        }
コード例 #3
0
        private PipeLaunchOptions BuildLaunchOptions(string path, string args, string workingDir)
        {
            // We could go through LocalLaunchOptions, but this way we can pass additional args
            PipeLaunchOptions options = new PipeLaunchOptions();

            options.PipePath      = GetGdbPath();
            options.PipeArguments = String.Format("-q -interpreter=mi {0}", GetExtraArguments());
            options.ExePath       = EscapePath(path);
            options.ExeArguments  = args;
            options.SetupCommands = GetSetupCommands();
            // this affects the number of bytes the engine reads when disassembling commands,
            // x64 has the largest maximum command size, so it should be safe to use for x86 as well
            options.TargetArchitecture = TargetArchitecture.x64;
            SetWorkingDirectory(options, path, workingDir);
            return(options);
        }
コード例 #4
0
        public void Launch(string path, string args, string workingDir)
        {
            PipeLaunchOptions  options = BuildLaunchOptions(path, args, workingDir);
            VsDebugTargetInfo4 target  = new VsDebugTargetInfo4
            {
                dlo     = (uint)DEBUG_LAUNCH_OPERATION.DLO_CreateProcess,
                bstrExe = path,
                guidLaunchDebugEngine = new Guid(EngineConstants.EngineId),
                bstrOptions           = ToXmlString(options)
            };

            env.LaunchVsDebugger(target);
            IVsCommandWindow commandWnd = env.GetService <SVsCommandWindow, IVsCommandWindow>();

            commandWnd.ExecuteCommand("Tools.Alias gdb Debug.VRDebugExec");
        }
コード例 #5
0
        private async Task SetWorkingDirectoryAsync(PipeLaunchOptions options, string path, string workingDir, Cargo cargo)
        {
            options.WorkingDirectory = EscapePath(workingDir);
            // GDB won't search working directory by default, but this is expected on Windows.
            string additionalPath = workingDir;

            // TODO: this is probably wrong, because the sysroot does not directly contain SOLibs

            string rustInstallPath = await cargo.GetSysrootAsync();

            if (rustInstallPath != null)
            {
                // prepend toolchain directory
                additionalPath = rustInstallPath + ";" + additionalPath;
            }
            options.AdditionalSOLibSearchPath = additionalPath;
        }
コード例 #6
0
        private async Task <PipeLaunchOptions> BuildLaunchOptionsAsync(string path, string args, string workingDir,
                                                                       EnvDTE.DTE dte, Cargo cargo, TargetTriple triple)
        {
            // We could go through LocalLaunchOptions, but this way we can pass additional args
            PipeLaunchOptions options = new PipeLaunchOptions();

            options.PipePath      = GetGdbPath(dte, triple);
            options.PipeArguments = String.Format("-q -interpreter=mi {0}", GetDebuggingConfigProperty <string>(dte, nameof(DebuggingOptionsPage.GdbExtraArguments)));
            options.ExePath       = EscapePath(path);
            options.ExeArguments  = args;
            options.SetupCommands = GetSetupCommands();
            // this affects the number of bytes the engine reads when disassembling commands,
            // x64 has the largest maximum command size, so it should be safe to use for x86 as well
            options.TargetArchitecture = TargetArchitecture.x64;
            await SetWorkingDirectoryAsync(options, path, workingDir, cargo);

            return(options);
        }