[PATCH] scripts/gdb: fix aarch64 userspace detection in get_current_task
From: Jan Kiszka
Date: Fri Jan 10 2025 - 05:37:15 EST
From: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
At least recent gdb releases (seen with 14.2) return SP_EL0 as signed
long which lets the right-shift always return 0.
Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
---
scripts/gdb/linux/cpus.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py
index 2f11c4f9c345..13eb8b3901b8 100644
--- a/scripts/gdb/linux/cpus.py
+++ b/scripts/gdb/linux/cpus.py
@@ -167,7 +167,7 @@ def get_current_task(cpu):
var_ptr = gdb.parse_and_eval("&pcpu_hot.current_task")
return per_cpu(var_ptr, cpu).dereference()
elif utils.is_target_arch("aarch64"):
- current_task_addr = gdb.parse_and_eval("$SP_EL0")
+ current_task_addr = gdb.parse_and_eval("(unsigned long)$SP_EL0")
if (current_task_addr >> 63) != 0:
current_task = current_task_addr.cast(task_ptr_type)
return current_task.dereference()
--
2.43.0