コード例 #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);
    }
  }
}
コード例 #2
0
InjectionTables* InjectionTables::clone() {
    InjectionTables* newTables = new InjectionTables();
    for (int i = 0; i < InstHookTypeInt64Count; i++) {
        InjectionTableInt64* table = m_int64Tables[i];
        if (!table) {
            newTables->m_int64Tables[i] = nullptr;
            continue;
        }
        InjectionTableInt64* newTable = new InjectionTableInt64();
        newTable->insert(table->begin(), table->end());
        newTables->m_int64Tables[i] = newTable;
    }
    for (int i = 0; i < InstHookTypeSDCount; i++) {
        InjectionTableSD* table = m_sdTables[i];
        if (!table) {
            newTables->m_sdTables[i] = nullptr;
            continue;
        }
        InjectionTableSD* newTable = new InjectionTableSD();
        newTable->insert(table->begin(), table->end());
        newTables->m_sdTables[i] = newTable;
    }
    return newTables;
}