openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/pdbg/2.2+gitAUTOINC+dbbb35af95-r0/git/libpdbg/target.c
enum pdbg_target_status pdbg_target_probe(struct pdbg_target* target)
{
    struct pdbg_target* parent;
    enum pdbg_target_status status;

    assert(target);

    status = pdbg_target_status(target);
    assert(status != PDBG_TARGET_RELEASED);

    if (status == PDBG_TARGET_DISABLED || status == PDBG_TARGET_NONEXISTENT ||
        status == PDBG_TARGET_ENABLED)
        /* We've already tried probing this target and by assumption
         * it's status won't have changed */
        return status;

    parent = target->parent;
    if (parent)
    {
        /* Recurse up the tree to probe and set parent target status */
        pdbg_target_probe(parent);
        status = pdbg_target_status(parent);
        switch (status)
        {
            case PDBG_TARGET_NONEXISTENT:
                /* The parent doesn't exist neither does it's
                 * children */
                target->status = PDBG_TARGET_NONEXISTENT;
                return PDBG_TARGET_NONEXISTENT;

            case PDBG_TARGET_DISABLED:
                /* The parent is disabled, we know nothing of the child
                 * so leave it in it's current state unless it must
                 * exist.
                 * TODO: Must exist error reporting */
                assert(pdbg_target_status(target) != PDBG_TARGET_MUSTEXIST);
                return pdbg_target_status(target);

            case PDBG_TARGET_RELEASED:
            case PDBG_TARGET_MUSTEXIST:
            case PDBG_TARGET_UNKNOWN:
                /* We must know by now if the parent exists or not */
                assert(0);
                break;

            case PDBG_TARGET_ENABLED:
                break;
        }
    }

    /* At this point any parents must exist and have already been probed */
    if (target->probe && target->probe(target))
    {
        /* Could not find the target */
        assert(pdbg_target_status(target) != PDBG_TARGET_MUSTEXIST);
        target->status = PDBG_TARGET_NONEXISTENT;
        return PDBG_TARGET_NONEXISTENT;
    }

    target->status = PDBG_TARGET_ENABLED;
    return PDBG_TARGET_ENABLED;
}
/* We walk the tree root down disabling targets which might/should
 * exist but don't */
We walk the tree root down disabling targets which might/should
exist but don't
We walk the tree root down disabling targets which might / should exist but don ' t
enum pdbg_target_status pdbg_target_probe(struct pdbg_target* target)
{
    struct pdbg_target* parent;
    enum pdbg_target_status status;
    assert(target);
    status = pdbg_target_status(target);
    assert(status != PDBG_TARGET_RELEASED);
    if (status == PDBG_TARGET_DISABLED || status == PDBG_TARGET_NONEXISTENT ||
        status == PDBG_TARGET_ENABLED)
        return status;
    parent = target->parent;
    if (parent)
    {
        pdbg_target_probe(parent);
        status = pdbg_target_status(parent);
        switch (status)
        {
            case PDBG_TARGET_NONEXISTENT:
                target->status = PDBG_TARGET_NONEXISTENT;
                return PDBG_TARGET_NONEXISTENT;
            case PDBG_TARGET_DISABLED:
                assert(pdbg_target_status(target) != PDBG_TARGET_MUSTEXIST);
                return pdbg_target_status(target);
            case PDBG_TARGET_RELEASED:
            case PDBG_TARGET_MUSTEXIST:
            case PDBG_TARGET_UNKNOWN:
                assert(0);
                break;
            case PDBG_TARGET_ENABLED:
                break;
        }
    }
    if (target->probe && target->probe(target))
    {
        assert(pdbg_target_status(target) != PDBG_TARGET_MUSTEXIST);
        target->status = PDBG_TARGET_NONEXISTENT;
        return PDBG_TARGET_NONEXISTENT;
    }
    target->status = PDBG_TARGET_ENABLED;
    return PDBG_TARGET_ENABLED;
}
enum pdbg_target_status pdbg_target_probe ( struct pdbg_target * target ) { struct pdbg_target * parent ; enum pdbg_target_status status ; assert ( target ) ; status = pdbg_target_status ( target ) ; assert ( status != PDBG_TARGET_RELEASED ) ; if ( status == PDBG_TARGET_DISABLED || status == PDBG_TARGET_NONEXISTENT || status == PDBG_TARGET_ENABLED ) return status ; parent = target -> parent ; if ( parent ) { pdbg_target_probe ( parent ) ; status = pdbg_target_status ( parent ) ; switch ( status ) { case PDBG_TARGET_NONEXISTENT : target -> status = PDBG_TARGET_NONEXISTENT ; return PDBG_TARGET_NONEXISTENT ; case PDBG_TARGET_DISABLED : assert ( pdbg_target_status ( target ) != PDBG_TARGET_MUSTEXIST ) ; return pdbg_target_status ( target ) ; case PDBG_TARGET_RELEASED : case PDBG_TARGET_MUSTEXIST : case PDBG_TARGET_UNKNOWN : assert ( 0 ) ; break ; case PDBG_TARGET_ENABLED : break ; } } if ( target -> probe && target -> probe ( target ) ) { assert ( pdbg_target_status ( target ) != PDBG_TARGET_MUSTEXIST ) ; target -> status = PDBG_TARGET_NONEXISTENT ; return PDBG_TARGET_NONEXISTENT ; } target -> status = PDBG_TARGET_ENABLED ; return PDBG_TARGET_ENABLED ; }
We walk the tree root down disabling targets which might/should
 exist but don't
We walk the tree root down disabling targets which might / should exist but don ' t
/* We've already tried probing this target and by assumption
         * it's status won't have changed */ /* Recurse up the tree to probe and set parent target status */ /* The parent doesn't exist neither does it's
                 * children */ /* The parent is disabled, we know nothing of the child
                 * so leave it in it's current state unless it must
                 * exist.
                 * TODO: Must exist error reporting */ /* We must know by now if the parent exists or not */ /* At this point any parents must exist and have already been probed */ /* Could not find the target */