* [PATCH] scripts/gdb: add lx_current support for riscv
@ 2023-02-22 9:28 Song Shuai
0 siblings, 0 replies; only message in thread
From: Song Shuai @ 2023-02-22 9:28 UTC (permalink / raw)
To: jan.kiszka, kbingham, paul.walmsley, palmer, aou
Cc: linux-kernel, linux-riscv, Song Shuai
RISC-V uses the tp register to save the current task_struct address
as its current() defines. So lx_current() of riscv just returns the
dereference of the address cast via task_ptr_type.
Signed-off-by: Song Shuai <suagrfillet@gmail.com>
---
scripts/gdb/linux/cpus.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py
index 15fc4626d236..b382016552e5 100644
--- a/scripts/gdb/linux/cpus.py
+++ b/scripts/gdb/linux/cpus.py
@@ -173,6 +173,9 @@ def get_current_task(cpu):
else:
raise gdb.GdbError("Sorry, obtaining the current task is not allowed "
"while running in userspace(EL0)")
+ elif utils.is_target_arch("riscv"):
+ current_task_addr = gdb.parse_and_eval("$tp")
+ return current_task_addr.cast(task_ptr_type).dereference();
else:
raise gdb.GdbError("Sorry, obtaining the current task is not yet "
"supported with this arch")
--
2.20.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-22 9:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-22 9:28 [PATCH] scripts/gdb: add lx_current support for riscv Song Shuai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®