Re: [PATCH 1/3] scripts/gdb/tasks: Fix lx-ps command error
From: Oleg Nesterov
Date: Mon Nov 27 2023 - 07:04:34 EST
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?
Oleg.