Crashlog: Re-use BFD instances for the same object

This commit is contained in:
Jonathan G Rennison
2024-02-02 20:06:44 +00:00
parent fcc6529b6a
commit a4c14171a7
4 changed files with 51 additions and 17 deletions

View File

@@ -29,9 +29,23 @@
#undef PACKAGE_VERSION
#endif
#include <map>
#if defined(WITH_BFD)
struct sym_info_bfd;
void lookup_addr_bfd(const char *obj_file_name, sym_info_bfd &info);
struct sym_bfd_obj {
bfd *abfd = nullptr;
asymbol **syms = nullptr;
const char *file_name = nullptr;
long sym_count = 0;
bool usable = false;
~sym_bfd_obj();
};
struct sym_bfd_obj_cache {
std::map<std::string, sym_bfd_obj> cache;
};
struct sym_info_bfd {
bfd_vma addr;
@@ -45,9 +59,10 @@ struct sym_info_bfd {
bool found;
sym_info_bfd(bfd_vma addr_);
~sym_info_bfd();
};
void lookup_addr_bfd(const char *obj_file_name, sym_bfd_obj_cache &bfdc, sym_info_bfd &info);
#endif
#endif /* CRASHLOG_BFD_H */