/// <summary> /// Creates a Command line interface for the specified debugger. /// </summary> /// <param name="debugger"></param> public Cli(Debugger debugger) { if (debugger == null) { throw new ArgumentNullException("debugger"); } Debugger = debugger; Debugger.ExecutionInterrupt += new ExecutionInterruptHandler(ExecutionInterrupted); Done = new AutoResetEvent(false); SourceFatcher = new SourceFatcher(); }
/// <summary> /// Writes current program location (address and source code line) /// to the Console. /// </summary> protected void WriteLocation() { long address = Debugger.Target.ProgramLocation.CurrentInstructionAddress; try { DebugSymbol s = Debugger.DebugInformation.ByValue[address]; Console.WriteLine("Address: " + address + "; Location: " + s.Location.ToString()); Console.WriteLine(s.Location.Line.ToString() + " " + SourceFatcher.GetLine(s.Location)); } catch (KeyNotFoundException) { Console.WriteLine("Address: " + address); Console.WriteLine("No debug information available for this address."); } }