qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
Cc: qemu-devel@nongnu.org, bcain@quicinc.com, f4bug@amsat.org,
	peter.maydell@linaro.org, tsimpson@quicinc.com,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Yanan Wang" <wangyanan55@huawei.com>
Subject: Re: [PATCH v2 RESEND 3/7] gdbstub: add support for the qRegisterInfo query
Date: Thu, 20 Apr 2023 14:49:58 +0100	[thread overview]
Message-ID: <87o7nid5mb.fsf@linaro.org> (raw)
In-Reply-To: <6414ff4730fb53bd210cce947c201ca011135831.1681993775.git.quic_mathbern@quicinc.com>


Matheus Tavares Bernardino <quic_mathbern@quicinc.com> writes:

> From: Brian Cain <bcain@quicinc.com>
>
> Signed-off-by: Brian Cain <bcain@quicinc.com>
> Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
> ---
>  include/hw/core/cpu.h |  4 ++++
>  gdbstub/gdbstub.c     | 27 +++++++++++++++++++++++++++
>  2 files changed, 31 insertions(+)
>
> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
> index 397fd3ac68..cfdf5514d9 100644
> --- a/include/hw/core/cpu.h
> +++ b/include/hw/core/cpu.h
> @@ -124,6 +124,8 @@ struct SysemuCPUOps;
>   *       its Harvard architecture split code and data.
>   * @gdb_num_core_regs: Number of core registers accessible to GDB.
>   * @gdb_core_xml_file: File name for core registers GDB XML description.
> + * @gdb_qreg_info_lines: Array of lines of registers qRegisterInfo description.
> + * @gdb_qreg_info_line_count: Count of lines for @gdb_qreg_info_lines.
>   * @gdb_stop_before_watchpoint: Indicates whether GDB expects the CPU to stop
>   *           before the insn which triggers a watchpoint rather than after it.
>   * @gdb_arch_name: Optional callback that returns the architecture name known
> @@ -159,6 +161,8 @@ struct CPUClass {
>      vaddr (*gdb_adjust_breakpoint)(CPUState *cpu, vaddr addr);
>  
>      const char *gdb_core_xml_file;
> +    const char **gdb_qreg_info_lines;
> +    int gdb_qreg_info_line_count;
>      gchar * (*gdb_arch_name)(CPUState *cpu);
>      const char * (*gdb_get_dynamic_xml)(CPUState *cpu, const char *xmlname);
>  
> diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
> index be18568d0a..f19f8c58c3 100644
> --- a/gdbstub/gdbstub.c
> +++ b/gdbstub/gdbstub.c
> @@ -1409,6 +1409,27 @@ static void handle_query_curr_tid(GArray *params, void *user_ctx)
>      gdb_put_strbuf();
>  }
>  
> +static void handle_query_regs(GArray *params, void *user_ctx)
> +{
> +    if (!params->len) {
> +        return;
> +    }
> +
> +    CPUClass *cc = CPU_GET_CLASS(gdbserver_state.g_cpu);
> +    if (!cc->gdb_qreg_info_lines) {
> +        gdb_put_packet("");
> +        return;
> +    }
> +
> +    int reg_num = get_param(params, 0)->val_ul;
> +    if (reg_num >= cc->gdb_qreg_info_line_count) {
> +        gdb_put_packet("");
> +        return;
> +    }
> +
> +    gdb_put_packet(cc->gdb_qreg_info_lines[reg_num]);
> +}
> +
>  static void handle_query_threads(GArray *params, void *user_ctx)
>  {
>      if (!gdbserver_state.query_cpu) {
> @@ -1578,6 +1599,12 @@ static const GdbCmdParseEntry gdb_gen_query_table[] = {
>          .handler = handle_query_curr_tid,
>          .cmd = "C",
>      },
> +    {
> +        .handler = handle_query_regs,
> +        .cmd = "RegisterInfo",
> +        .cmd_startswith = 1,
> +        .schema = "l0"
> +    },

Where is this defined in the protocol spec, I can't see it in:

  https://sourceware.org/gdb/onlinedocs/gdb/General-Query-Packets.html#General-Query-Packets

and it seems to be information that is handled by the xml register
description. Is there a reason that isn't used for Hexagon?

>      {
>          .handler = handle_query_threads,
>          .cmd = "sThreadInfo",


-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


  reply	other threads:[~2023-04-20 13:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20 12:31 [PATCH v2 RESEND 0/7] Hexagon: add lldb support Matheus Tavares Bernardino
2023-04-20 12:31 ` [PATCH v2 RESEND 1/7] gdbstub: only send stop-reply packets when allowed to Matheus Tavares Bernardino
2023-04-20 13:41   ` Alex Bennée
2023-04-21 11:31     ` Matheus Tavares Bernardino
2023-04-20 12:31 ` [PATCH v2 RESEND 2/7] gdbstub: add test for untimely stop-reply packets Matheus Tavares Bernardino
2023-04-20 13:44   ` Alex Bennée
2023-04-20 12:31 ` [PATCH v2 RESEND 3/7] gdbstub: add support for the qRegisterInfo query Matheus Tavares Bernardino
2023-04-20 13:49   ` Alex Bennée [this message]
2023-04-21 11:34     ` Matheus Tavares Bernardino
2023-04-21 13:17       ` Alex Bennée
2023-04-20 14:04   ` Philippe Mathieu-Daudé
2023-04-20 14:05     ` Philippe Mathieu-Daudé
2023-04-20 12:31 ` [PATCH v2 RESEND 4/7] Hexagon: support qRegisterInfo at gdbstub Matheus Tavares Bernardino
2023-04-20 14:06   ` Philippe Mathieu-Daudé
2023-04-21 11:40     ` Matheus Tavares Bernardino
2023-04-20 12:31 ` [PATCH v2 RESEND 5/7] Hexagon (gdbstub): fix p3:0 read and write via stub Matheus Tavares Bernardino
2023-04-20 12:31 ` [PATCH v2 RESEND 6/7] Hexagon (gdbstub): add HVX support Matheus Tavares Bernardino
2023-04-20 12:31 ` [PATCH v2 RESEND 7/7] Hexagon (linux-user/hexagon): handle breakpoints Matheus Tavares Bernardino
2023-04-27 13:31   ` Richard Henderson

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=87o7nid5mb.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=bcain@quicinc.com \
    --cc=eduardo@habkost.net \
    --cc=f4bug@amsat.org \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quic_mathbern@quicinc.com \
    --cc=tsimpson@quicinc.com \
    --cc=wangyanan55@huawei.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;
as well as URLs for NNTP newsgroup(s).