Exemplo n.º 1
0
        public static void AddClient(int index, GdbClient client)
        {
            if (clientes.ContainsKey(index))
                throw new ArgumentException("There is already a client with this index");

            clientes.Add(index, client);
        }
 public void RemoveAllSessions()
 {
     var client = new GdbClient();
     GdbSessionManager.AddClient(1, client);
     GdbSessionManager.Clear();
     Assert.Throws<KeyNotFoundException>(() => GdbSessionManager.GetClient(1));
 }
Exemplo n.º 3
0
        public RegisterManager(GdbClient client)
        {
            this.Client = client;

            this.registers = new Register[17];
            for (int i = 0; i < 16; i++)
                this.registers[i] = new Register((RegisterType)i, 0x00);
            this.registers[16] = new Register(RegisterType.CPSR, 0x00);
        }
Exemplo n.º 4
0
 internal GdbStream(GdbClient client)
 {
     Client = client;
     Position = 0;
 }
 public void ReturnsDefaultOnlyForIndexZero()
 {
     var client = new GdbClient();
     GdbSessionManager.AddClient(1, client);
     Assert.Throws<KeyNotFoundException>(() => GdbSessionManager.GetDefaultClient());
 }
 public void GetDefaultForIndexZero()
 {
     var client = new GdbClient();
     GdbSessionManager.AddClient(0, client);
     Assert.AreSame(client, GdbSessionManager.GetDefaultClient());
 }
 public void AddDefaultGetsDefault()
 {
     var client = new GdbClient();
     GdbSessionManager.AddClient(client);
     Assert.AreSame(client, GdbSessionManager.GetDefaultClient());
 }
 public void AddAndGetAClient()
 {
     var client = new GdbClient();
     GdbSessionManager.AddClient(40, client);
     Assert.AreSame(client, GdbSessionManager.GetClient(40));
 }
 public void TryToAddTwoClientWithSameIndex()
 {
     var client1 = new GdbClient();
     var client2 = new GdbClient();
     GdbSessionManager.AddClient(0, client1);
     Assert.Throws<ArgumentException>(() => GdbSessionManager.AddClient(0, client2));
 }
Exemplo n.º 10
0
 public void TryToAddTwiceWithSameIndex()
 {
     var client = new GdbClient();
     GdbSessionManager.AddClient(30, client);
     Assert.Throws<ArgumentException>(()=>GdbSessionManager.AddClient(30, client));
 }
Exemplo n.º 11
0
 public void NotConnectedOnBadPort()
 {
     GdbClient clientError = new GdbClient();
     clientError.Connection.Connect("localhost", 10102);
     Assert.IsFalse(clientError.Connection.IsConnected);
 }
Exemplo n.º 12
0
 internal ExecutionManager(GdbClient client)
 {
     this.Client = client;
 }
Exemplo n.º 13
0
 public static int AddClient(GdbClient client)
 {
     clientes.Add(LastIndex++, client);
     return LastIndex - 1;
 }
Exemplo n.º 14
0
 internal ConnectionManager(GdbClient client)
 {
     this.Client = client;
 }
Exemplo n.º 15
0
        public static void Main(string[] args)
        {
            Console.WriteLine("/*");
            Console.WriteLine("**************************");
            Console.WriteLine("**     NitroDebugger    **");
            Console.WriteLine("** The new way to debug **");
            Console.WriteLine("**      your games      **");
            Console.WriteLine("**************************");
            Console.WriteLine("~~~~~~~ by pleoNeX ~~~~~~~");
            Console.WriteLine("| Version: {0,-14}|", Assembly.GetExecutingAssembly().GetName().Version);
            Console.WriteLine("~~~~ Good RomHacking! ~~~~");
            Console.WriteLine("*/");
            Console.WriteLine();

            // Create session
            Console.Write("Hostname: "); 	string hostname = Console.ReadLine();
            Console.Write("Port: ");		int port = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine();
            GdbClient client = new GdbClient();
            client.Connection.Connect(hostname, port);

            // Start the interactive console
            bool finish = false;
            do {
                Console.Write("(gdb) "); 	string cmd = Console.ReadLine();

                switch (cmd) {
                case "quit":
                case "exit":
                case "gotobed":
                case "gotouni":
                    Console.WriteLine("You are late again...");
                    finish = true;
                    break;

                case "HR?":
                case "haltedreason":
                    Console.WriteLine(client.Execution.AskHaltedReason());
                    break;

                case "c":
                    client.Execution.Continue();
                    break;

                case "b":
                    client.Execution.Stop();
                    break;

                case "f":
                    System.IO.FileStream fs = new System.IO.FileStream("dump.bin", System.IO.FileMode.Create);
                    client.Stream.CopyTo(fs);
                    fs.Close();
                    break;

                default:
                    Console.WriteLine("Unknown command");
                    break;
                }
            } while (!finish);

            client.Connection.Disconnect();
        }