Message ID | 20221111195938.1499148-2-debug@rivosinc.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | gdb-script: updated lx_current for riscv | expand |
Context | Check | Description |
---|---|---|
conchuod/patch_count | success | Link |
conchuod/cover_letter | success | Single patches do not need cover letters |
conchuod/tree_selection | success | Guessed tree name to be for-next |
conchuod/fixes_present | success | Fixes tag not required for -next series |
conchuod/verify_signedoff | success | Signed-off-by tag matches author and committer |
conchuod/kdoc | success | Errors and warnings before: 0 this patch: 0 |
conchuod/module_param | success | Was 0 now: 0 |
conchuod/build_rv32_defconfig | success | Build OK |
conchuod/build_warn_rv64 | success | Errors and warnings before: 0 this patch: 0 |
conchuod/dtb_warn_rv64 | success | Errors and warnings before: 0 this patch: 0 |
conchuod/header_inline | success | No static functions without inline keyword in header files |
conchuod/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 14 lines checked |
conchuod/source_inline | success | Was 0 now: 0 |
conchuod/build_rv64_nommu_k210_defconfig | success | Build OK |
conchuod/verify_fixes | success | No Fixes tag |
conchuod/build_rv64_nommu_virt_defconfig | success | Build OK |
On Fri, Nov 11, 2022 at 11:59:38AM -0800, debug@rivosinc.com wrote: > From: Deepak Gupta <debug@rivosinc.com> > > lx_current python gdb command defined in scripts/gdb/cpus.py updated > to support riscv architecture. The commit which added support for arm64 gave an explanation of why SP_EL0 needed to be checked. Would be nice if you could do the same here for RISC-V. See 526940e39626 ("scripts/gdb: add lx_current support for arm64") for what I mean. While you're at it, "scripts/gdb: add support for RISC-V" would appear to be a more standard $subject for this file. Thanks, Conor. > > Signed-off-by: Deepak Gupta <debug@rivosinc.com> > --- > scripts/gdb/linux/cpus.py | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py > index 15fc4626d236..ce6703f1e35a 100644 > --- a/scripts/gdb/linux/cpus.py > +++ b/scripts/gdb/linux/cpus.py > @@ -173,6 +173,14 @@ 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") > + if((current_task_addr.cast(utils.get_long_type()) >> 63) != 0): > + current_task = current_task_addr.cast(task_ptr_type) > + return current_task.dereference() > + else: > + raise gdb.GdbError("Sorry, obtaining the current task is not allowed " > + "while running in userspace") > else: > raise gdb.GdbError("Sorry, obtaining the current task is not yet " > "supported with this arch") > -- > 2.25.1 >
On Fri, Nov 11, 2022 at 11:59:38AM -0800, debug@rivosinc.com wrote: > From: Deepak Gupta <debug@rivosinc.com> > > lx_current python gdb command defined in scripts/gdb/cpus.py updated > to support riscv architecture. > > Signed-off-by: Deepak Gupta <debug@rivosinc.com> > --- > scripts/gdb/linux/cpus.py | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py > index 15fc4626d236..ce6703f1e35a 100644 > --- a/scripts/gdb/linux/cpus.py > +++ b/scripts/gdb/linux/cpus.py > @@ -173,6 +173,14 @@ 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") > + if((current_task_addr.cast(utils.get_long_type()) >> 63) != 0): Shouldn't there be a get_long_type().sizeof == 8 check somewhere before shifting by 63? Or are 32-bit targets not supported at all for some reason? Thanks, drew > + current_task = current_task_addr.cast(task_ptr_type) > + return current_task.dereference() > + else: > + raise gdb.GdbError("Sorry, obtaining the current task is not allowed " > + "while running in userspace") > else: > raise gdb.GdbError("Sorry, obtaining the current task is not yet " > "supported with this arch") > -- > 2.25.1 > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv
On Sun, Nov 13, 2022 at 12:13:40AM +0000, Conor Dooley wrote: > On Fri, Nov 11, 2022 at 11:59:38AM -0800, debug@rivosinc.com wrote: > > From: Deepak Gupta <debug@rivosinc.com> > > > > lx_current python gdb command defined in scripts/gdb/cpus.py updated > > to support riscv architecture. > > The commit which added support for arm64 gave an explanation of why > SP_EL0 needed to be checked. Would be nice if you could do the same here > for RISC-V. See 526940e39626 ("scripts/gdb: add lx_current support for > arm64") for what I mean. > > While you're at it, "scripts/gdb: add support for RISC-V" would appear Realised I omitted a word there, sorry: s/add support/add lx_current support/ > to be a more standard $subject for this file. > > Thanks, > Conor. > > > > > Signed-off-by: Deepak Gupta <debug@rivosinc.com> > > --- > > scripts/gdb/linux/cpus.py | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py > > index 15fc4626d236..ce6703f1e35a 100644 > > --- a/scripts/gdb/linux/cpus.py > > +++ b/scripts/gdb/linux/cpus.py > > @@ -173,6 +173,14 @@ 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") > > + if((current_task_addr.cast(utils.get_long_type()) >> 63) != 0): > > + current_task = current_task_addr.cast(task_ptr_type) > > + return current_task.dereference() > > + else: > > + raise gdb.GdbError("Sorry, obtaining the current task is not allowed " > > + "while running in userspace") > > else: > > raise gdb.GdbError("Sorry, obtaining the current task is not yet " > > "supported with this arch") > > -- > > 2.25.1 > >
diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py index 15fc4626d236..ce6703f1e35a 100644 --- a/scripts/gdb/linux/cpus.py +++ b/scripts/gdb/linux/cpus.py @@ -173,6 +173,14 @@ 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") + if((current_task_addr.cast(utils.get_long_type()) >> 63) != 0): + current_task = current_task_addr.cast(task_ptr_type) + return current_task.dereference() + else: + raise gdb.GdbError("Sorry, obtaining the current task is not allowed " + "while running in userspace") else: raise gdb.GdbError("Sorry, obtaining the current task is not yet " "supported with this arch")