public void CanAttach() { var debugger = new DllDebugger(new TextMessageSubscriber(), new GitSourceRepository(new UserInputParser(), new DirectoryInfo("f:\\checked_out"))); var process = Process.GetProcessesByName("SampleCecilTestbed").First(); debugger.Debug(process.Id); debugger.SetBreakPoint(56, "SampleCecil", "Class1"); debugger.WaitTillExit(); }
private void SetBreakpoint(string transcribed, DllDebugger debugger) { var strings = transcribed.Split(' '); try { debugger.SetBreakPoint(int.Parse(strings[1]), strings[2], strings[3]); } catch (Exception e) { Console.Out.WriteLine("Could not set breakpoint."); } }
public static void Main(string[] args) { var debugger = new DllDebugger(new TextMessageSubscriber(), new GitSourceRepository(new UserInputParser(), new DirectoryInfo("f:\\checked_out"))); var process = Process.GetProcessesByName("SampleCecilTestbed").First(); debugger.Debug(process.Id); while (debugger.NumberOfModulesLoaded < 2) { } Console.Out.WriteLine(); debugger.SetBreakPoint(47, "SampleCecil", "Class1"); // debugger.SetBreakPoint(56, "SampleCecil", "Class1"); debugger.SetBreakPoint(61, "SampleCecil", "Class1"); debugger.WaitTillExit(); }
public void Stopped(DllDebugger debugger, CorThread thread) { Console.ForegroundColor = ConsoleColor.Black; Console.BackgroundColor = ConsoleColor.Green; Console.Out.Write("Thread [{0}]", thread.Id); Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Red; Console.Out.Write(" (ct=Continue, stov=Step Over, stin=Step In, trc=Stack Trace, det=Detach): "); Console.ForegroundColor = ConsoleColor.Green; var line = Console.In.ReadLine(); var transcribed = line.ToLower(); if (transcribed.Contains("ct")) return; if (transcribed.Contains("stov")) debugger.StepOver(thread); else if (transcribed.Contains("stin")) debugger.StepInto(thread); else if (transcribed.Contains("trc")) debugger.ShowStackTrace(thread); else if (transcribed.Contains("locals")) debugger.ShowLocals(thread); else if (transcribed.Contains("br")) SetBreakpoint(transcribed, debugger); else if (transcribed.Contains("det")) debugger.Detach(); else Stopped(debugger, thread); }