Exemplo n.º 1
0
        private static void Main()
        {
            var tcpClient = new TcpClient("localhost", 2345);

            var gdbClient = new GDBClient();

            gdbClient.Stream = new GDBNetworkStream(tcpClient.Client, true);

            gdbClient.SendCommand(new ReadMemory(0x0, 2, ReadMemory));

            //gdbClient.SendCommandAsync(new SetSoftwareBreakPoint(0x400030, 1, Response));
            gdbClient.SendCommand(new SetSoftwareBreakPoint(0x4571B9, 1, Response));
            gdbClient.SendCommand(new GetRegisters(GetRegisters));
            gdbClient.SendCommand(new Continue(Response));

            Thread.Sleep(2000);
            gdbClient.SendBreak();
            gdbClient.SendCommand(new GetRegisters(GetRegisters));
            gdbClient.SendCommand(new Continue(Response));

            Thread.Sleep(2000);
            gdbClient.SendBreak();
            gdbClient.SendCommand(new GetRegisters(GetRegisters));

            //0x400030
            //gdbClient.SendCommandAsync(new GeneralRegisterRead(Response));

            while (true)
            {
                //loop
            }
        }
Exemplo n.º 2
0
        public bool Connect(string host, int port)
        {
            try
            {
                Disconnect();

                TcpClient = new TcpClient();
                TcpClient.Connect(host, port);

                var stream = new GDBNetworkStream(TcpClient.Client, true);
                GDBClient = new GDBClient(stream);

                if (!GDBClient.IsConnected)
                {
                    return(false);
                }

                Break();
                GetRegisters();
            }
            catch (SocketException)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 3
0
        private static void Main(string[] args)
        {
            var tcpClient = new TcpClient("localhost", 1234);

            var gdbClient = new GDBClient();

            gdbClient.Stream = new GDBNetworkStream(tcpClient.Client, true);
        }
Exemplo n.º 4
0
        public void ReadMemory(ulong address, uint size, OnMemoryRead onMemoryRead)
        {
            var command = new ReadMemory(address, size, OnMemoryRead);

            OnMemoryReadMap.Add(command, onMemoryRead);

            GDBClient.SendCommand(command);
        }
Exemplo n.º 5
0
        public void Kill()
        {
            var command = new Kill();

            GDBClient.SendCommand(command);

            Disconnect();
        }
Exemplo n.º 6
0
        public void Break()
        {
            if (!IsRunning)
            {
                return;
            }

            GDBClient.SendBreak();
            IsPaused = true;
        }
Exemplo n.º 7
0
        public void Kill()
        {
            var command = new Kill();

            GDBClient.SendCommand(command);

            Thread.Sleep(100);             // give it time to terminate

            Disconnect();
        }
Exemplo n.º 8
0
        public void Step(bool skipOnStep = false)
        {
            if (IsRunning)
            {
                return;
            }

            IsPaused = false;
            CallOnRunning();

            var command = skipOnStep ? new Step(OnStepQuiet) : new Step(OnStep);

            GDBClient.SendCommand(command);
        }
Exemplo n.º 9
0
        public void Continue()
        {
            if (IsRunning)
            {
                return;
            }

            IsPaused = false;
            CallOnRunning();

            var command = new Continue(OnStop);

            GDBClient.SendCommand(command);
        }
Exemplo n.º 10
0
        public void StepN(uint stepCount)
        {
            if (IsRunning)
            {
                return;
            }

            var command = new Step();

            for (uint currentStep = 0; currentStep < stepCount - 1; currentStep++)
            {
                GDBClient.SendCommand(command);
            }

            Step();
        }
Exemplo n.º 11
0
        public void GetRegisters()
        {
            var command = new GetRegisters(OnGetRegisters);

            GDBClient.SendCommand(command);
        }
Exemplo n.º 12
0
        public void ClearBreakPoint(ulong address)
        {
            var command = new ClearBreakPoint(address, 4, 0);

            GDBClient.SendCommand(command);
        }
Exemplo n.º 13
0
        public void ExtendedMode()
        {
            var command = new ExtendedMode();

            GDBClient.SendCommand(command);
        }
Exemplo n.º 14
0
        public void GetReasonHalted()
        {
            var command = new GetReasonHalted();

            GDBClient.SendCommand(command);
        }