コード例 #1
0
ファイル: Machine.java プロジェクト: nathan-boyd/schoolCode
  public static void debugger() {
    //Debug.println('m', "Debugger not implemented");

    int num;
    char inputChar;  // char read from input stream
    

    Interrupt.dumpState();
    dumpState();
    System.out.print(Nachos.stats.totalTicks + "> ");
    System.out.flush();

    // get user input, character at a time.

    try {
      inputChar = (char)(System.in.read());
    } catch (IOException _) {
      inputChar = 'x';
    }

    if (inputChar == 'c')
      singleStep = false;
    else if (inputChar == '?') {
      System.out.println("Machine commands:");
      System.out.println("    <return>  execute one instruction");
      System.out.println("    <number>  run until the given timer tick");
      System.out.println("    c         run until completion");
      System.out.println("    ?         print this help message");
    }
    else if (Character.isDigit(inputChar)) {
      int tempNum = 0;

      while (Character.isDigit(inputChar)) {
	tempNum *= 10;
	tempNum += Character.digit(inputChar, 10);
	try {
	  inputChar = (char)(System.in.read());
	} catch (IOException _) {
	  inputChar = 'x';
	  break;
	}
	runUntilTime = tempNum;
      }
    }
      
  }