From 73843fa6348e0114a2bbdd76624e8059d6acdb1a Mon Sep 17 00:00:00 2001 From: Michael Lenz Date: Wed, 26 Feb 2014 10:54:02 +0100 Subject: [PATCH] import-trace: help sports all available importers This change extends import-trace's help functionality for importers, adds the ?-operator to option "-i" and refactors main.cc a little. The extensions are "doing something useful with the AliasedRegistry" and are merely listings of all importers' prime aliases. Change-Id: I7bb184fc45dd9f90664e37455edfccc704d99ef1 --- tools/import-trace/main.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/import-trace/main.cc b/tools/import-trace/main.cc index 903009b7..9259b612 100644 --- a/tools/import-trace/main.cc +++ b/tools/import-trace/main.cc @@ -101,9 +101,10 @@ int main(int argc, char *argv[]) { CommandLine::option_handle BENCHMARK = cmd.addOption("b", "benchmark", Arg::Required, "-b/--benchmark \tBenchmark label (default: \"none\")\n"); - CommandLine::option_handle IMPORTER = - cmd.addOption("i", "importer", Arg::Required, - "-i/--importer \tWhich import method to use (default: MemoryImporter)"); + + std::string importer_help = "-i/--importer \tWhich import method to use (default: MemoryImporter); available import methods: " + importers; + CommandLine::option_handle IMPORTER = cmd.addOption("i", "importer", Arg::Required, importer_help); + CommandLine::option_handle ELF_FILE = cmd.addOption("e", "elf-file", Arg::Required, "-e/--elf-file \tELF File (default: UNSET)"); @@ -154,7 +155,10 @@ int main(int argc, char *argv[]) { // try and get the according importer object ; die on failure if ((importer = (Importer *)registry.get(imp)) == 0) { - LOG << "Unknown import method: " << imp << endl; + if (imp != "?" ) { + std::cerr << "Unknown import method: " << imp << std::endl; + } + std::cerr << "Available import methods: " << importers << std::endl; exit(-1); }