protected override void OnRun(DebuggerStartInfo startInfo) { // Create the debugger string dversion = CorDebugger.GetDebuggerVersionFromFile(startInfo.Command); dbg = new CorDebugger(dversion); Dictionary <string, string> env = new Dictionary <string, string> (); foreach (DictionaryEntry de in Environment.GetEnvironmentVariables()) { env[(string)de.Key] = (string)de.Value; } foreach (KeyValuePair <string, string> var in startInfo.EnvironmentVariables) { env[var.Key] = var.Value; } // The second parameter of CreateProcess is the command line, and it includes the application being launched string cmdLine = "\"" + startInfo.Command + "\" " + startInfo.Arguments; process = dbg.CreateProcess(startInfo.Command, cmdLine, startInfo.WorkingDirectory, env); processId = process.Id; process.OnCreateProcess += new CorProcessEventHandler(OnCreateProcess); process.OnCreateAppDomain += new CorAppDomainEventHandler(OnCreateAppDomain); process.OnAssemblyLoad += new CorAssemblyEventHandler(OnAssemblyLoad); process.OnAssemblyUnload += new CorAssemblyEventHandler(OnAssemblyUnload); process.OnCreateThread += new CorThreadEventHandler(OnCreateThread); process.OnThreadExit += new CorThreadEventHandler(OnThreadExit); process.OnModuleLoad += new CorModuleEventHandler(OnModuleLoad); process.OnModuleUnload += new CorModuleEventHandler(OnModuleUnload); process.OnProcessExit += new CorProcessEventHandler(OnProcessExit); process.OnUpdateModuleSymbols += new UpdateModuleSymbolsEventHandler(OnUpdateModuleSymbols); process.OnDebuggerError += new DebuggerErrorEventHandler(OnDebuggerError); process.OnBreakpoint += new BreakpointEventHandler(OnBreakpoint); process.OnStepComplete += new StepCompleteEventHandler(OnStepComplete); process.OnBreak += new CorThreadEventHandler(OnBreak); process.OnNameChange += new CorThreadEventHandler(OnNameChange); process.OnEvalComplete += new EvalEventHandler(OnEvalComplete); process.OnEvalException += new EvalEventHandler(OnEvalException); process.Continue(false); OnStarted(); }
protected override void OnRun(DebuggerStartInfo startInfo) { // Create the debugger string dversion; try { dversion = CorDebugger.GetDebuggerVersionFromFile(startInfo.Command); } catch { dversion = CorDebugger.GetDefaultDebuggerVersion(); } dbg = new CorDebugger(dversion); Dictionary <string, string> env = new Dictionary <string, string> (); foreach (DictionaryEntry de in Environment.GetEnvironmentVariables()) { env[(string)de.Key] = (string)de.Value; } foreach (KeyValuePair <string, string> var in startInfo.EnvironmentVariables) { env[var.Key] = var.Value; } // The second parameter of CreateProcess is the command line, and it includes the application being launched string cmdLine = "\"" + startInfo.Command + "\" " + startInfo.Arguments; int flags = 0; if (!startInfo.UseExternalConsole) { flags = 0x08000000; /* CREATE_NO_WINDOW*/ flags |= CorDebugger.CREATE_REDIRECT_STD; } process = dbg.CreateProcess(startInfo.Command, cmdLine, startInfo.WorkingDirectory, env, flags); processId = process.Id; process.OnCreateProcess += new CorProcessEventHandler(OnCreateProcess); process.OnCreateAppDomain += new CorAppDomainEventHandler(OnCreateAppDomain); process.OnAssemblyLoad += new CorAssemblyEventHandler(OnAssemblyLoad); process.OnAssemblyUnload += new CorAssemblyEventHandler(OnAssemblyUnload); process.OnCreateThread += new CorThreadEventHandler(OnCreateThread); process.OnThreadExit += new CorThreadEventHandler(OnThreadExit); process.OnModuleLoad += new CorModuleEventHandler(OnModuleLoad); process.OnModuleUnload += new CorModuleEventHandler(OnModuleUnload); process.OnProcessExit += new CorProcessEventHandler(OnProcessExit); process.OnUpdateModuleSymbols += new UpdateModuleSymbolsEventHandler(OnUpdateModuleSymbols); process.OnDebuggerError += new DebuggerErrorEventHandler(OnDebuggerError); process.OnBreakpoint += new BreakpointEventHandler(OnBreakpoint); process.OnStepComplete += new StepCompleteEventHandler(OnStepComplete); process.OnBreak += new CorThreadEventHandler(OnBreak); process.OnNameChange += new CorThreadEventHandler(OnNameChange); process.OnEvalComplete += new EvalEventHandler(OnEvalComplete); process.OnEvalException += new EvalEventHandler(OnEvalException); process.OnLogMessage += new LogMessageEventHandler(OnLogMessage); process.OnStdOutput += new CorTargetOutputEventHandler(OnStdOutput); process.OnException2 += new CorException2EventHandler(OnException2); process.Continue(false); OnStarted(); }