Пример #1
0
void CmdInstrument::readFromTable(DebuggerProxy &proxy) {
  proxy.readInjTablesFromThread();
  m_ips.clear();
  if (!proxy.getInjTables()) {
    // nothing there
    return;
  }
  // Bytecode address
  InjectionTableInt64* tablePC =
    proxy.getInjTables()->getInt64Table(InstHookTypeBCPC);
  if (tablePC) {
    for (InjectionTableInt64::const_iterator it = tablePC->begin();
         it != tablePC->end(); ++it) {
      const Injection* inj = it->second;
      InstPointInfoPtr ipi(new InstPointInfo());
      ipi->m_valid = true;
      if (inj->m_desc) {
        ipi->m_desc = inj->m_desc->data();
      }
      ipi->m_locType = InstPointInfo::LocFileLine;
      // TODO use pc to figure out m_file and m_line
      // uchar* pc = (uchar*)it->first;
      m_ips.push_back(ipi);
    }
  }
  InjectionTableSD* tableFEntry =
    proxy.getInjTables()->getSDTable(InstHookTypeFuncEntry);
  if (tableFEntry) {
    for (InjectionTableSD::const_iterator it = tableFEntry->begin();
         it != tableFEntry->end(); ++it) {
      const Injection* inj = it->second;
      InstPointInfoPtr ipi(new InstPointInfo());
      ipi->m_valid = true;
      if (inj->m_desc) {
        ipi->m_desc = inj->m_desc->data();
      }
      ipi->m_func = it->first->data();
      ipi->m_locType = InstPointInfo::LocFuncEntry;
      m_ips.push_back(ipi);
    }
  }
}