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

Kuan-Ying Lee (李冠穎) Kuan-Ying.Lee at mediatek.com
Tue Nov 28 03:45:20 PST 2023


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.
> 


More information about the linux-arm-kernel mailing list