[Pdbg] [PATCH 8/8] libpdbg: Update thread state when starting/stopping all threads

Amitay Isaacs amitay at ozlabs.org
Tue Oct 13 17:37:17 AEDT 2020


On Fri, 2020-10-09 at 12:47 +0000, Joel Stanley wrote:
> On Fri, 9 Oct 2020 at 04:00, Amitay Isaacs <amitay at ozlabs.org> wrote:
> > Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
> > ---
> >  libpdbg/sbefifo.c | 36 +++++++++++++++++++++++++++++++++---
> >  1 file changed, 33 insertions(+), 3 deletions(-)
> > 
> > diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c
> > index fae2ab7..a8e4522 100644
> > --- a/libpdbg/sbefifo.c
> > +++ b/libpdbg/sbefifo.c
> > @@ -263,12 +263,32 @@ static int sbefifo_pib_thread_op(struct pib
> > *pib, uint32_t oper)
> > 
> >  static int sbefifo_pib_thread_start(struct pib *pib)
> >  {
> > -       return sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_START);
> > +       struct pdbg_target *target;
> > +       int rc;
> > +
> > +       rc = sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_START);
> > +
> > +       pdbg_for_each_target("thread", &pib->target, target) {
> > +               struct thread *thread = target_to_thread(target);
> > +               thread->status = thread->state(thread);
> > +       }
> 
> You could have a update_thread_state(struct pib *pib) to save
> duplicating this three times.

Good point. :-)

> 
> Either way,
> 
> Reviewed-by: Joel Stanley <joel at jms.id.au>
> 

Amitay.
-- 

The secret of the universe is @*&^^^  NO CARRIER



More information about the Pdbg mailing list