Esempio n. 1
0
        public void StartProcess()
        {
            Debugger.Options.StopOnLogMessage = false;
            if (options.PID != 0)
            {
                string clrVersion = string.IsNullOrEmpty(options.CLRVersion) ? MdbgVersionPolicy.GetDefaultAttachVersion(options.PID) : options.CLRVersion;
                Process = Debugger.Attach(options.PID, null, clrVersion);
                WriteLine("Attached to " + options.PID);
                Process.Go().WaitOne();
            }
            else if (!string.IsNullOrEmpty(options.Executable))
            {
                var clrVersion = MdbgVersionPolicy.GetDefaultLaunchVersion(options.Executable);
                Process = Debugger.Processes.CreateLocalProcess(new CorDebugger(clrVersion));
                if (Process == null)
                {
                    throw new Exception("Could not create debugging interface for runtime version " + clrVersion);
                }
                Process.DebugMode = DebugModeFlag.Debug;
                Process.CreateProcess(options.Executable, configuration.arguments != null ? configuration.arguments : "");
                Process.Go().WaitOne();
            }
            else
            {
                WriteLine(options.GetUsage());
                return;
            }

            Console.CancelKeyPress += OnAbort;
        }
        //////////////////////////////////////////////////////////////////////////////////
        //
        // Controlling Commands
        //
        //////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// creates a new debugged process.
        /// </summary>
        /// <param name="commandLine">The command to run.</param>
        /// <param name="commandArguments">The arguments for the command.</param>
        /// <param name="debugMode">The debug mode to run with.</param>
        /// <param name="deeVersion">The version of debugging interfaces that should be used for
        ///   debuging of the started program. If this value is null, the default (latest) version
        ///   of interface is used.
        /// </param>
        /// <returns>The resulting MDbgProcess.</returns>
        public MDbgProcess CreateProcess(string commandLine, string commandArguments,
                                         DebugModeFlag debugMode, string deeVersion)
        {
            MDbgProcess p = m_processMgr.CreateLocalProcess(deeVersion);

            p.DebugMode = debugMode;
            p.CreateProcess(commandLine, commandArguments);
            return(p);
        }
Esempio n. 3
0
        //////////////////////////////////////////////////////////////////////////////////
        //
        // Controlling Commands
        //
        //////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// creates a new debugged process.
        /// </summary>
        /// <param name="commandLine">The command to run.</param>
        /// <param name="commandArguments">The arguments for the command.</param>
        /// <param name="debugMode">The debug mode to run with.</param>
        /// <param name="deeVersion">The version of debugging interfaces that should be used for
        ///   debugging of the started program. If this value is null, the default (latest) version
        ///   of interface is used.
        /// </param>
        /// <returns>The resulting MDbgProcess.</returns>
        public MDbgProcess CreateProcess(string commandLine, string commandArguments,
                                         DebugModeFlag debugMode, string deeVersion)
        {
            CorDebugger debugger;

            if (deeVersion == null)
            {
                debugger = new CorDebugger(CorDebugger.GetDefaultDebuggerVersion());
            }
            else
            {
                debugger = new CorDebugger(deeVersion);
            }
            MDbgProcess p = m_processMgr.CreateLocalProcess(debugger);

            p.DebugMode = debugMode;
            p.CreateProcess(commandLine, commandArguments);
            return(p);
        }
Esempio n. 4
0
 /// <summary>
 /// Start a process for debugging.
 /// </summary>
 /// <param name="filename"></param>
 /// <param name="args"></param>
 public override void Run(string filename, params string[] args)
 {
     process.CreateProcess(filename, string.Join(" ", args));
 }