def ParseCommandLine(self): """ Parse command line arguments. @return tuple with: @return - options dictionary @return - parser for command line """ version = '$Revision: 1.11 $' version = version.replace(' ', '') ver = version.replace(' $', '') us, desc = self.GetHelpParams() parser = optparse.OptionParser( usage=us, description=desc, version=ver, formatter=cmd_options.BlankLinesIndentedHelpFormatter()) # Define the command line options which control the behavior of the # script. Some of these methods take a 2nd argument which is the empty # string ''. If the script uses option groups, then this parameter is # the group. However, this script does not use option groups, so the # argument is empty. # drd_util.debug(parser) cmd_options.arch(parser, '') cmd_options.cross_os(parser, '') cmd_options.pin_options(parser) cmd_options.pintool_help(parser) cmd_options.pintool_options(parser) cmd_options.pintool(parser) cmd_options.verbose(parser) # import pdb; pdb.set_trace() (options, args) = parser.parse_args() # Read in configuration files and set global variables. # No requirment to read in a config file, but it's OK # to give one. # config_obj = config.ConfigClass() config_obj.GetCfgGlobals(options, False) # No, don't need required parameters # If user just wants 'pintool_help', don't look for command line # but instead return from this function. # if not (hasattr(options, 'pintool_help') and options.pintool_help): # Get the binary and arguments to run in 'options.command' # and the old. May also get new pinball name if necessary. # replay_pb, log_pb = self.GetArgs(args, parser, options) return options, replay_pb, log_pb else: return options, None, None
def ParseCommandLine(self): """ Parse command line arguments, including the binary/options to log. @return tuple with: @return - options dictionary @return - parser for command line """ version = '$Revision: 1.23 $' version = version.replace(' ', '') ver = version.replace(' $', '') us, desc = self.GetHelpParams() parser = optparse.OptionParser( usage=us, description=desc, version=ver, formatter=cmd_options.BlankLinesIndentedHelpFormatter()) # Define the command line options which control the behavior of the # script. Some of these methods take a 2nd argument which is the empty # string ''. If the script uses option groups, then this parameter is # the group. However, this script does not use option groups, so the # argument is empty. # drd_util.debug(parser) cmd_options.arch(parser, '') cmd_options.config_file(parser) cmd_options.log_file(parser) cmd_options.mp_type(parser, '') cmd_options.pid(parser) cmd_options.pin_options(parser) cmd_options.pintool_help(parser) cmd_options.pintool_options(parser) cmd_options.pintool(parser) cmd_options.single_thread(parser) cmd_options.verbose(parser) # import pdb; pdb.set_trace() (options, args) = parser.parse_args() # Read in configuration files and set global variables. # No requirment to read in a config file, but it's OK # to give one. # config_obj = config.ConfigClass() config_obj.GetCfgGlobals(options, False) # No, don't need required parameters if not options.single_thread: if options.mp_type == 'mpi': opt_mode = config.MPI_MT_MODE elif options.mp_type == 'mp': opt_mode = config.MP_MT_MODE else: opt_mode = config.MT_MODE else: if options.mp_type == 'mpi': opt_mode = config.MPI_MODE elif options.mp_type == 'mp': opt_mode = config.MP_MODE else: opt_mode = config.ST_MODE setattr(options, 'mode', opt_mode) # If user just wants 'pintool_help', don't look for command line # but instead return from this function. # if not (hasattr(options, 'pintool_help') and options.pintool_help): # Get the binary and arguments to run in 'options.command' # self.GetArgs(args, parser, options) return options, parser