aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2017-05-20 02:01:14 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2017-05-20 02:01:14 +0300
commitcb914bca29e8066f3be61e8c3e1f828329a8608d (patch)
tree921290b7c5a40175051fd04d4fc6b65b281841de /src
parentcommon.cmake update (diff)
downloadwinapi-debug-cb914bca29e8066f3be61e8c3e1f828329a8608d.tar.gz
winapi-debug-cb914bca29e8066f3be61e8c3e1f828329a8608d.zip
don't load multiple PDBs with the same base
Diffstat (limited to 'src')
-rw-r--r--src/repo.cpp13
1 files changed, 13 insertions, 0 deletions
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;
}