diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2020-01-15 03:30:56 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2020-01-15 03:35:11 +0300 |
commit | eeac54304af4a06ab9e4e3ce944944a609c68a8a (patch) | |
tree | 1dc85b8464e41c47d7463c5d7fc281628f9995b1 /src | |
parent | add test/ to test, for starters, enum_symbols (diff) | |
download | winapi-debug-eeac54304af4a06ab9e4e3ce944944a609c68a8a.tar.gz winapi-debug-eeac54304af4a06ab9e4e3ce944944a609c68a8a.zip |
refactoring
Diffstat (limited to '')
-rw-r--r-- | src/dbghelp.cpp | 12 | ||||
-rw-r--r-- | src/module.cpp | 16 | ||||
-rw-r--r-- | src/repo.cpp | 12 |
3 files changed, 20 insertions, 20 deletions
diff --git a/src/dbghelp.cpp b/src/dbghelp.cpp index 94fa7ab..26eff79 100644 --- a/src/dbghelp.cpp +++ b/src/dbghelp.cpp @@ -96,7 +96,7 @@ ModuleInfo DbgHelp::load_pdb(const std::string& path) const { ModuleInfo DbgHelp::get_module_info(Address offline_base) const { ModuleInfo info; - if (!SymGetModuleInfo64(id, offline_base, &static_cast<ModuleInfo::Raw&>(info))) + if (!SymGetModuleInfo64(id, offline_base, &static_cast<ModuleInfo::Impl&>(info))) throw error::windows(GetLastError()); return info; @@ -132,16 +132,16 @@ SymbolInfo DbgHelp::resolve_symbol(const std::string& name) const { } LineInfo DbgHelp::resolve_line(Address offline) const { - IMAGEHLP_LINE64 raw; - std::memset(&raw, 0, sizeof(raw)); - raw.SizeOfStruct = sizeof(raw); + IMAGEHLP_LINE64 impl; + std::memset(&impl, 0, sizeof(impl)); + impl.SizeOfStruct = sizeof(impl); DWORD displacement = 0; - if (!SymGetLineFromAddr64(id, offline, &displacement, &raw)) + if (!SymGetLineFromAddr64(id, offline, &displacement, &impl)) throw error::windows(GetLastError()); - return LineInfo{raw}; + return LineInfo{impl}; } } // namespace pdb diff --git a/src/module.cpp b/src/module.cpp index 9f12599..6ee0c08 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -14,18 +14,18 @@ namespace pdb { -ModuleInfo::ModuleInfo() : ModuleInfo{create_raw()} {} +ModuleInfo::ModuleInfo() : ModuleInfo{create_impl()} {} -ModuleInfo::ModuleInfo(const Raw& raw) : raw{raw} { - if (raw.SizeOfStruct != sizeof(raw)) +ModuleInfo::ModuleInfo(const Impl& impl) : impl{impl} { + if (impl.SizeOfStruct != sizeof(impl)) throw std::runtime_error{"invalid IMAGEHLP_MODULE64.SizeOfStruct"}; } -ModuleInfo::Raw ModuleInfo::create_raw() { - Raw raw; - std::memset(&raw, 0, sizeof(raw)); - raw.SizeOfStruct = sizeof(raw); - return raw; +ModuleInfo::Impl ModuleInfo::create_impl() { + Impl impl; + std::memset(&impl, 0, sizeof(impl)); + impl.SizeOfStruct = sizeof(impl); + return impl; } Address Module::translate_offline_address(Address offline) const { diff --git a/src/repo.cpp b/src/repo.cpp index d7f2c74..6ef5252 100644 --- a/src/repo.cpp +++ b/src/repo.cpp @@ -119,8 +119,8 @@ void Repo::enum_symbols(Address offline_base, const OnSymbol& callback) const { } void Repo::enum_symbols(const Module& module, const OnSymbol& callback) const { - dbghelp.enum_symbols(module, - [&](const SymbolInfo& raw) { callback(symbol_from_buffer(module, raw)); }); + dbghelp.enum_symbols( + module, [&](const SymbolInfo& impl) { callback(symbol_from_buffer(module, impl)); }); } Symbol Repo::resolve_symbol(Address online) const { @@ -143,12 +143,12 @@ const Module& Repo::module_with_offline_base(Address base) const { return lookup_module(offline_bases, base); } -Symbol Repo::symbol_from_buffer(const SymbolInfo& raw) const { - return symbol_from_buffer(module_with_offline_base(raw.get_offline_base()), raw); +Symbol Repo::symbol_from_buffer(const SymbolInfo& impl) const { + return symbol_from_buffer(module_with_offline_base(impl.get_offline_base()), impl); } -Symbol Repo::symbol_from_buffer(const Module& module, const SymbolInfo& raw) { - return {module.translate_offline_address(raw.get_offline_address()), raw}; +Symbol Repo::symbol_from_buffer(const Module& module, const SymbolInfo& impl) { + return {module.translate_offline_address(impl.get_offline_address()), impl}; } Address Repo::address_online_to_offline(Address online) const { |