Esempio n. 1
0
            public static Process LaunchWithoutDebugger(string exe, string args, bool ShowConsole)
            {
                StopExecution();

                if (!File.Exists(exe))
                {
                    ErrorLogger.Log(exe + " not found", ErrorType.Error, ErrorOrigin.Program);
                    return(null);
                }

                IDEManager.Instance.MainWindow.LeftStatusText = "Launch " + Path.GetFileName(exe) + " without debugger";

                // Make all documents read-only
                WorkbenchLogic.Instance.AllDocumentsReadOnly = true;

                try
                {
                    if (ShowConsole)
                    {
                        CurrentProcess = FileExecution.ExecuteAsync(exe, args, Path.GetDirectoryName(exe), CurrentProcess_Exited);
                    }
                    else
                    {
                        CurrentProcess = FileExecution.ExecuteSilentlyAsync(exe, args, Path.GetDirectoryName(exe),
                                                                            CurrentProcess_OutputDataReceived, CurrentProcess_ErrorDataReceived, CurrentProcess_Exited);
                    }
                }
                catch (Exception ex)
                {
                    ErrorLogger.Log(ex, ErrorType.Error, ErrorOrigin.Program);
                }

                Instance.UpdateGUI();
                return(CurrentProcess);
            }
Esempio n. 2
0
        public static void DoUpdate()
        {
            if (!File.Exists(UpdaterExe))
            {
                ErrorLogger.Log(UpdaterExe + " not found! Cannot proceed with update!", ErrorType.Error, ErrorOrigin.System);
                return;
            }

            // Start the updater
            var upt = FileExecution.ExecuteAsync(UpdaterExe, "-a -o \"" + ApplicationStartUpPath + "\"", ApplicationStartUpPath, null);

            // Close main window - the D-IDE.exe will be overwritten!
            IDEManager.Instance.MainWindow.Dispatcher.Invoke(new Action(() =>
                                                                        IDEManager.Instance.MainWindow.Close()));
        }
Esempio n. 3
0
            /// <summary>
            /// Launch the debugger asynchronously
            /// </summary>
            public static void LaunchWithDebugger(string exe, string args, string sourcePath, bool showConsole)
            {
                StopExecution();

                // Make all documents read-only
                WorkbenchLogic.Instance.AllDocumentsReadOnly = true;

                // If there's an external debugger specified and if it's wanted to launch it, start that one
                if (GlobalProperties.Instance.UseExternalDebugger)
                {
                    IDEManager.Instance.MainWindow.LeftStatusText = "Launch external debugger";
                    CurrentProcess = FileExecution.ExecuteAsync(GlobalProperties.Instance.ExternalDebugger_Bin,
                                                                AbstractBuildSupport.BuildArgumentString(GlobalProperties.Instance.ExternalDebugger_Arguments, new Dictionary <string, string> {
                        { "$sourcePath", sourcePath },
                        { "$targetDir", Path.GetDirectoryName(exe) },
                        { "$target", exe },
                        { "$exe", Path.ChangeExtension(exe, ".exe") },
                        { "$dll", Path.ChangeExtension(exe, ".dll") },
                        { "$args", args }
                    }),                             // %WINDBG_ARGS% Program.exe Arg1 Arg2
                                                                Path.GetDirectoryName(exe), CurrentProcess_Exited);

                    Instance.UpdateGUI();

                    return;
                }

                IDEManager.Instance.MainWindow.LeftStatusText = "Start debugging " + Path.GetFileName(exe);

                if (!dbgEngineInited)
                {
                    InitDebugger();
                }

                IsDebugging = true;
                Instance.UpdateGUI();
                EngineStarting       = true;
                StopWaitingForEvents = false;

                DebugCreateProcessOptions opt = new DebugCreateProcessOptions();

                opt.CreateFlags    = CreateFlags.DebugOnlyThisProcess | (showConsole ? CreateFlags.CreateNewConsole : 0);
                opt.EngCreateFlags = EngCreateFlags.Default;

                Engine.CreateProcessAndAttach(0, exe + (string.IsNullOrWhiteSpace(args) ? "" : (" " + args)), opt, Path.GetDirectoryName(exe), "", 0, 0);


                Engine.Symbols.SourcePath           = string.IsNullOrWhiteSpace(sourcePath) ? sourcePath : Path.GetDirectoryName(exe);
                Engine.IsSourceCodeOrientedStepping = true;

                Engine.WaitForEvent();
                Engine.Execute("bc");                 // Clear breakpoint list
                Engine.WaitForEvent();

                CoreManager.DebugManagement.CurrentDebugSupport.PostlaunchInit(Engine);
                BreakpointManagement.SetupBreakpoints();

                EngineStarting = false;

                WaitForDebugEvent();                 // Wait for the first breakpoint/exception/program exit to occur
            }