예제 #1
0
        public void IsStackPrint()
        {
            var command = new DebuggerCommand("p");
            Assert.IsTrue(command.IsStackPrint);

            command = new DebuggerCommand("NOTp");
            Assert.IsFalse(command.IsStackPrint);
        }
예제 #2
0
        public void IsEnter()
        {
            var command = new DebuggerCommand(String.Empty);
            Assert.IsTrue(command.IsEnter);

            command = new DebuggerCommand("NOT");
            Assert.IsFalse(command.IsEnter);
        }
예제 #3
0
        public void IsQuit()
        {
            var command = new DebuggerCommand("q");
            Assert.IsTrue(command.IsQuit);

            command = new DebuggerCommand("NOTq");
            Assert.IsFalse(command.IsQuit);
        }
예제 #4
0
        public void IsDisassemble()
        {
            var command = new DebuggerCommand("disasm");
            Assert.IsTrue(command.IsDisassemble);

            command = new DebuggerCommand("NOTdisasm");
            Assert.IsFalse(command.IsDisassemble);
        }
예제 #5
0
        public void IsStackPrint()
        {
            var command = new DebuggerCommand("p");

            Assert.IsTrue(command.IsStackPrint);

            command = new DebuggerCommand("NOTp");
            Assert.IsFalse(command.IsStackPrint);
        }
예제 #6
0
        public void IsQuit()
        {
            var command = new DebuggerCommand("q");

            Assert.IsTrue(command.IsQuit);

            command = new DebuggerCommand("NOTq");
            Assert.IsFalse(command.IsQuit);
        }
예제 #7
0
        public void IsEnter()
        {
            var command = new DebuggerCommand(String.Empty);

            Assert.IsTrue(command.IsEnter);

            command = new DebuggerCommand("NOT");
            Assert.IsFalse(command.IsEnter);
        }
예제 #8
0
        public void IsDisassemble()
        {
            var command = new DebuggerCommand("disasm");

            Assert.IsTrue(command.IsDisassemble);

            command = new DebuggerCommand("NOTdisasm");
            Assert.IsFalse(command.IsDisassemble);
        }
예제 #9
0
        private void HandleInputIfNecessary()
        {
            if (!interactive)
            {
                return;
            }

            // TODO: cover this with a system-level test
            var enterPressed = false;

            while (!enterPressed)
            {
                var input   = GetInput();
                var command = new DebuggerCommand(input);
                if (command.IsEnter)
                {
                    enterPressed = true;
                    continue;
                }

                if (command.IsStackPrint)
                {
                    PrintStackFor(state);
                    continue;
                }

                if (command.IsDisassemble)
                {
                    var hex  = input.Substring("disasm".Length + 1);
                    var code = DumpFileParser.GetByteArrayFor(hex);
                    PrintOpcodeInfoFor(code);
                    continue;
                }

                if (command.IsQuit)
                {
                    Environment.Exit(0);
                }

                Console.WriteLine("invalid command");
            }
        }
예제 #10
0
        private void HandleInputIfNecessary()
        {
            if (!interactive)
            {
                return;
            }

            // TODO: cover this with a system-level test
            var enterPressed = false;

            while (!enterPressed)
            {
                var input = GetInput();
                var command = new DebuggerCommand(input);
                if (command.IsEnter)
                {
                    enterPressed = true;
                    continue;
                }

                if (command.IsStackPrint)
                {
                    PrintStackFor(state);
                    continue;
                }

                if (command.IsDisassemble)
                {
                    var hex = input.Substring("disasm".Length + 1);
                    var code = DumpFileParser.GetByteArrayFor(hex);
                    PrintOpcodeInfoFor(code);
                    continue;
                }

                if (command.IsQuit)
                {
                    Environment.Exit(0);
                }

                Console.WriteLine("invalid command");
            }
        }