summaryrefslogtreecommitdiffstats
path: root/scripts/gdb
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2015-02-17 16:47:24 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-17 17:34:54 -0500
commit116b47b4da037547585cebe4e3275ef68905d509 (patch)
tree74c464dcc68c8636cbf5211a335c5651b3de9974 /scripts/gdb
parentfe7f9ed98dad611ceaf17403f1c5bfd016eadcaa (diff)
scripts/gdb: add lx_current convenience function
This is a shorthand for *$lx_per_cpu("current_task"), i.e. a convenience function to retrieve the currently running task of the active context. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Jason Wessel <jason.wessel@windriver.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Ben Widawsky <ben@bwidawsk.net> Cc: Borislav Petkov <bp@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/gdb')
-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()