def split_debug(src, objcopy=None, objdump=None):
    """ Split the debug information in the `src` binary.

    The debug information will be put in a .debug directory next
    to the executable

    <base_dir>/bin/foo
    <base_dir>/bin/.debug/foo

    Also uses objcopy so that the binaries and libraries still remain
    usable with gdb
    """
    if objcopy is None:
        objcopy = "objcopy"
    if objdump is None:
        objdump = "objdump"
    if not contains_debug_info(src, objdump=objdump):
        ui.info("-- Already stripped", src)
        return
    src_stat = os.stat(src)
    dirname, basename = os.path.split(src)
    debug_dir = os.path.join(dirname, ".debug")
    qisys.sh.mkdir(debug_dir)
    dest = os.path.join(src, debug_dir, basename)
    to_run = list()
    to_run.append([objcopy, "--only-keep-debug", src, dest])
    to_run.append([objcopy, "--strip-debug", "--strip-unneeded",
                            dest % "--add-gnu-debuglink=%s", src])
    try:
        for cmd in to_run:
            qisys.command.check_output(cmd, stderr=subprocess.STDOUT)
        ui.info("-- Debug info extracted for", src)
    except qisys.command.CommandFailedException as e:
        ui.error("Error while extracting debug for %s" % src)
        ui.error(str(e))
    # After the commands have run, utime of the file has changed, causing
    # cmake to re-install the libraries. Which is not cool ...
    # So set back mtime to its previous value:
    os.utime(src, (src_stat.st_atime, src_stat.st_mtime))
dataset/ETHPy150Open aldebaran/qibuild/python/qibuild/gdb.py/split_debug/swapped operands of `%`