[Pdbg] [PATCH] main: Select only the targets specified on cmdline
Amitay Isaacs
amitay at ozlabs.org
Tue Jul 3 17:50:32 AEST 2018
On Tue, 2018-07-03 at 17:09 +1000, Michael Neuling wrote:
> 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
Sure. :-)
My patch will avoid running through the loop when the whole array is
set to zero.
Amitay.
>
> 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
> >
Amitay.
--
If you look at what you have in life,
You'll always have more.
If you look at what you don't have in life,
You'll never have enough. - Oprah Winfrey
More information about the Pdbg
mailing list