Example #1
0
 /** Show the current stacktrace using Screen.debug. */
 @KernelSpace
 public final void debugStackTrace(int max) {
   Address f = VmMagic.getCurrentFrame();
   Unsafe.debug("\nDebug stacktrace: ");
   boolean first = true;
   while (isValid(f) && (max > 0)) {
     if (first) {
       first = false;
     } else {
       Unsafe.debug(", ");
     }
     final VmMethod method = getMethod(f);
     final VmType<?> vmClass = method.getDeclaringClass();
     Unsafe.debug(vmClass.getName());
     Unsafe.debug("::");
     Unsafe.debug(method.getName());
     Unsafe.debug('\n');
     f = getPrevious(f);
     max--;
   }
   if (isValid(f)) {
     Unsafe.debug("...");
   }
 }
Example #2
0
  /**
   * Process the input from the kernel debugger.
   *
   * @param input
   * @throws org.vmmagic.pragma.UninterruptiblePragma
   */
  @Uninterruptible
  @KernelSpace
  private final void processKdbInput(int input) {
    switch ((char) input) {
      case '?':
      case 'h':
        debug("Commands:\n");
        debug("l   Show Load/Compile queue\n");
        debug("p   Ping\n");
        debug("q   Print thread queues\n");
        debug("r   Print stacktraces of ready-queue\n");
        debug("t   Print current thread\n");
        debug("v   Verify thread\n");
        debug("w   Print waiting threads\n");
        debug("W   Print stacktraces of waiting threads\n");
        break;
      case 'l':
        debug("<load-compile-service: ");
        debug("\n");
        LoadCompileService.showInfo();
        debug("/>\n");
        break;
      case 'p':
        debug("<ping/>");
        break;
      case 'q':
        {
          final VmThread currentThread = VmMagic.currentProcessor().currentThread;
          debug("<queues: current-thread name='");
          debug(currentThread.getName());
          debug("' state='");
          debug(currentThread.getThreadStateName());
          debug("\n");
          vmScheduler.getReadyQueue().dump(false, null);
          vmScheduler.getSleepQueue().dump(false, null);
          debug("/>\n");
          break;
        }
      case 'r':
        debug("<traces: ");
        debug("\n");
        vmScheduler.getReadyQueue().dump(true, vmScheduler.getStackReader());
        debug("/>\n");
        break;
      case 'v':
        debug("<verify: ");
        debug("\n");
        verifyThreads();
        debug("/>\n");
        break;
      case 'w':
        debug("<waiting: ");
        debug("\n");
        dumpWaitingThreads(false, null);
        debug("/>\n");
        break;
      case 'W':
        debug("<waiting: ");
        debug("\n");
        dumpWaitingThreads(true, vmScheduler.getStackReader());
        debug("/>\n");
        break;
      case 't':
        {
          final VmThread currentThread = VmMagic.currentProcessor().currentThread;
          debug("<currentthread name='");
          debug(currentThread.getName());
          debug("' state='");
          debug(currentThread.getThreadStateName());
          debug("'/>\n");
          break;
        }
      case 'T':
        {
          final VmThread currentThread = VmMagic.currentProcessor().currentThread;
          debug("<currentthread name='");
          debug(currentThread.getName());
          debug("' state='");
          debug(currentThread.getThreadStateName());
          vmScheduler.getStackReader().debugStackTrace(currentThread);
          debug("'/>\n");
          break;
        }
      case '#':
        debug("Halt for ever\n");
        while (true) ;

        // default:
        // debug(input);
    }
  }