public void IsStackPrint() { var command = new DebuggerCommand("p"); Assert.IsTrue(command.IsStackPrint); command = new DebuggerCommand("NOTp"); Assert.IsFalse(command.IsStackPrint); }
public void IsEnter() { var command = new DebuggerCommand(String.Empty); Assert.IsTrue(command.IsEnter); command = new DebuggerCommand("NOT"); Assert.IsFalse(command.IsEnter); }
public void IsQuit() { var command = new DebuggerCommand("q"); Assert.IsTrue(command.IsQuit); command = new DebuggerCommand("NOTq"); Assert.IsFalse(command.IsQuit); }
public void IsDisassemble() { var command = new DebuggerCommand("disasm"); Assert.IsTrue(command.IsDisassemble); command = new DebuggerCommand("NOTdisasm"); Assert.IsFalse(command.IsDisassemble); }
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"); } }