Beispiel #1
0
def load_all_plugins(cmd):
    cmd = rcs_utils.load_all_plugins(cmd)
    cmd = rcs_utils.load_plugin(cmd, 'libDynAAUtils')
    cmd = rcs_utils.load_plugin(cmd, 'DynAAAnalyses')
    cmd = rcs_utils.load_plugin(cmd, 'DynAACheckers')
    cmd = rcs_utils.load_plugin(cmd, 'DynAAInstrumenters')
    return cmd
Beispiel #2
0
def load_all_plugins(cmd):
    cmd = rcs_utils.load_all_plugins(cmd)
    cmd = rcs_utils.load_plugin(cmd, 'libDynAAUtils')
    cmd = rcs_utils.load_plugin(cmd, 'libDynAAAnalyses')
    cmd = rcs_utils.load_plugin(cmd, 'libDynAACheckers')
    cmd = rcs_utils.load_plugin(cmd, 'libDynAAInstrumenters')
    cmd = rcs_utils.load_plugin(cmd, 'libDynAATransforms')
    return cmd
Beispiel #3
0
import os
import sys
import rcs_utils

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description = 'Look up value ID by ' + \
                                                   'name or vice versa')
    parser.add_argument('--func', type = str,
                        help = 'function name. Leave it blank if you are ' + \
                                'looking for a global value')
    parser.add_argument('--value', type=str, help='value name')
    parser.add_argument('--vid', type=int, help='value id')
    parser.add_argument('--iid', type=int, help='instruction id')
    parser.add_argument('bc', help='the bitcode file')
    args = parser.parse_args()

    cmd = rcs_utils.load_all_plugins('opt')
    cmd = ' '.join((cmd, '-lookup-id'))
    if args.vid is not None:
        cmd = ' '.join((cmd, '-value-id', str(args.vid)))
    elif args.iid is not None:
        cmd = ' '.join((cmd, '-ins-id', str(args.iid)))
    else:
        assert args.value is not None
        if not args.func is None:
            cmd = ' '.join((cmd, '-func-name', args.func))
        cmd = ' '.join((cmd, '-value-name', args.value))
    cmd = ' '.join((cmd, '-disable-output', '<', args.bc))

    rcs_utils.invoke(cmd)
Beispiel #4
0
    parser.add_argument('bc', help = 'the bitcode of the program')
    aa_choices = ['tbaa', 'basicaa', 'no-aa', 'ds-aa', 'anders-aa', 'bc2bdd-aa']
    parser.add_argument('aa',
            help = 'the underlying alias analysis: ' + str(aa_choices),
            metavar = 'aa',
            choices = aa_choices)
    parser.add_argument('id1', help = 'the first ID', type = int)
    parser.add_argument('id2', help = 'the second ID', type = int)
    parser.add_argument('--ins', action = 'store_true',
            help = 'Set it if <id1> and <id2> are instruction IDs ' \
                    'instead of value IDs (default: false)')
    parser.add_argument('--debug', action = 'store_true',
            help = 'Set it if you want debug output (default: false)')
    args = parser.parse_args()

    cmd = rcs_utils.load_all_plugins('opt')
    # Some AAs require additional plugins.
    # TODO: Should be specified in a configuration file.
    if args.aa == 'ds-aa':
        cmd = rcs_utils.load_plugin(cmd, 'LLVMDataStructure')
        # cmd = string.join((cmd, '-debug'))
    elif args.aa == 'anders-aa':
        cmd = rcs_utils.load_plugin(cmd, 'RCSAndersens')
    elif args.aa == 'bc2bdd-aa':
        if not os.path.exists('bc2bdd.conf'):
            sys.stderr.write('\033[1;31m')
            print >> sys.stderr, 'Error: bc2bdd-aa requires bc2bdd.conf, ' \
                    'which cannot be found in the current directory.'
            sys.stderr.write('\033[m')
            sys.exit(1)
        cmd = rcs_utils.load_plugin(cmd, 'bc2bdd')
Beispiel #5
0
import argparse
import os
import sys
import rcs_utils

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Look up value ID by " + "name or vice versa")
    parser.add_argument(
        "--func", type=str, help="function name. Leave it blank if you are " + "looking for a global value"
    )
    parser.add_argument("--value", type=str, help="value name")
    parser.add_argument("--vid", type=int, help="value id")
    parser.add_argument("--iid", type=int, help="instruction id")
    parser.add_argument("bc", help="the bitcode file")
    args = parser.parse_args()

    cmd = rcs_utils.load_all_plugins("opt")
    cmd = " ".join((cmd, "-lookup-id"))
    if args.vid is not None:
        cmd = " ".join((cmd, "-value-id", str(args.vid)))
    elif args.iid is not None:
        cmd = " ".join((cmd, "-ins-id", str(args.iid)))
    else:
        assert args.value is not None
        if not args.func is None:
            cmd = " ".join((cmd, "-func-name", args.func))
        cmd = " ".join((cmd, "-value-name", args.value))
    cmd = " ".join((cmd, "-disable-output", "<", args.bc))

    rcs_utils.invoke(cmd)