bool BinaryEdit::getAllDependencies(std::map<std::string, BinaryEdit*>& deps) { Symtab *symtab = mobj->parse_img()->getObject(); std::deque<std::string> depends; depends.insert(depends.end(), symtab->getDependencies().begin(), symtab->getDependencies().end()); while(!depends.empty()) { std::string lib = depends.front(); if(deps.find(lib) == deps.end()) { std::map<std::string, BinaryEdit*> res; if(!openResolvedLibraryName(lib, res)) return false; std::map<std::string, BinaryEdit*>::iterator bedit_it; for(bedit_it = res.begin(); bedit_it != res.end(); ++bedit_it) { if (bedit_it->second) { deps.insert(*bedit_it); if(!bedit_it->second->getAllDependencies(deps)) { return false; } } else { return false; } } } depends.pop_front(); } return true; }
void SymtabAPISymbols::getDepenentLibs(const std::string& objname, std::vector<std::string>& dependencies) { Symtab *symtab; bool err = Symtab::openFile(symtab, objname); if (symtab) { dependencies = symtab->getDependencies(); } }
bool BinaryEdit::isMultiThreadCapable() { Symtab *symtab = mobj->parse_img()->getObject(); std::vector<std::string> depends = symtab->getDependencies(); for (std::vector<std::string>::iterator curDep = depends.begin(); curDep != depends.end(); curDep++) { if( (curDep->find("libpthread") != std::string::npos) || (curDep->find("libthread") != std::string::npos) || (curDep->find("libthr") != std::string::npos) ) { return true; } } return archSpecificMultithreadCapable(); }