public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: debug@rivosinc.com
Cc: palmer@dabbelt.com, jan.kiszka@siemens.com, kbingham@kernel.org,
	paul.walmsley@sifive.com, aou@eecs.berkeley.edu,
	linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
	linux@rivosinc.com
Subject: Re: [PATCH] gdb-script: updated lx_current for riscv
Date: Sun, 13 Nov 2022 00:13:40 +0000	[thread overview]
Message-ID: <Y3A2tPFbqcf1DPr5@spud> (raw)
In-Reply-To: <20221111195938.1499148-2-debug@rivosinc.com>

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
> 

  reply	other threads:[~2022-11-13  0:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-11 19:59 Updating python gdb command lx_current for riscv debug
2022-11-11 19:59 ` [PATCH] gdb-script: updated " debug
2022-11-13  0:13   ` Conor Dooley [this message]
2022-11-13 14:14     ` Conor Dooley
2022-11-13 11:06   ` Andrew Jones
2022-11-15  1:29   ` [PATCH v2] scripts/gdb: add lx_current support " Deepak Gupta
2022-11-15  6:46     ` Andrew Jones
2022-11-15  8:49     ` [PATCH v3] " Deepak Gupta
2022-11-15 14:38       ` Conor Dooley
     [not found]         ` <CAKC1njRi9C0m3JKpu0ebAFCC25161EST=tFFWiAj1yZBbnak6A@mail.gmail.com>
2022-11-15 18:06           ` Conor.Dooley
2022-11-15 18:43             ` Deepak Gupta
2022-11-15 18:06           ` Andrew Jones
2022-11-15 20:40         ` [PATCH v4] " Deepak Gupta
2022-11-15 21:23           ` Conor.Dooley
2022-11-15 22:10             ` [PATCH v5] " Deepak Gupta
2022-11-16  8:16               ` Andrew Jones
2022-11-16 22:24                 ` Deepak Gupta
2022-12-09  1:24               ` Palmer Dabbelt
2023-01-02  9:09               ` Jan Kiszka
2023-10-05  5:29                 ` Hsieh-Tseng Shen
2023-10-26 23:41                   ` Deepak Gupta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y3A2tPFbqcf1DPr5@spud \
    --to=conor@kernel.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=debug@rivosinc.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kbingham@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux@rivosinc.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox