Re: [PATCH 1/3] scripts/gdb/tasks: Fix lx-ps command error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2023-11-27 at 13:03 +0100, Oleg Nesterov wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  On 11/27, Kuan-Ying Lee wrote:
> >
> > @@ -25,13 +25,9 @@ def task_lists():
> >      t = g = init_task
> >  
> >      while True:
> > -        while True:
> > -            yield t
> > -
> > -            t = utils.container_of(t['thread_group']['next'],
> > -                                   task_ptr_type, "thread_group")
> > -            if t == g:
> > -                break
> > +        thread_head = t['signal']['thread_head']
> > +        for thread in lists.list_for_each_entry(thread_head,
> task_ptr_type, 'thread_node'):
> > +            yield thread
> >  
> >          t = g = utils.container_of(g['tasks']['next'],
> >                                     task_ptr_type, "tasks")
> 
> Thanks!
> 
> I do not know python, but it seems that with this patch we can kill g
> or t?
> Can't
> 
> def task_lists():
>     task_ptr_type = task_type.get_type().pointer()
>     init_task = gdb.parse_and_eval("init_task").address
>     t = init_task
> 
>     while True:
> thread_head = t['signal']['thread_head']
> for thread in lists.list_for_each_entry(thread_head, task_ptr_type,
> 'thread_node'):
>     yield thread
> 
> t = utils.container_of(t['tasks']['next'],
>        task_ptr_type, "tasks")
> if t == init_task:
>     return
> 
> work?

Yes, you are right.
I will fix it in v2.

Thanks,
Kuan-Ying Lee
> 
> Oleg.
> 




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux