void CmdInstrument::validateAndWriteToTable(DebuggerProxy &proxy) { if (!proxy.getInjTables()) { proxy.setInjTables(new InjectionTables()); } InjectionTableInt64* tablePC = nullptr; InjectionTableSD* tableFEntry = nullptr; for (int i = 0; i < (int)m_ips.size(); i++) { InstPointInfoPtr ipi = m_ips[i]; const Injection* inj = InjectionCache::GetInjection(ipi->m_code, ipi->m_desc); if (!inj) { // error in the code continue; } if (ipi->m_locType == InstPointInfo::LocHere || ipi->m_locType == InstPointInfo::LocFileLine) { // bytecode address const uchar *pc = ipi->lookupPC(); if (pc == nullptr) { continue; } if (tablePC == nullptr) { tablePC = new InjectionTableInt64(); } ipi->m_valid = true; (*tablePC)[(int64_t)pc] = inj; } if (ipi->m_locType == InstPointInfo::LocFuncEntry) { StackStringData sd(ipi->m_func.c_str(), ipi->m_func.size(), AttachLiteral); const StringData* sdCache = InjectionCache::GetStringData(&sd); if (tableFEntry == nullptr) { tableFEntry = new InjectionTableSD(); } ipi->m_valid = true; (*tableFEntry)[sdCache] = inj; } } proxy.getInjTables()->setInt64Table(InstHookTypeBCPC, tablePC); proxy.getInjTables()->setSDTable(InstHookTypeFuncEntry, tableFEntry); proxy.writeInjTablesToThread(); }