aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/utils/addr2name.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/addr2name.cpp')
-rw-r--r--utils/addr2name.cpp53
1 files changed, 17 insertions, 36 deletions
diff --git a/utils/addr2name.cpp b/utils/addr2name.cpp
index 76e781d..87206f2 100644
--- a/utils/addr2name.cpp
+++ b/utils/addr2name.cpp
@@ -24,51 +24,32 @@ namespace
{
public:
explicit Addr2Name(const std::string& argv0)
- : SettingsParser{argv0, build_options(), build_args()}
- { }
-
- bool exit_with_usage() const { return help_flag; }
-
- const char* get_short_description() const override
- {
- return "[-h|--help] [--pdb ADDR,PATH]... [--] [ADDR]...";
- }
-
- std::vector<PDB> pdbs;
- std::vector<pdb::Address> addresses;
- bool lines = false;
-
- private:
- Options build_options()
+ : SettingsParser{argv0}
{
- namespace program_options = boost::program_options;
- Options descr{"options"};
- descr.add_options()
- ("help,h",
- program_options::bool_switch(&help_flag),
- "show this message and exit")
+ visible.add_options()
("pdb",
- program_options::value<std::vector<PDB>>(&pdbs)
+ boost::program_options::value<std::vector<PDB>>(&pdbs)
->value_name("ADDR,PATH"),
"load a PDB file")
- ("address",
- program_options::value<std::vector<pdb::Address>>(&addresses)
- ->value_name("ADDR"),
- "add an address to resolve")
("lines,l",
- program_options::bool_switch(&lines),
+ boost::program_options::bool_switch(&lines),
"try to resolve source files & line numbers");
- return descr;
+ hidden.add_options()
+ ("address",
+ boost::program_options::value<std::vector<pdb::Address>>(&addresses)
+ ->value_name("ADDR"),
+ "add an address to resolve");
+ positional.add("address", -1);
}
- static Arguments build_args()
+ const char* get_short_description() const override
{
- Arguments descr;
- descr.add("address", -1);
- return descr;
+ return "[-h|--help] [--pdb ADDR,PATH]... [--] [ADDR]...";
}
- bool help_flag = false;
+ std::vector<PDB> pdbs;
+ std::vector<pdb::Address> addresses;
+ bool lines = false;
};
std::string format_symbol(const pdb::Module& module, const pdb::Symbol& symbol)
@@ -130,7 +111,7 @@ int main(int argc, char* argv[])
{
try
{
- const Addr2Name settings{argv[0]};
+ Addr2Name settings{argv[0]};
try
{
@@ -142,7 +123,7 @@ int main(int argc, char* argv[])
return 1;
}
- if (settings.exit_with_usage())
+ if (settings.exit_with_usage)
{
settings.usage();
return 0;