diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2020-01-15 12:45:39 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2020-01-15 12:48:27 +0300 |
commit | 78288d961ed0fac526404b7d3f198514beafe7d7 (patch) | |
tree | de62767efa98b4f59e4f7b6b5abab7441f2f933a /src | |
parent | lab_rat: namespace the functions (diff) | |
download | winapi-debug-78288d961ed0fac526404b7d3f198514beafe7d7.tar.gz winapi-debug-78288d961ed0fac526404b7d3f198514beafe7d7.zip |
enum_symbols: support symbol mask using --mask
Diffstat (limited to '')
-rw-r--r-- | src/dbghelp.cpp | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/src/dbghelp.cpp b/src/dbghelp.cpp index 8268673..399271e 100644 --- a/src/dbghelp.cpp +++ b/src/dbghelp.cpp @@ -73,6 +73,18 @@ BOOL CALLBACK enum_symbols_callback(SYMBOL_INFO* info, ULONG, VOID* raw_callback return TRUE; } +void enum_symbols(HANDLE id, + Address module_base, + const std::string& mask, + const DbgHelp::OnSymbol& callback) { + if (!SymEnumSymbols(id, + module_base, + mask.c_str(), + &enum_symbols_callback, + const_cast<DbgHelp::OnSymbol*>(&callback))) + throw error::windows(GetLastError()); +} + } // namespace DbgHelp::DbgHelp() { @@ -120,20 +132,22 @@ void DbgHelp::enum_modules(const OnModule& callback) const { throw error::windows(GetLastError()); } +void DbgHelp::enum_symbols(const ModuleInfo& module, + const std::string& mask, + const OnSymbol& callback) const { + pdb::enum_symbols(id, module.get_offline_base(), mask, callback); +} + void DbgHelp::enum_symbols(const ModuleInfo& module, const OnSymbol& callback) const { - if (!SymEnumSymbols(id, - module.get_offline_base(), - NULL, - &enum_symbols_callback, - const_cast<OnSymbol*>(&callback))) - throw error::windows(GetLastError()); + enum_symbols(module, all_symbols, callback); +} + +void DbgHelp::enum_symbols(const std::string& mask, const OnSymbol& callback) const { + pdb::enum_symbols(id, 0, mask, callback); } void DbgHelp::enum_symbols(const OnSymbol& callback) const { - static constexpr auto all_symbols = "*!*"; - if (!SymEnumSymbols( - id, 0, all_symbols, &enum_symbols_callback, const_cast<OnSymbol*>(&callback))) - throw error::windows(GetLastError()); + enum_symbols(all_symbols, callback); } SymbolInfo DbgHelp::resolve_symbol(Address offline) const { |