[Pdbg] [PATCH] main: Select only the targets specified on cmdline

Michael Neuling mikey at neuling.org
Tue Jul 3 17:09:18 AEST 2018


I think this solves the same problem as my patch here:

https://lists.ozlabs.org/pipermail/pdbg/2018-July/000531.html

I think my solution is probably better since it init's [cpt]_list correctly
rather than making them rely on [cpt]_count. YMMV

Mikey

On Mon, 2018-07-02 at 14:11 +1000, Amitay Isaacs wrote:
> This fixes the problem of incorrectly selecting threads for following
> command-line without any thread specification.
> 
>    pdbg -p 0 -c 0 ...
> 
> Before iterating through [pct]_list, confirm that [pct]_count > 0.
> 
> Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
> ---
>  src/main.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/src/main.c b/src/main.c
> index 53e1c2b..4956740 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -379,18 +379,27 @@ static bool parse_options(int argc, char *argv[])
>  		return false;
>  	}
>  
> +	if (p_count == 0)
> +		return true;
> +
>  	for (i = 0; i < MAX_PROCESSORS; i++) {
>  		if (p_list[i] == 0)
>  			continue;
>  
>  		processorsel[i] = &chipsel[i][0];
>  
> +		if (c_count == 0)
> +			continue;
> +
>  		for (j = 0; j < MAX_CHIPS; j++) {
>  			if (c_list[j] == 0)
>  				continue;
>  
>  			chipsel[i][j] = &threadsel[i][j][0];
>  
> +			if (t_count == 0)
> +				continue;
> +
>  			for (k = 0; k < MAX_THREADS; k++) {
>  				if (t_list[k] == 0)
>  					continue;
> -- 
> 2.17.1
> 


More information about the Pdbg mailing list