[Pdbg] [PATCH v4 16/30] libpdbg: Probe should traverse virtual nodes also

Amitay Isaacs amitay at ozlabs.org
Wed Oct 9 15:33:25 AEDT 2019


On Wed, 2019-10-09 at 15:16 +1100, Alistair Popple wrote:
> > +	/* Make sure any virtual nodes are also probed */
> > +	vnode = target_to_virtual(target);
> > +	if (vnode && vnode != target)
> > +		pdbg_target_probe(vnode);
> 
> Personally I think it might be clearer and less surprising if 
> target_to_virtual/real() returned NULL in cases when they can't find
> a target 
> of the correct type. That way any future callers are forced to think
> about 
> what to do in those cases.
> 
> - Alistair

May be I can add a "strict" argument to those functions.  In that case,
for a target which does not have a mapped virtual target,

  target_to_virtual(target, true) --> NULL
  target_to_virtual(target, false) --> target

The function will return NULL if it strict is true.  And will return
the same target.

This takes care of both cases.  Well there is only a single instance of
the second case (strict == true), but in future there may be more.


> 
> >  	/* At this point any parents must exist and have already been
> > probed */
> >  	if (target->probe && target->probe(target)) {
> >  		/* Could not find the target */
> > 
> 
> 
> 

Amitay.
-- 

Give me ambiguity or give me something else.



More information about the Pdbg mailing list