Exemple #1
0
void Debugger::LogShutdown(ShutdownKind shutdownKind) {
  int proxyCount = s_debugger.countConnectedProxy();
  if (proxyCount > 0) {
    Logger::Warning(DEBUGGER_LOG_TAG "%s with connected debuggers!",
                    shutdownKind == ShutdownKind::Normal ?
                      "Normal shutdown" : "Unexpected crash");

    for (const auto& proxyEntry: s_debugger.m_proxyMap) {
      auto sid = proxyEntry.first;
      auto proxy = proxyEntry.second;
      auto dummySid = StringData::GetStaticString(proxy->getDummyInfo().id());
      if (sid != dummySid) {
        auto sandbox = proxy->getSandbox();
        if (sandbox.valid()) {
          Logger::Warning(DEBUGGER_LOG_TAG "Debugging %s\n",
                          sandbox.desc().c_str());
        }
      }
    }
  }
}
Exemple #2
0
std::string DebuggerProxy::requestAuthToken() {
  Lock lock(m_signalMutex);
  TRACE_RB(2, "DebuggerProxy::requestauthToken: sending auth request\n");

  // Try to use the current sandbox's path, defaulting to the path from
  // DebuggerDefaultSandboxPath if the current sandbox path is empty.
  auto sandboxPath = getSandbox().m_path;
  if (sandboxPath.empty()) {
    sandboxPath = RuntimeOption::DebuggerDefaultSandboxPath;
  }

  CmdAuth cmd;
  cmd.setSandboxPath(sandboxPath);
  if (!cmd.onServer(*this)) {
    TRACE_RB(2, "DebuggerProxy::requestAuthToken: "
             "Failed to send CmdAuth to client\n");
    return "";
  }

  DebuggerCommandPtr res;
  while (!DebuggerCommand::Receive(m_thrift, res,
                                   "DebuggerProxy::requestAuthToken()")) {
    checkStop();
  }
  if (!res) {
    TRACE_RB(2, "DebuggerProxy::requestAuthToken: "
             "Failed to get CmdAuth back from client\n");
    return "";
  }

  auto token = std::dynamic_pointer_cast<CmdAuth>(res);
  if (!token) {
    TRACE_RB(2, "DebuggerProxy::requestAuthToken: "
             "bad response from token request: %d", res->getType());
    return "";
  }

  return token->getToken();
}