Esempio n. 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());
        }
      }
    }
  }
}
Esempio n. 2
0
DebuggerProxyPtr Debugger::createProxy(req::ptr<Socket> socket, bool local) {
  TRACE(2, "Debugger::createProxy\n");
  // Creates a proxy and threads needed to handle it. At this point, there is
  // not enough information to attach a sandbox.
  auto proxy = std::make_shared<DebuggerProxy>(socket, local);
  {
    // Place this new proxy into the proxy map keyed on the dummy sandbox id.
    // This keeps the proxy alive in the server case, which drops the result of
    // this function on the floor. It also makes the proxy findable when a
    // dummy sandbox thread needs to interrupt.
    const StringData* sid =
      makeStaticString(proxy->getDummyInfo().id());
    assertx(sid);
    ProxyMap::accessor acc;
    m_proxyMap.insert(acc, sid);
    acc->second = proxy;
  }
  if (!local) {
    proxy->startDummySandbox();
  }
  proxy->startSignalThread();
  return proxy;
}