lkml.org 
[lkml]   [2012]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 13/13] scripts/gdb: Add lx_current convenience function
Date
From: Jan Kiszka <jan.kiszka@siemens.com>

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

diff --git a/scripts/gdb/percpu.py b/scripts/gdb/percpu.py
index 6e24400..ecf72b6 100644
--- a/scripts/gdb/percpu.py
+++ b/scripts/gdb/percpu.py
@@ -59,3 +59,18 @@ class PerCpu(gdb.Function):
return per_cpu(var_name.string(), 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):
+ return per_cpu("current_task", cpu).dereference()
+
+LxCurrentFunc()
--
1.7.3.4


\
 
 \ /
  Last update: 2012-10-03 13:41    [W:0.611 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site