[Pdbg] [PATCH 3/3] istep: Run all sub-steps if minor is 0

Alistair Popple alistair at popple.id.au
Thu Jul 11 15:41:43 AEST 2019


Better than my shell script :-)

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

On Thursday, 4 July 2019 6:11:33 PM AEST Amitay Isaacs wrote:
> Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
> ---
>  src/istep.c | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/src/istep.c b/src/istep.c
> index a141a31..a04c45d 100644
> --- a/src/istep.c
> +++ b/src/istep.c
> @@ -36,6 +36,7 @@ static int istep(uint32_t major, uint32_t minor)
>  {
>  	struct pdbg_target *sbefifo;
>  	int count = 0, i, rc;
> +	int first = minor, last = minor;
> 
>  	for_each_path_target_class("sbefifo", sbefifo) {
>  		if (pdbg_target_status(sbefifo) == PDBG_TARGET_ENABLED)
> @@ -56,6 +57,12 @@ static int istep(uint32_t major, uint32_t minor)
>  		if (istep_data[i].major != major)
>  			continue;
> 
> +		if (minor == 0) {
> +			first = istep_data[i].minor_first;
> +			last = istep_data[i].minor_last;
> +			break;
> +		}
> +
>  		if (minor < istep_data[i].minor_first ||
>  		    minor > istep_data[i].minor_last) {
>  			fprintf(stderr, "Istep %d minor should be %d to %d\n",
> @@ -66,10 +73,15 @@ static int istep(uint32_t major, uint32_t minor)
>  		}
>  	}
> 
> -	rc = sbe_istep(sbefifo, major, minor);
> -	if (!rc)
> -		count++;
> +	for (i = first; i <= last ; i++) {
> +		printf("Running istep %d.%d\n", major, i);
> +		rc = sbe_istep(sbefifo, major, i);
> +		if (rc)
> +			goto fail;
> +	}
> +	count++;
> 
> +fail:
>  	return count;
>  }
>  OPTCMD_DEFINE_CMD_WITH_ARGS(istep, istep, (DATA32, DATA32));






More information about the Pdbg mailing list