Esempio n. 1
0
 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);
        }
Esempio n. 3
0
 public void bp_list(DebuggerCore debugger)
 {
     foreach (var bp in debugger.BreakPoints)
     {
         debugger.WriteLine(bp.ToString());
     }
 }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 public void close_log(DebuggerCore debugger)
 {
     if (_logger != null)
     {
         debugger.Redirect(null);
         _logger.Dispose();
     }
     debugger.WriteLine("Logger closed");
 }
Esempio n. 6
0
        public bool CheckBreakConditions(DebuggerCore debugger)
        {
            if (_breakConditionExpression == null)
            {
                return(true);
            }

            var condResult = _breakConditionExpression.Eval(debugger.ExpressionContext, this);

            return((bool)Convert.ChangeType(condResult, typeof(bool)));
        }
Esempio n. 7
0
 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);
 }
Esempio n. 8
0
 public void e(DebuggerCore debugger, Expression expr)
 {
     try
     {
         debugger.WriteLine(debugger.ExpressionContext.EvalAndFormat(expr));
     }
     catch (Exception x)
     {
         debugger.WriteLine("Error: {0}", x.Message);
     }
 }
Esempio n. 9
0
 public string EvalAndFormat(DebuggerCore debugger)
 {
     try
     {
         return(debugger.ExpressionContext.EvalAndFormat(_expression));
     }
     catch (Exception x)
     {
         return("err:" + x.Message);
     }
 }
Esempio n. 10
0
        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;
        }
Esempio n. 11
0
        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());
            }
        }
Esempio n. 12
0
 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);
     }
 }
Esempio n. 13
0
        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);
            }
        }
Esempio n. 14
0
        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);
        }
Esempio n. 15
0
        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);
            }
        }
Esempio n. 16
0
 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);
     }
 }
Esempio n. 17
0
        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);
            }
        }
Esempio n. 18
0
 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);
         }
     }
 }
Esempio n. 19
0
 public CommandDispatcher(DebuggerCore debugger)
 {
     _debugger = debugger;
     RegisterCommandHandler(new DebuggerCommands());
 }
Esempio n. 20
0
 public void trace_clear(DebuggerCore debugger)
 {
     debugger.ClearTraceBuffer();
 }
Esempio n. 21
0
 public void trace(DebuggerCore debugger, int length = 0)
 {
     debugger.DumpTraceBuffer(length == 0 ? debugger.TraceBufferSize : length);
 }
Esempio n. 22
0
 public void trace_on(DebuggerCore debugger)
 {
     debugger.EnableTrace = true;
     trace_set(debugger);
 }
Esempio n. 23
0
 public override bool ShouldBreak(DebuggerCore debugger)
 {
     return(false);
 }
Esempio n. 24
0
 public void bp(DebuggerCore debugger, FarPointer addr)
 {
     debugger.AddBreakPoint(new CodeBreakPoint(addr.Segment, addr.Offset));
 }
Esempio n. 25
0
 public void trace_off(DebuggerCore debugger)
 {
     debugger.EnableTrace = false;
     trace_set(debugger);
 }
Esempio n. 26
0
 public abstract bool ShouldBreak(DebuggerCore debugger);
Esempio n. 27
0
 public void bp_clear(DebuggerCore debugger)
 {
     debugger.RemoveAllBreakpoints();
 }
Esempio n. 28
0
 public void bp_off(DebuggerCore debugger, BreakPoint bp)
 {
     debugger.EnableBreakPoint(bp, false);
 }
Esempio n. 29
0
 public void bp_on(DebuggerCore debugger, BreakPoint bp)
 {
     debugger.EnableBreakPoint(bp, true);
 }
Esempio n. 30
0
 public void bp_del(DebuggerCore debugger, BreakPoint bp)
 {
     debugger.RemoveBreakPoint(bp);
 }