Example #1
0
 string WriteRegisters(GDBPacket packet)
 {
     string regsData = packet.GetCommandParameters()[0];
     for (int i = 0, pos = 0; i < RegistersCount; i++)
     {
         int currentRegisterLength = GetRegisterSize(i) == RegisterSize.Word ? 4 : 2;
         SetRegister(i, regsData.Substring(pos, currentRegisterLength));
         pos += currentRegisterLength;
     }
     return StandartAnswers.OK;
 }
Example #2
0
 string SetRegister(GDBPacket packet)
 {
     string[] parameters = packet.GetCommandParameters()[0].Split(new char[] { '=' });
     if (SetRegister(Convert.ToInt32(parameters[0], 16), parameters[1]))
             return StandartAnswers.OK;
         else
             return StandartAnswers.Error;
 }
Example #3
0
        string WriteMemory(GDBPacket packet)
        {
            string[] parameters = packet.GetCommandParameters();
            ushort addr = Convert.ToUInt16(parameters[0], 16);
            int length = Convert.ToUInt16(parameters[1], 16);

            if (length > 0)
            {
                for (int i = 0; i < length; i++)
                    emulator.CPU.WRMEM((ushort)(addr + i), (byte)Convert.ToUInt16(parameters[2].Substring(i * 2, 2), 16));
            }
            else
                return StandartAnswers.Error;

            return StandartAnswers.OK;
        }
Example #4
0
        string SetBreakpoint(GDBPacket packet)
        {
            string[] parameters = packet.GetCommandParameters();
            Breakpoint.BreakpointType type = Breakpoint.GetBreakpointType(int.Parse(parameters[0]));
            ushort addr = Convert.ToUInt16(parameters[1], 16);

            if (type == Breakpoint.BreakpointType.Execution)
                emulator.AddBreakpoint(new ZXMAK2.Entities.Breakpoint(addr));
            else
                jtagDevice.AddBreakpoint(type, addr);

            return StandartAnswers.OK;
        }
Example #5
0
        string ReadMemory(GDBPacket packet)
        {
            string[] parameters = packet.GetCommandParameters();
            var addr = Convert.ToUInt16(parameters[0], 16);
            var length = Convert.ToUInt16(parameters[1]);

            string result = "";
            if (length > 0)
            {
                for (int i = 0; i < length; i++)
                    result += emulator.CPU.RDMEM((ushort)(addr + i)).ToLowEndianHexString();
                return result;
            }
            else
                return StandartAnswers.Error;
        }
Example #6
0
 string GetRegister(GDBPacket packet)
 {
     return GetRegisterAsHex(Convert.ToInt32(packet.GetCommandParameters()[0], 16));
 }
Example #7
0
 string GeneralQueryResponse(GDBPacket packet)
 {
     string command = packet.GetCommandParameters()[0];
     if (command.StartsWith("Supported"))
         return "PacketSize=4000";
     if (command.StartsWith("C"))
         return StandartAnswers.Empty;
     if (command.StartsWith("Attached"))
         return "1";
     if (command.StartsWith("TStatus"))
         return StandartAnswers.Empty;
     if (command.StartsWith("Offset"))
         return StandartAnswers.Error;
     return StandartAnswers.OK;
 }
Example #8
0
        string ExecutionRequest(GDBPacket packet)
        {
            string command = packet.GetCommandParameters()[0];
            if (command.StartsWith("Cont?"))
                return "";
            if (command.StartsWith("Cont"))
            {

            }
            return StandartAnswers.Empty;
        }