From cb914bca29e8066f3be61e8c3e1f828329a8608d Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 20 May 2017 02:01:14 +0300 Subject: don't load multiple PDBs with the same base --- src/repo.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/repo.cpp') diff --git a/src/repo.cpp b/src/repo.cpp index 14a0933..9a06481 100644 --- a/src/repo.cpp +++ b/src/repo.cpp @@ -40,14 +40,27 @@ namespace pdb return it->second; } + + std::string pdb_already_loaded(Address online_base) + { + std::ostringstream oss; + oss << "module with online base address " << format_address + << " has already been loaded"; + return oss.str(); + } } Address Repo::add_pdb(Address online_base, const std::string& path) { + if (online_modules.find(online_base) != online_modules.cend()) + throw std::runtime_error{pdb_already_loaded(online_base)}; + Module module{online_base, dbghelp.load_pdb(path)}; const auto offline_base = module.get_offline_base(); + const auto it = online_modules.emplace(online_base, std::move(module)); offline_modules.emplace(offline_base, it.first->second); + return offline_base; } -- cgit v1.2.3