aboutsummaryrefslogtreecommitdiff
path: root/scripts/gdb/linux/tasks.py
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2016-07-06 07:25:55 -0700
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2016-07-06 07:25:55 -0700
commitea1a25c3348abc33d7d94db28501766adf3d1c7d (patch)
treeca3c5c8b72532117034dd2d57a2a85eead13db7b /scripts/gdb/linux/tasks.py
parent5e7ff2ca7f2da55fe777167849d0c93403bd0dc8 (diff)
parent262e2bfd7d1e1f1ee48b870e5dfabb87c06b975e (diff)
Merge branch 'jejb-fixes' into fixes
Diffstat (limited to 'scripts/gdb/linux/tasks.py')
-rw-r--r--scripts/gdb/linux/tasks.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/gdb/linux/tasks.py b/scripts/gdb/linux/tasks.py
index 862a4ae24d49..1bf949c43b76 100644
--- a/scripts/gdb/linux/tasks.py
+++ b/scripts/gdb/linux/tasks.py
@@ -114,3 +114,22 @@ variable."""
LxThreadInfoFunc()
+
+
+class LxThreadInfoByPidFunc (gdb.Function):
+ """Calculate Linux thread_info from task variable found by pid
+
+$lx_thread_info_by_pid(PID): Given PID, return the corresponding thread_info
+variable."""
+
+ def __init__(self):
+ super(LxThreadInfoByPidFunc, self).__init__("lx_thread_info_by_pid")
+
+ def invoke(self, pid):
+ task = get_task_by_pid(pid)
+ if task:
+ return get_thread_info(task.dereference())
+ else:
+ raise gdb.GdbError("No task of PID " + str(pid))
+
+LxThreadInfoByPidFunc()