aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/gdb/linux/cpus.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/gdb/linux/cpus.py')
-rw-r--r--scripts/gdb/linux/cpus.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py
index 18337e01ddef..b683da92f194 100644
--- a/scripts/gdb/linux/cpus.py
+++ b/scripts/gdb/linux/cpus.py
@@ -66,3 +66,20 @@ Note that VAR has to be quoted as string."""
66 66
67 67
68PerCpu() 68PerCpu()
69
70
71class LxCurrentFunc(gdb.Function):
72 """Return current task.
73
74$lx_current([CPU]): Return the per-cpu task variable for the given CPU
75number. If CPU is omitted, the CPU of the current context is used."""
76
77 def __init__(self):
78 super(LxCurrentFunc, self).__init__("lx_current")
79
80 def invoke(self, cpu=-1):
81 var_ptr = gdb.parse_and_eval("&current_task")
82 return per_cpu(var_ptr, cpu).dereference()
83
84
85LxCurrentFunc()