mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 05:31:08 -04:00
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 <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Jason Wessel <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Ben Widawsky <[email protected]>
Cc: Borislav Petkov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
1 parent
fe7f9ed98d
commit
116b47b4da
1 file changed
+17
@@ -66,3 +66,20 @@ Note that VAR has to be quoted as string."""
|
||||
|
||||
|
||||
PerCpu()
|
||||
|
||||
|
||||
class LxCurrentFunc(gdb.Function):
|
||||
"""Return current task.
|
||||
|
||||
$lx_current([CPU]): Return the per-cpu task variable for the given CPU
|
||||
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()
|
||||
Reference in new issue
Block a user