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.kis...@siemens.com>
---
 scripts/gdb/percpu.py |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/scripts/gdb/percpu.py b/scripts/gdb/percpu.py
index 864962c..4dab8d3 100644
--- a/scripts/gdb/percpu.py
+++ b/scripts/gdb/percpu.py
@@ -59,3 +59,19 @@ class PerCpu(gdb.Function):
                return per_cpu(var_ptr, cpu)
 
 PerCpu()
+
+
+class LxCurrentFunc(gdb.Function):
+       __doc__ = "Return current task.\n" \
+                 "\n" \
+                 "$lx_current([CPU]): Return the per-cpu task variable for the 
given CPU\n" \
+                 "number. If CPU is omitted, the CPU of the current context is 
used."
+
+       def __init__(self):
+               super(LxCurrentFunc, self).__init__("lx_current")
+
+       def invoke(self, cpu = -1):
+               var_ptr = gdb.parse_and_eval("&current_task")
+               return per_cpu(var_ptr, cpu).dereference()
+
+LxCurrentFunc()
-- 
1.7.3.4


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Kgdb-bugreport mailing list
Kgdb-bugreport@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to