Пример #1
0
def AddPinKnobsGDB(options):
    """
    Add pin knobs (not pintool knobs) needed when running with GDB.

    @return string of knobs
    """

    kit_type, base_dir = util.GetKitType()
    pin_knobs = ''

    # Add the string '-p' for each Pin option for SDE
    #
    if kit_type == config.PINPLAY:
        p = ''
    elif kit_type == config.SDE:
        p = '-p'

    # If user gives a port to use for GDB, then format the appdebug string to use it
    #
    if options.debug_port:
        pin_knobs += ' %s -appdebug %s -appdebug_silent %s -appdebug_server_port %s %s' % (
            p, p, p, p, options.debug_port)
    else:
        pin_knobs += ' %s -appdebug' % p

    return pin_knobs
Пример #2
0
def AddPinKnobsGDB():
    """
    Add pin knobs (not pintool knobs) needed when running with GDB.

    @return string of knobs
    """

    kit_type, base_dir = util.GetKitType()

    pin_knobs = ''
    if kit_type == config.PINPLAY:
        pin_knobs += ' -appdebug'
    elif kit_type == config.SDE:
        pin_knobs += ' -p -appdebug'

    return pin_knobs
Пример #3
0
def GdbBaseLogOpt():
    """
    Get the DrDebug specific logging options.  When using GDB, there are additional
    knobs required in addition to the basic logging knobs.

    NOTE: SDE requires the pintool to be explicitly given on the command line when
    runnning with GDB.  Normally, the pintool isn't required for SDE.

    @return string with knobs for logging
    """

    kit_type, base_dir = util.GetKitType()
    if kit_type == config.PINPLAY:
        kit_knobs = ' -log:controller_default_start 0'
    else:
        kit_knobs = ' -t sde-pinplay-driver.so  -controller_default_start 0'
    log_opts = config.drdebug_base_log_options + kit_knobs + \
                ' -gdb:cmd_file ' + config.gdb_cmd_file

    return log_opts
Пример #4
0
def DrDebugScriptCmd(script, pin_knobs, options):
    """
    Format the initial section of the script command line, including the
    appropriate script, used to execute the DrDebug low level scripts.  It formats
    commands for both logging and replay.  The parameter 'script' determines the
    'base' of the script to execute.

    The type of kit from which the script is called deterimines the specific
    lower level scripts to be called called.  If called are from an SDE kit,
    the string 'sde_' is prepended to the base script name.

    Also generate the explicit path to the directory in the specific kit
    where the scripts are located.

    @param script Base name of a lower level script to be run by current script
    @param pin_knobs List of Pin knobs (not pintool) used when running low level script
    @param options Options given on cmd line

    @return tuple with:
    @return     - string with command to run
    @return     - path to scripts in kit
    """

    # Get the type of kit from which the script was executed and print
    # out this info if desired.
    #
    # import pdb;  pdb.set_trace()
    kit_type, base_dir = util.GetKitType()
    if (hasattr(options, 'verbose') and options.verbose):
        string = 'Dir where was script found indicates kit type: '
        if kit_type == config.PINPLAY:
            string += 'PinPlay'
        elif kit_type == config.SDE:
            string += 'SDE'
        else:
            string += 'Unknown '
        string += ', located at: ' + base_dir
        msg.PrintMsg(string)

    # Add the appropriate 'home' directory for the kit to the command line.  If
    # user has given 'home' directory, then use it instead.
    #
    kit_knob = ''
    if kit_type == config.PINPLAY:
        if config.pinplayhome:
            kit_knob += ' --pinplayhome ' + config.pinplayhome
        else:
            kit_knob += ' --pinplayhome ' + base_dir
        kit_script_path = os.path.join(base_dir, config.pin_script_path)
    elif kit_type == config.SDE:
        script = 'sde_' + script
        if config.sdehome:
            kit_knob += ' --sdehome ' + config.sdehome
        else:
            kit_knob += ' --sdehome ' + base_dir
        kit_script_path = os.path.join(base_dir, config.sde_script_path)
    else:
        # Should never get here as error checking already taken care of in
        # GetKitType()
        #
        pass
    if (hasattr(options, 'verbose') and options.verbose):
        msg.PrintMsg('Kit knob actually used: ' + kit_knob)

    # Start formatting command by adding the required Pin/SDE knobs.
    #
    cmd = script
    if kit_type == config.PINPLAY:
        popts = '-follow_execv'
    elif kit_type == config.SDE:
        popts = '-p -follow_execv'
    popts += pin_knobs

    # Add any user defined 'pin_options'
    #
    if hasattr(options, 'pin_options') and options.pin_options:
        popts += ' ' + options.pin_options
    cmd += ' --pin_options "%s"' % (popts)

    # If use has given a pintool, add it & format final cmd
    #
    # import pdb;  pdb.set_trace()
    if hasattr(options, 'pintool') and options.pintool:
        cmd += ' --pintool ' + options.pintool
    cmd += kit_knob

    return cmd, kit_script_path