[Pdbg] [RFC 10/12] libpdbg: Make probe result matches the backend status
Amitay Isaacs
amitay at ozlabs.org
Tue Aug 20 14:07:17 AEST 2019
We don't need this.
On Tue, 2019-08-06 at 11:37 +1000, Alistair Popple wrote:
> If a target has a backend assigned make sure the status reflects the
> status of the selected backend.
>
> Signed-off-by: Alistair Popple <alistair at popple.id.au>
> ---
> libpdbg/target.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/libpdbg/target.c b/libpdbg/target.c
> index 73ad98f..d6604c2 100644
> --- a/libpdbg/target.c
> +++ b/libpdbg/target.c
> @@ -402,15 +402,16 @@ enum pdbg_target_status
> pdbg_target_probe(struct pdbg_target *target)
> }
>
> /* 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);
> + if (target->backend && target->backend->probe && target-
> >backend->probe(target->backend))
> + target->backend->status = target->status =
> PDBG_TARGET_NONEXISTENT;
> + else if (target->probe && target->probe(target))
> target->status = PDBG_TARGET_NONEXISTENT;
> - return PDBG_TARGET_NONEXISTENT;
> - }
> + else
> + target->status = PDBG_TARGET_ENABLED;
> +
> + assert(target->status != PDBG_TARGET_NONEXISTENT && target-
> >status != PDBG_TARGET_MUSTEXIST);
>
> - target->status = PDBG_TARGET_ENABLED;
> - return PDBG_TARGET_ENABLED;
> + return target->status;
> }
>
> /* Releases a target by first recursively releasing all its children
> */
> --
> 2.20.1
>
Amitay.
--
Clothes do not make a man ... but never take a chance.
More information about the Pdbg
mailing list