Messages in this thread Patch in this message |  | | From | Jan Kiszka <> | Subject | [PATCH v5 17/20] scripts/gdb: Add lx_current convenience function | Date | Tue, 29 Jan 2013 13:38:00 +0100 |
| |
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 | 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("¤t_task") + return per_cpu(var_ptr, cpu).dereference() + +LxCurrentFunc() -- 1.7.3.4
|  |