예제 #1
0
    if path_to_addr2line == "":
        path_to_addr2line = which_func("addr2line")
        if path_to_addr2line is None:
            print(
                "ERROR: addr2line not found in path and not hardcoded, cannot resolve addresses to lines without it."
            )
            print(
                "       Please put addr2line in your path or update the path_to_addr2line variable in this script."
            )
            exit(1)

    target_filename = sys.argv[1]
    covdir = sys.argv[2]

    bv = bncov.get_bv(target_filename, quiet=False)
    original_filepath = bv.file.original_filename
    if not os.path.exists(original_filepath):
        print(
            "ERROR: Original file %s not found (often due to a .bndb with a stale path)"
            % original_filepath)
        print(
            "       This script requires the original target and that it has debug symbols."
        )
        exit(1)

    covdb = bncov.get_covdb(bv, covdir, quiet=False)

    uncovered_calls = get_uncovered_calls(covdb)
    any_source_found = False
    for i, item in enumerate(uncovered_calls.items()):
예제 #2
0
if __name__ == "__main__":
    if len(sys.argv) not in [3, 4, 5]:
        print(USAGE)
        exit(1)

    target_filename = sys.argv[1]
    seed_dir = os.path.normpath(sys.argv[2])
    coverage_dir = seed_dir + "-cov"
    output_dir = seed_dir + "-bmin"
    if len(sys.argv) >= 4:
        coverage_dir = os.path.normpath(sys.argv[3])
    if len(sys.argv) == 5:
        output_dir = os.path.normpath(sys.argv[4])

    script_start = time.time()
    bv = bncov.get_bv(target_filename)
    covdb = bncov.get_covdb(bv, coverage_dir)

    seed_paths = [
        os.path.join(seed_dir, filename) for filename in os.listdir(seed_dir)
    ]
    seed_sizes = {
        seed_path: os.path.getsize(seed_path)
        for seed_path in seed_paths
    }
    coverage_to_seed = {}
    seed_to_coverage = {}
    for trace_path in covdb.trace_dict.keys():
        trace_name = os.path.basename(trace_path)
        if trace_name.endswith('.cov') is False:
            print(