Exemplo 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;
        }
Exemplo n.º 2
0
 private void ProcessArgs()
 {
     if (options.EnumProcesses)
     {
         EnumProcesses();
     }
     else if (!string.IsNullOrEmpty(options.PrintDebuggerVersionForAssembly))
     {
         Console.WriteLine(MdbgVersionPolicy.GetDefaultLaunchVersion(options.PrintDebuggerVersionForAssembly));
     }
     else if (!string.IsNullOrEmpty(options.PrintRuntimeVersionForAssembly))
     {
         Console.WriteLine(MdbgVersionPolicy.GetDefaultRuntimeForFile(options.PrintRuntimeVersionForAssembly));
     }
     else
     {
         InitDebugging();
         StartProcess();
         StartMonitoring();
     }
 }