scripts/gdb: add lx_current support for riscv
Subsystems (2)
PATCH 1/1 scripts/gdb: add lx_current support for riscv
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 <[email protected]>
--- scripts/gdb/linux/cpus.py | 3 +++ 1 file changed, 3 insertions(+)
scripts/gdb/linux/cpus.py +3 -0
@@ -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")
Signature · 1 line
2.20.1