def gdb(fips_dir, proj_dir, cfg_name, target=None, target_args=None) :
    """debug a single target with gdb"""

    # prepare
    proj_name = util.get_project_name_from_dir(proj_dir)
    util.ensure_valid_project_dir(proj_dir)

    # load the config(s)
    configs = config.load(fips_dir, proj_dir, cfg_name)
    if configs :
        for cfg in configs :
            # check if config is valid
            config_valid, _ = config.check_config_valid(fips_dir, proj_dir, cfg, print_errors = True)
            if config_valid :
                deploy_dir = util.get_deploy_dir(fips_dir, proj_name, cfg)
                log.colored(log.YELLOW, "=== gdb: {}".format(cfg['name']))
                cmdLine = ['gdb', "-ex", "run", "--args", target]
                if target_args :
                    cmdLine.extend(target_args)
                try:
                    subprocess.call(args = cmdLine, cwd = deploy_dir)
                except __HOLE__ :
                    log.error("Failed to execute gdb (not installed?)")
            else :
                log.error("Config '{}' not valid in this environment".format(cfg['name']))
    else :
        log.error("No valid configs found for '{}'".format(cfg_name))

    return True

#-------------------------------------------------------------------------------
dataset/ETHPy150Open floooh/fips/verbs/gdb.py/gdb