diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2020-09-20 00:09:34 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2020-09-20 00:12:50 +0300 |
commit | 1cbd0a3b824d1821549b4c7ede688f500de25443 (patch) | |
tree | d7771d4afeb9609758c9f632674081091f99ed67 /src/dbghelp.cpp | |
parent | pdb::file: use wide WinAPI (diff) | |
download | winapi-debug-1cbd0a3b824d1821549b4c7ede688f500de25443.tar.gz winapi-debug-1cbd0a3b824d1821549b4c7ede688f500de25443.zip |
pdb::error: include function name in error message
Diffstat (limited to '')
-rw-r--r-- | src/dbghelp.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/dbghelp.cpp b/src/dbghelp.cpp index 4b8df7a..c9db499 100644 --- a/src/dbghelp.cpp +++ b/src/dbghelp.cpp @@ -28,12 +28,12 @@ void initialize(HANDLE id, bool invade_current_process) { set_dbghelp_options(); if (!SymInitialize(id, NULL, invade_current_process ? TRUE : FALSE)) - throw error::windows(GetLastError()); + throw error::windows(GetLastError(), "SymInitialize"); } void clean_up(HANDLE id) { if (!SymCleanup(id)) - throw error::windows(GetLastError()); + throw error::windows(GetLastError(), "SymCleanup"); } Address next_offline_base = 0x10000000; @@ -50,7 +50,7 @@ ModuleInfo get_module_info(HANDLE id, Address offline_base) { ModuleInfo info; if (!SymGetModuleInfoW64(id, offline_base, &static_cast<ModuleInfo::Impl&>(info))) - throw error::windows(GetLastError()); + throw error::windows(GetLastError(), "SymGetModuleInfoW64"); return info; } @@ -83,7 +83,7 @@ void enum_symbols(HANDLE id, boost::nowide::widen(mask).c_str(), &enum_symbols_callback, const_cast<DbgHelp::OnSymbol*>(&callback))) - throw error::windows(GetLastError()); + throw error::windows(GetLastError(), "SymEnumSymbolsW"); } } // namespace @@ -135,7 +135,7 @@ ModuleInfo DbgHelp::load_pdb(const std::string& path) const { SymLoadModule64(id, NULL, _path.data(), NULL, gen_next_offline_base(size), size); if (!offline_base) - throw error::windows(GetLastError()); + throw error::windows(GetLastError(), "SymLoadModule64"); return get_module_info(id, offline_base); } @@ -143,7 +143,7 @@ ModuleInfo DbgHelp::load_pdb(const std::string& path) const { void DbgHelp::enum_modules(const OnModule& callback) const { ModuleEnumerator enumerator{id, callback}; if (!SymEnumerateModulesW64(id, &enum_modules_callback, &enumerator)) - throw error::windows(GetLastError()); + throw error::windows(GetLastError(), "SymEnumerateModulesW64"); } ModuleInfo DbgHelp::resolve_module(Address offline) const { @@ -173,7 +173,7 @@ SymbolInfo DbgHelp::resolve_symbol(Address offline) const { SymbolInfo symbol; if (!SymFromAddrW(id, offline, &displacement, &static_cast<SYMBOL_INFOW&>(symbol))) - throw error::windows(GetLastError()); + throw error::windows(GetLastError(), "SymFromAddrW"); symbol.set_displacement(displacement); return symbol; @@ -183,7 +183,7 @@ SymbolInfo DbgHelp::resolve_symbol(const std::string& name) const { SymbolInfo symbol; if (!SymFromNameW(id, boost::nowide::widen(name).c_str(), &static_cast<SYMBOL_INFOW&>(symbol))) - throw error::windows(GetLastError()); + throw error::windows(GetLastError(), "SymFromNameW"); return symbol; } @@ -196,7 +196,7 @@ LineInfo DbgHelp::resolve_line(Address offline) const { DWORD displacement = 0; if (!SymGetLineFromAddrW64(id, offline, &displacement, &impl)) - throw error::windows(GetLastError()); + throw error::windows(GetLastError(), "SymGetLineFromAddrW64"); return LineInfo{impl}; } |