示例#1
0
        public void LogDebuggerStop(IDebuggerStop debuggerStop)
        {
            if(_logStream == null)
            {
                string logFilename = BuildLogFile();
                _logStream = File.OpenWrite(logFilename);
            }

            StreamHelper.WriteInt32((int)debuggerStop.StopReason, _logStream);
            StreamHelper.WriteInt64(debuggerStop.Status, _logStream);
            StreamHelper.WriteUInt64(debuggerStop.Address, _logStream);
        }
示例#2
0
        public GDBSnapshot(GDBConnector connector, IDebuggerStop lastDebuggerStop)
        {
            _connector = connector;

            if(lastDebuggerStop == null)
                throw new ArgumentException("No last stop address found");

            if(lastDebuggerStop.Address == 0 )
                throw new ArgumentException("Last stop does not provide address");

            _myBreakpoint = connector.SetSoftwareBreakpoint(lastDebuggerStop.Address, 0, "_snapshot");

            //Activate reverse debugging
            connector.QueueCommand(new RecordCmd(_connector));
        }
示例#3
0
 private void GdbStopped(StopReasonEnum stopReason, GDBBreakpoint breakpoint, UInt64 address, Int64 status)
 {
     _lastDebuggerStop = new DebuggerStop(stopReason, breakpoint, address, status);
     _gdbStopEventHandler.Set();
 }
示例#4
0
        public IDebuggerStop DebugContinue(bool reverse)
        {
            bool success = false;
            ManualResetEvent evt = new ManualResetEvent (false);
            _gdbStopEventHandler.Reset ();
            QueueCommand (new ContinueCmd (reverse, _runArgs,
                (Action<bool>)delegate(bool bSuc)
                {
                success = bSuc;
                evt.Set ();
            }, this));

            while (true)
            {
                //If negative continue response was received,
                //throw an exception
                if (evt.WaitOne (10) && success == false)
                    throw new ArgumentException ("Continuing failed");

                if (_gdbStopEventHandler.WaitOne (10))
                    break;
            }

            //There are situations where no address is available. e.g. the debugger only returns symbols on
            //break. Retrieve the current location in this situations
            if (_lastDebuggerStop.Address == 0)
            {
                evt.Reset ();
                QueueCommand (new PrintCmd (PrintCmd.Format.Hex, "$pc",
                    delegate(object value) {
                    if (value is UInt64)
                        _lastDebuggerStop = new DebuggerStop (
                            _lastDebuggerStop.StopReason,
                            _lastDebuggerStop.Breakpoint,
                            (UInt64)value,
                            _lastDebuggerStop.Status);

                      evt.Set ();
                }, this));

                evt.WaitOne ();
            }

            if (_lastDebuggerStop.StopReason == StopReasonEnum.Breakpoint &&
                _lastDebuggerStop.Breakpoint == null)
            {
                _lastDebuggerStop = new DebuggerStop (
                    _lastDebuggerStop.StopReason,
                    LookupBreakpointByAddress (_lastDebuggerStop.Address),
                    _lastDebuggerStop.Address,
                    _lastDebuggerStop.Status);
            }

            return _lastDebuggerStop;
        }