From: "Alex Bennée" <alex.bennee@linaro.org>
To: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: "Mikhail Tyutin" <m.tyutin@yadro.com>,
"Aleksandr Anenkov" <a.anenkov@yadro.com>,
qemu-devel@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH v14 14/18] gdbstub: Expose functions to read registers
Date: Tue, 24 Oct 2023 16:41:57 +0100 [thread overview]
Message-ID: <87y1fs10uj.fsf@linaro.org> (raw)
In-Reply-To: <20231019102657.129512-15-akihiko.odaki@daynix.com>
Akihiko Odaki <akihiko.odaki@daynix.com> writes:
> gdb_find_feature() and gdb_find_feature_register() find registers.
> gdb_read_register() actually reads registers.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> include/exec/gdbstub.h | 5 +++++
> gdbstub/gdbstub.c | 31 ++++++++++++++++++++++++++++++-
> 2 files changed, 35 insertions(+), 1 deletion(-)
>
> diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h
> index 346151d0f2..308b5c266a 100644
> --- a/include/exec/gdbstub.h
> +++ b/include/exec/gdbstub.h
> @@ -74,6 +74,11 @@ void gdb_feature_builder_end(const GDBFeatureBuilder *builder);
>
> const GDBFeature *gdb_find_static_feature(const char *xmlname);
>
> +int gdb_find_feature(CPUState *cpu, const char *name);
> +int gdb_find_feature_register(CPUState *cpu, int feature, const char *name);
> +
> +int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
> +
Can we try to add kdoc comments to the new external facing APIs please.
I should have mentioned that for previous cases as well.
> void gdb_set_stop_cpu(CPUState *cpu);
>
> /* in gdbstub-xml.c, generated by scripts/feature_to_c.py */
> diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
> index fade023559..0b64b93960 100644
> --- a/gdbstub/gdbstub.c
> +++ b/gdbstub/gdbstub.c
> @@ -490,7 +490,36 @@ const GDBFeature *gdb_find_static_feature(const char *xmlname)
> g_assert_not_reached();
> }
>
> -static int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg)
> +int gdb_find_feature(CPUState *cpu, const char *name)
> +{
> + GDBRegisterState *r;
> +
> + for (guint i = 0; i < cpu->gdb_regs->len; i++) {
> + r = &g_array_index(cpu->gdb_regs, GDBRegisterState, i);
> + if (!strcmp(name, r->feature->name)) {
> + return i;
> + }
> + }
> +
> + return -1;
> +}
> +
> +int gdb_find_feature_register(CPUState *cpu, int feature, const char *name)
> +{
> + GDBRegisterState *r;
> +
> + r = &g_array_index(cpu->gdb_regs, GDBRegisterState, feature);
> +
> + for (int i = 0; i < r->feature->num_regs; i++) {
> + if (r->feature->regs[i] && !strcmp(name, r->feature->regs[i])) {
> + return r->base_reg + i;
> + }
> + }
> +
> + return -1;
> +}
> +
> +int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg)
> {
> CPUClass *cc = CPU_GET_CLASS(cpu);
> GDBRegisterState *r;
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2023-10-24 15:45 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-19 10:26 [PATCH v14 00/18] plugins: Allow to read registers Akihiko Odaki
2023-10-19 10:26 ` [PATCH v14 01/18] gdbstub: Add num_regs member to GDBFeature Akihiko Odaki
2023-10-19 10:26 ` [PATCH v14 02/18] gdbstub: Introduce gdb_find_static_feature() Akihiko Odaki
2023-10-19 10:26 ` [PATCH v14 03/18] gdbstub: Introduce GDBFeatureBuilder Akihiko Odaki
2023-10-19 10:26 ` [PATCH v14 04/18] target/arm: Use GDBFeature for dynamic XML Akihiko Odaki
2023-10-19 10:26 ` [PATCH v14 05/18] target/ppc: " Akihiko Odaki
2023-10-19 10:26 ` [PATCH v14 06/18] target/riscv: " Akihiko Odaki
2023-10-19 10:26 ` [PATCH v14 07/18] gdbstub: Use GDBFeature for gdb_register_coprocessor Akihiko Odaki
2023-10-19 10:26 ` [PATCH v14 08/18] gdbstub: Use GDBFeature for GDBRegisterState Akihiko Odaki
2023-10-19 10:26 ` [PATCH v14 09/18] gdbstub: Change gdb_get_reg_cb and gdb_set_reg_cb Akihiko Odaki
2023-10-24 14:20 ` Alex Bennée
2023-10-19 10:26 ` [PATCH v14 10/18] gdbstub: Simplify XML lookup Akihiko Odaki
2023-10-24 14:25 ` Alex Bennée
2023-10-19 10:26 ` [PATCH v14 11/18] gdbstub: Infer number of core registers from XML Akihiko Odaki
2023-10-19 10:26 ` [PATCH v14 12/18] hw/core/cpu: Remove gdb_get_dynamic_xml member Akihiko Odaki
2023-10-24 15:38 ` Alex Bennée
2023-10-19 10:26 ` [PATCH v14 13/18] gdbstub: Add members to identify registers to GDBFeature Akihiko Odaki
2023-10-19 10:26 ` [PATCH v14 14/18] gdbstub: Expose functions to read registers Akihiko Odaki
2023-10-24 15:41 ` Alex Bennée [this message]
2023-10-19 10:26 ` [PATCH v14 15/18] cpu: Call plugin hooks only when ready Akihiko Odaki
2023-10-24 15:58 ` Alex Bennée
2023-10-24 16:41 ` Alex Bennée
2023-10-19 10:26 ` [PATCH v14 16/18] plugins: Use different helpers when reading registers Akihiko Odaki
2023-10-24 16:48 ` Alex Bennée
2023-10-25 5:39 ` Akihiko Odaki
2023-10-25 9:34 ` Akihiko Odaki
2023-10-19 10:26 ` [PATCH v14 17/18] plugins: Allow to read registers Akihiko Odaki
2023-10-19 10:26 ` [PATCH v14 18/18] contrib/plugins: Allow to log registers Akihiko Odaki
2023-10-24 17:08 ` [PATCH v14 00/18] plugins: Allow to read registers Alex Bennée
2023-10-25 5:51 ` Akihiko Odaki
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=87y1fs10uj.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=a.anenkov@yadro.com \
--cc=akihiko.odaki@daynix.com \
--cc=m.tyutin@yadro.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).