From 78288d961ed0fac526404b7d3f198514beafe7d7 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 15 Jan 2020 12:45:39 +0300 Subject: enum_symbols: support symbol mask using --mask --- utils/enum_symbols.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'utils') 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(&tag)->implicit_value(function_tag)->zero_tokens(), "only list functions"); + visible.add_options()( + "mask", po::value(&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 pdbs; @@ -39,11 +41,14 @@ public: pdb::Symbol::Type get_type() const { return static_cast(tag); } + std::string get_mask() const { return symbol_mask; } + private: static constexpr auto reserved_tag = static_cast(pdb::Symbol::Type::RESERVED); static constexpr auto function_tag = static_cast(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'; }); -- cgit v1.2.3