static bfd_cache_ptr get_bfd_cache(const char *filename) { bfdMap::const_iterator iter = s_bfds.find(filename); if (iter != s_bfds.end()) { return iter->second; } bfd_cache_ptr p(new bfd_cache()); if (fill_bfd_cache(filename, p.get())) { p.reset(); } s_bfds[filename] = p; return p; }
static bfd_cache_ptr get_bfd_cache(const char *filename) { bfdMap::const_iterator iter = s_bfds.find(filename); if (iter != s_bfds.end()) { return iter->second; } bfd_cache_ptr p(new bfd_cache()); bfd *abfd = bfd_openr(filename, NULL); if (abfd) { p->abfd = abfd; p->syms = NULL; char **match; if (bfd_check_format(abfd, bfd_archive) || !bfd_check_format_matches(abfd, bfd_object, &match) || !slurp_symtab(&p->syms, abfd)) { bfd_close(abfd); p.reset(); } } else { p.reset(); } s_bfds[filename] = p; return p; }