Пример #1
0
bool CmdThread::onServer(DebuggerProxy &proxy) {
  if (m_body == "info") {
    // collect info
    InfoVec info;
    debuggerInfo(info);
    Transport *transport = g_context->getTransport();
    if (transport) {
      transport->debuggerInfo(info);
    } else {
      Add(info, "Thread Type", proxy.getThreadType());
    }
    g_context->debuggerInfo(info);

    m_out = DebuggerClient::FormatInfoVec(info);
    return proxy.sendToClient(this);
  }

  if (m_body == "list") {
    proxy.getThreads(m_threads);
    return proxy.sendToClient(this);
  }
  if (m_body == "switch") {
    if (!m_threads.empty()) {
      proxy.switchThread(m_threads[0]);
      m_exitInterrupt = true;
      return true;
    }
  }

  if (m_body == "normal") {
    proxy.switchThreadMode(DebuggerProxy::Normal);
    return true;
  }
  if (m_body == "sticky") {
    proxy.switchThreadMode(DebuggerProxy::Sticky);
    return true;
  }
  if (m_body == "exclusive") {
    proxy.switchThreadMode(DebuggerProxy::Exclusive);
    return true;
  }

  assert(false);
  return false;
}