[Pdbg] [PATCH 06/23] libpdbg: Construct unique path based on virtual nodes

Alistair Popple alistair at popple.id.au
Thu Sep 19 13:13:36 AEST 2019


Correct, although I guess advanced users can always specify the path based on 
backend so I suppose at some point we might need an API to discover that. But 
I can't think of a need for one at the moment.

Reviewed-by: Alistair Popple <alistair at popple.id.au>

On Thursday, 19 September 2019 12:33:16 PM AEST Amitay Isaacs wrote:
> Even though there can be two different paths to a node, libpdbg users
> should always see the path as defined in system device tree (view) which
> is the same and independent of the backend device tree.
> 
> Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
> ---
>  libpdbg/device.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/libpdbg/device.c b/libpdbg/device.c
> index e4dc5c7..ce88609 100644
> --- a/libpdbg/device.c
> +++ b/libpdbg/device.c
> @@ -219,6 +219,9 @@ static char *dt_get_path(struct pdbg_target *node)
>  		return strdup("<NULL>");
>  
>  	for (n = node; n; n = n->parent) {
> +		if (n->vnode && n->compatible)
> +			n = n->vnode;
> +
>  		len += strlen(n->dn_name);
>  		if (n->parent || n == node)
>  			len++;
> @@ -227,6 +230,9 @@ static char *dt_get_path(struct pdbg_target *node)
>  	assert(path);
>  	p = path + len;
>  	for (n = node; n; n = n->parent) {
> +		if (n->vnode && n->compatible)
> +			n = n->vnode;
> +
>  		len = strlen(n->dn_name);
>  		p -= len;
>  		memcpy(p, n->dn_name, len);
> 






More information about the Pdbg mailing list