Exemplo n.º 1
0
bool CmdPrint::onClient(DebuggerClient *client) {
  if (DebuggerCommand::onClient(client)) return true;
  if (client->argCount() == 0) {
    return help(client);
  }

  bool watch = false;
  int index = 1;
  if (client->arg(1, "always")) {
    watch = true;
    index++;
  } else if (client->arg(1, "list")) {
    return processList(client);
  } else if (client->arg(1, "clear")) {
    return processClear(client);
  }

  const char *format = NULL;
  for (const char **fmt = Formats; *fmt; fmt++) {
    if (client->arg(index, *fmt)) {
      format = *fmt;
      index++;
      break;
    }
  }
  m_body = client->argRest(index);
  if (watch) {
    client->addWatch(format, m_body);
  }
  processWatch(client, format, m_body);
  return true;
}
Exemplo n.º 2
0
bool CmdPrint::onClient(DebuggerClient *client) {
  if (DebuggerCommand::onClient(client)) return true;
  if (client->argCount() == 0) {
    return help(client);
  }

  bool watch = false;
  int index = 1;
  if (client->arg(1, "always")) {
    if (client->argCount() == 1) {
      client->error("'[p]rint [a]lways' needs an expression to watch.");
      return true;
    }
    watch = true;
    index++;
  } else if (client->arg(1, "list")) {
    return processList(client);
  } else if (client->arg(1, "clear")) {
    return processClear(client);
  }

  const char *format = NULL;
  for (const char **fmt = Formats; *fmt; fmt++) {
    if (client->arg(index, *fmt)) {
      format = *fmt;
      index++;
      break;
    }
  }
  m_body = client->argRest(index);
  m_bypassAccessCheck = client->getBypassAccessCheck();
  m_printLevel = client->getPrintLevel();
  ASSERT(m_printLevel <= 0 || m_printLevel >= DebuggerClient::MinPrintLevel);
  if (watch) {
    client->addWatch(format, m_body);
  }
  processWatch(client, format, m_body);
  return true;
}