public void w(DebuggerCore debugger, Expression expr, string name = "") { debugger.AddWatchExpression(new WatchExpression(expr) { Name = name }); }
public override bool ShouldBreak(DebuggerCore debugger) { bool retv = _tripped; _tripped = false; return(retv); }
public void bp_list(DebuggerCore debugger) { foreach (var bp in debugger.BreakPoints) { debugger.WriteLine(bp.ToString()); } }
public override bool ShouldBreak(DebuggerCore debugger) { // Break after executing a return instruction when the stack // pointer is higher than it currently is. var cpu = debugger.CPU; return(cpu.DidReturn && cpu.ss == _ssBreakOnReturn && cpu.sp > _spBreakOnReturn); }
public void close_log(DebuggerCore debugger) { if (_logger != null) { debugger.Redirect(null); _logger.Dispose(); } debugger.WriteLine("Logger closed"); }
public bool CheckBreakConditions(DebuggerCore debugger) { if (_breakConditionExpression == null) { return(true); } var condResult = _breakConditionExpression.Eval(debugger.ExpressionContext, this); return((bool)Convert.ChangeType(condResult, typeof(bool))); }
public void log(DebuggerCore debugger, string filename) { if (_logger != null) { _logger.Dispose(); _logger = null; } _logger = new StreamWriter(filename, false, Encoding.UTF8); debugger.WriteLine("Logging to file {0}", filename); debugger.Redirect(_logger); }
public void e(DebuggerCore debugger, Expression expr) { try { debugger.WriteLine(debugger.ExpressionContext.EvalAndFormat(expr)); } catch (Exception x) { debugger.WriteLine("Error: {0}", x.Message); } }
public string EvalAndFormat(DebuggerCore debugger) { try { return(debugger.ExpressionContext.EvalAndFormat(_expression)); } catch (Exception x) { return("err:" + x.Message); } }
public void trace_set(DebuggerCore debugger, int size = -1) { if (size > 0) { debugger.TraceBufferSize = size; } debugger.WriteLine("Trace buffer size = {0}, tracing {1}", debugger.TraceBufferSize, debugger.EnableTrace ? "on" : "off"); return; }
public void disasm(DebuggerCore debugger, FarPointer addr, ushort length = 16) { var dis = new Disassembler(debugger.CPU); dis.cs = addr.Segment; dis.ip = addr.Offset; while (dis.ip < addr.Offset + length) { debugger.WriteLine("{0:X4}:{1:X4} {2}", dis.cs, dis.ip, dis.Read()); } }
public void r_time(DebuggerCore debugger, ulong counter) { if (counter > debugger.CPU.CpuTime) { debugger.BreakAtTemp(new CpuTimeBreakPoint(counter)); debugger.Continue(); } else { debugger.WriteLine("{0} is in the past!", counter); } }
public void w_del(DebuggerCore debugger, int number) { var bp = debugger.WatchExpressions.FirstOrDefault(x => x.Number == number); if (bp != null) { debugger.RemoveWatchExpression(bp); } else { debugger.WriteLine("Watch expression #{0} doesn't exist", number); } }
public override bool ShouldBreak(DebuggerCore debugger) { var newValue = _expression.Eval(debugger.ExpressionContext); if (_prevValue == null) { _prevValue = newValue; return(false); } bool changed = (bool)Operators.compare_ne(newValue, _prevValue); _prevValue = newValue; return(changed); }
public void help(DebuggerCore debugger) { foreach (var mi in debugger.CommandDispatcher._commandHandlers .SelectMany(x => x.GetType().GetMethods()) .OrderBy(x => x.Name)) { var help = mi.GetCustomAttributes(true).OfType <DebuggerHelpAttribute>().FirstOrDefault(); if (help == null) { continue; } debugger.WriteLine("{0,20} - {1}", mi.Name.Replace("_", " "), help.Help); } }
public void bp_reset(DebuggerCore debugger, BreakPoint bp = null) { if (bp != null) { bp.TripCount = 0; debugger.WriteLine(bp.ToString()); } else { foreach (var x in debugger.BreakPoints) { x.TripCount = 0; } bp_list(debugger); } }
public void w_edit(DebuggerCore debugger, int number, Expression expression = null) { var w = debugger.WatchExpressions.FirstOrDefault(x => x.Number == number); if (w == null) { debugger.WriteLine("Watch expression #{0} doesn't exist", number); return; } if (expression == null) { debugger.PromptConsole(string.Format("w edit {0} {1}", w.Number, w.ExpressionText)); } else { debugger.EditWatchExpression(w, expression); } }
public void bp_edit(DebuggerCore debugger, BreakPoint bp, [ArgTail] string argtail = null) { if (string.IsNullOrWhiteSpace(argtail)) { debugger.PromptConsole(string.Format("bp edit {0} {1}", bp.Number, bp.EditString)); } else { try { debugger.EditBreakPoint(bp); debugger.CommandDispatcher.ExecuteCommand("bp " + argtail); } finally { debugger.EditBreakPoint(null); } } }
public CommandDispatcher(DebuggerCore debugger) { _debugger = debugger; RegisterCommandHandler(new DebuggerCommands()); }
public void trace_clear(DebuggerCore debugger) { debugger.ClearTraceBuffer(); }
public void trace(DebuggerCore debugger, int length = 0) { debugger.DumpTraceBuffer(length == 0 ? debugger.TraceBufferSize : length); }
public void trace_on(DebuggerCore debugger) { debugger.EnableTrace = true; trace_set(debugger); }
public override bool ShouldBreak(DebuggerCore debugger) { return(false); }
public void bp(DebuggerCore debugger, FarPointer addr) { debugger.AddBreakPoint(new CodeBreakPoint(addr.Segment, addr.Offset)); }
public void trace_off(DebuggerCore debugger) { debugger.EnableTrace = false; trace_set(debugger); }
public abstract bool ShouldBreak(DebuggerCore debugger);
public void bp_clear(DebuggerCore debugger) { debugger.RemoveAllBreakpoints(); }
public void bp_off(DebuggerCore debugger, BreakPoint bp) { debugger.EnableBreakPoint(bp, false); }
public void bp_on(DebuggerCore debugger, BreakPoint bp) { debugger.EnableBreakPoint(bp, true); }
public void bp_del(DebuggerCore debugger, BreakPoint bp) { debugger.RemoveBreakPoint(bp); }