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 /utils/enum_symbols.cpp | |
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-- | utils/enum_symbols.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/utils/enum_symbols.cpp b/utils/enum_symbols.cpp index 87cc56a..d7f4c37 100644 --- a/utils/enum_symbols.cpp +++ b/utils/enum_symbols.cpp @@ -27,10 +27,12 @@ public: "functions", po::value<pdb::symbol::Tag>(&tag)->implicit_value(function_tag)->zero_tokens(), "only list functions"); + visible.add_options()( + "mask", po::value<std::string>(&symbol_mask)->value_name("MASK"), "symbol mask"); } const char* get_short_description() const override { - return "[-h|--help] [--pdb PATH]... [--functions]"; + return "[-h|--help] [--pdb PATH]... [--functions] [--mask MASK]"; } std::vector<std::string> pdbs; @@ -39,11 +41,14 @@ public: pdb::Symbol::Type get_type() const { return static_cast<pdb::Symbol::Type>(tag); } + std::string get_mask() const { return symbol_mask; } + private: static constexpr auto reserved_tag = static_cast<pdb::symbol::Tag>(pdb::Symbol::Type::RESERVED); static constexpr auto function_tag = static_cast<pdb::symbol::Tag>(pdb::Symbol::Type::Function); pdb::symbol::Tag tag = reserved_tag; + std::string symbol_mask{pdb::DbgHelp::all_symbols}; }; constexpr pdb::symbol::Tag EnumSymbols::reserved_tag; @@ -72,7 +77,7 @@ int main(int argc, char* argv[]) { for (const auto& pdb : settings.pdbs) { const auto id = dbghelp.load_pdb(pdb); - dbghelp.enum_symbols(id, [&](const pdb::SymbolInfo& symbol) { + dbghelp.enum_symbols(id, settings.get_mask(), [&](const pdb::SymbolInfo& symbol) { if (!settings.type_specified() || settings.get_type() == symbol.get_type()) std::cout << symbol.get_name() << '\n'; }); |