Skip to content

Commit

Permalink
scripts/gdb/linux/tasks.py: fix get_thread_info
Browse files Browse the repository at this point in the history
Since kernel 4.9, the thread_info has been moved into task_struct, no
longer locates at the bottom of kernel stack.

See commits c65eacb ("sched/core: Allow putting thread_info into
task_struct") and 15f4eae ("x86: Move thread_info into
task_struct").

Before fix:
  (gdb) set $current = $lx_current()
  (gdb) p $lx_thread_info($current)
  $1 = {flags = 1470918301}
  (gdb) p $current.thread_info
  $2 = {flags = 2147483648}

After fix:
  (gdb) p $lx_thread_info($current)
  $1 = {flags = 2147483648}
  (gdb) p $current.thread_info
  $2 = {flags = 2147483648}

Link: http://lkml.kernel.org/r/[email protected]
Fixes: 15f4eae ("x86: Move thread_info into task_struct")
Signed-off-by: Xi Kangjie <[email protected]>
Acked-by: Jan Kiszka <[email protected]>
Acked-by: Kieran Bingham <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
consen authored and torvalds committed Jan 19, 2018
1 parent be9fa66 commit 883d50f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions scripts/gdb/linux/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ def get_thread_info(task):
thread_info_addr = task.address + ia64_task_size
thread_info = thread_info_addr.cast(thread_info_ptr_type)
else:
if task.type.fields()[0].type == thread_info_type.get_type():
return task['thread_info']
thread_info = task['stack'].cast(thread_info_ptr_type)
return thread_info.dereference()

Expand Down

0 comments on commit 883d50f

Please sign in to comment.