1 /** 2 * @file common_option.h 3 * Declaration of entry point of pp tools, implementation file add common 4 * options of pp tools and some miscelleaneous functions 5 * 6 * @remark Copyright 2003 OProfile authors 7 * @remark Read the file COPYING 8 * 9 * @author John Levon 10 * @author Philippe Elie 11 */ 12 13 #ifndef COMMON_OPTION_H 14 #define COMMON_OPTION_H 15 16 #include <vector> 17 #include <list> 18 19 #include "arrange_profiles.h" 20 #include "demangle_symbol.h" 21 22 namespace options { 23 extern bool verbose; 24 extern double threshold; 25 extern std::string threshold_opt; 26 extern std::string command_options; 27 extern std::vector<std::string> image_path; 28 extern std::string root_path; 29 30 struct spec { 31 std::list<std::string> common; 32 std::list<std::string> first; 33 std::list<std::string> second; 34 }; 35 } 36 37 /** 38 * prototype of a pp tool entry point. This entry point is called 39 * by run_pp_tool 40 */ 41 typedef int (*pp_fct_run_t)(options::spec const & spec); 42 43 /** 44 * @param argc command line number of argument 45 * @param argv command line argument pointer array 46 * @param fct function to run to start this pp tool 47 * 48 * Provide a common entry to all pp tools, parsing all options, handling 49 * common options and providing the necessary try catch clause 50 */ 51 int run_pp_tool(int argc, char const * argv[], pp_fct_run_t fct); 52 53 /** 54 * @param option one of [smart,none,normal] 55 * 56 * return the demangle_type of option or throw an exception if option 57 * is not valid. 58 */ 59 demangle_type handle_demangle_option(std::string const & option); 60 61 /** 62 * @param mergespec merge option 63 * @param allow_lib is merge)lib allowed in mergespec 64 * @param exclude_dependent user specified --exclude-dependent 65 * 66 * parse merge option and return a merge_option filled from it. 67 * 68 */ 69 merge_option handle_merge_option(std::vector<std::string> const & mergespec, 70 bool allow_lib, bool exclude_dependent); 71 72 #endif /* !COMMON_OPTION_H */ 73