def METHOD_NAME(prog, subdir):
    """ Walk tree, run gcov, process output """
    for root, dirs, files in os.walk(subdir):
        for i in exclude:
            if i in dirs:
                dirs.remove(i)
        if " ".join(files).find(".gcda") == -1:
            continue
        for fn in files:
            if fn[-2:] != ".o":
                continue
            # if we find the .o file in a .../.libs the sources
            # must be found relative to the parent directory
            if "varnishd" in root:
                subdir = root.split("/")[-1]
                cmd = ["cd " + root + "/.. && " + "exec " + prog + " " + subdir + "/" + fn]
                rpath = "/../"
            elif root[-6:] == "/.libs":
                cmd = ["cd " + root + "/.. && " + "exec " + prog + " .libs/" + fn]
                rpath = "/../"
            else:
                cmd = ["cd " + root + " && " + "exec " + prog + " " + fn]
                rpath = "/"
            x = subprocess.check_output(
                    cmd,
                    stderr=subprocess.STDOUT, shell=True,
                    universal_newlines=True)
            pf = ""
            for ln in x.split("\n"):
                if "such file" in ln:
                    print("LN", ln)
                    assert "such file" not in ln
                ln = ln.split()
                if not ln:
                    continue
                if ln[0].find("reating") != -1:
                    gn = root + rpath + ln[1].strip("'")
                    gn = os.path.normpath(gn)
                    assert gn[-5:] == ".gcov"
                    sn = gn[:-5]
                    process_gcov(gn, sn)