lx_cpu is a convenience function to retrieve the current CPU number.
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
scripts/gdb/linux/cpus.py | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py
index 3e17550cd577..fa05fc30a090 100644
--- a/scripts/gdb/linux/cpus.py
+++ b/scripts/gdb/linux/cpus.py
@@ -119,6 +119,21 @@ def each_active_cpu():
yield cpu
+class LxCpuFunc(gdb.Function):
+ """Return current CPU number.
+
+$lx_cpu(): Return the current CPU number."""
+
+ def __init__(self):
+ super(LxCpuFunc, self).__init__("lx_cpu")
+
+ def invoke(self):
+ return get_current_cpu()
+
+
+LxCpuFunc()
+
+
class LxCpus(gdb.Command):
"""List CPU status arrays
--
2.51.0