[Pdbg] [PATCH] libpdbg: Add an api to get target address by class
Amitay Isaacs
amitay at ozlabs.org
Mon Nov 5 12:15:25 AEDT 2018
On Tue, 2018-10-23 at 14:35 +1100, Alistair Popple wrote:
> Signed-off-by: Alistair Popple <alistair at popple.id.au>
> ---
> libpdbg/libpdbg.h | 1 +
> libpdbg/target.c | 10 ++++++++++
> 2 files changed, 11 insertions(+)
>
> diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h
> index b1d6655..ce11fff 100644
> --- a/libpdbg/libpdbg.h
> +++ b/libpdbg/libpdbg.h
> @@ -91,6 +91,7 @@ const char *pdbg_target_dn_name(struct pdbg_target
> *target);
> void *pdbg_target_priv(struct pdbg_target *target);
> void pdbg_target_priv_set(struct pdbg_target *target, void *priv);
> struct pdbg_target *pdbg_target_root(void);
> +struct pdbg_target *pdbg_class_target_addr(struct pdbg_target
> *target, const char *name, uint64_t *addr);
>
> /* Procedures */
> int fsi_read(struct pdbg_target *target, uint32_t addr, uint32_t
> *val);
> diff --git a/libpdbg/target.c b/libpdbg/target.c
> index 975ecec..fbcf792 100644
> --- a/libpdbg/target.c
> +++ b/libpdbg/target.c
> @@ -32,6 +32,16 @@ static struct pdbg_target
> *get_class_target_addr(struct pdbg_target *target, con
> return target;
> }
>
> +struct pdbg_target *pdbg_class_target_addr(struct pdbg_target
> *target, const char *name, uint64_t *addr)
> +{
> + uint64_t tmp;
> +
> + if (!addr)
> + addr = &tmp;
> +
> + return get_class_target_addr(target, name, addr);
> +}
> +
I think this api is badly named. Isn't this same as
parent = pdbg_target_parent(target, name)
pdbg_get_address(parent, &addr)
May be we don't want to add an api that does the same thing as the
combination of existing apis. Unless there is a specific corner case
which is not covered.
Amitay.
--
If there's nothing wrong with me, then there must be something wrong with
the Universe! - Dr. Beverly Crusher (Star Trek: TNG)
More information about the Pdbg
mailing list