qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"Mikhail Tyutin" <m.tyutin@yadro.com>,
	"Aleksandr Anenkov" <a.anenkov@yadro.com>,
	qemu-devel@nongnu.org, "Eduardo Habkost" <eduardo@habkost.net>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Yanan Wang" <wangyanan55@huawei.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Michael Rolnik" <mrolnik@gmail.com>,
	"Brian Cain" <bcain@quicinc.com>,
	"Song Gao" <gaosong@loongson.cn>,
	"Xiaojuan Yang" <yangxiaojuan@loongson.cn>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Bin Meng" <bin.meng@windriver.com>,
	"Weiwei Li" <liweiwei@iscas.ac.cn>,
	"Daniel Henrique Barboza" <dbarboza@ventanamicro.com>,
	"Liu Zhiwei" <zhiwei_liu@linux.alibaba.com>,
	"Yoshinori Sato" <ysato@users.sourceforge.jp>,
	"Thomas Huth" <thuth@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"David Hildenbrand" <david@redhat.com>,
	"Ilya Leoshkevich" <iii@linux.ibm.com>,
	"open list:ARM TCG CPUs" <qemu-arm@nongnu.org>,
	"open list:RISC-V TCG CPUs" <qemu-riscv@nongnu.org>,
	"open list:S390 general arch..." <qemu-s390x@nongnu.org>
Subject: Re: [PATCH v11 11/18] gdbstub: Infer number of core registers from XML
Date: Thu, 12 Oct 2023 15:43:34 +0200	[thread overview]
Message-ID: <62fd649b-1c07-c0f5-11cc-ca17ad0675e5@linaro.org> (raw)
In-Reply-To: <20231012130616.7941-12-akihiko.odaki@daynix.com>

Hi Akihiko,

On 12/10/23 15:06, Akihiko Odaki wrote:
> GDBFeature has the num_regs member so use it where applicable to
> remove magic numbers.
> 
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
>   include/hw/core/cpu.h   | 3 ++-
>   target/s390x/cpu.h      | 2 --
>   gdbstub/gdbstub.c       | 5 ++++-
>   target/arm/cpu.c        | 1 -
>   target/arm/cpu64.c      | 1 -
>   target/avr/cpu.c        | 1 -
>   target/hexagon/cpu.c    | 1 -
>   target/i386/cpu.c       | 2 --
>   target/loongarch/cpu.c  | 2 --
>   target/m68k/cpu.c       | 1 -
>   target/microblaze/cpu.c | 1 -
>   target/riscv/cpu.c      | 1 -
>   target/rx/cpu.c         | 1 -
>   target/s390x/cpu.c      | 1 -
>   14 files changed, 6 insertions(+), 17 deletions(-)
> 
> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
> index 3968369554..11d4b5cd0c 100644
> --- a/include/hw/core/cpu.h
> +++ b/include/hw/core/cpu.h
> @@ -127,7 +127,8 @@ struct SysemuCPUOps;
>    * @gdb_adjust_breakpoint: Callback for adjusting the address of a
>    *       breakpoint.  Used by AVR to handle a gdb mis-feature with
>    *       its Harvard architecture split code and data.
> - * @gdb_num_core_regs: Number of core registers accessible to GDB.
> + * @gdb_num_core_regs: Number of core registers accessible to GDB or 0 to infer
> + *                     from @gdb_core_xml_file.
>    * @gdb_core_xml_file: File name for core registers GDB XML description.
>    * @gdb_stop_before_watchpoint: Indicates whether GDB expects the CPU to stop
>    *           before the insn which triggers a watchpoint rather than after it.
> diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
> index 7bea7075e1..83eafbe4b1 100644
> --- a/target/s390x/cpu.h
> +++ b/target/s390x/cpu.h
> @@ -452,8 +452,6 @@ static inline void cpu_get_tb_cpu_state(CPUS390XState *env, vaddr *pc,
>   #define S390_R13_REGNUM 15
>   #define S390_R14_REGNUM 16
>   #define S390_R15_REGNUM 17
> -/* Total Core Registers. */
> -#define S390_NUM_CORE_REGS 18
>   
>   static inline void setcc(S390CPU *cpu, uint64_t cc)
>   {
> diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
> index 49fb23a68a..c19f1785e4 100644
> --- a/gdbstub/gdbstub.c
> +++ b/gdbstub/gdbstub.c
> @@ -541,9 +541,12 @@ void gdb_init_cpu(CPUState *cpu)
>           gdb_register_feature(cpu, 0,
>                                cc->gdb_read_register, cc->gdb_write_register,
>                                feature);
> +        cpu->gdb_num_regs = cpu->gdb_num_g_regs = feature->num_regs;
>       }
>   
> -    cpu->gdb_num_regs = cpu->gdb_num_g_regs = cc->gdb_num_core_regs;
> +    if (cc->gdb_num_core_regs) {
> +        cpu->gdb_num_regs = cpu->gdb_num_g_regs = cc->gdb_num_core_regs;

Why not remove SysemuCPUOps::gdb_num_core_regs entirely?

> +    }
>   }



  reply	other threads:[~2023-10-12 13:44 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-12 13:05 [PATCH v11 00/18] plugins: Allow to read registers Akihiko Odaki
2023-10-12 13:05 ` [PATCH v11 01/18] gdbstub: Add num_regs member to GDBFeature Akihiko Odaki
2023-10-12 13:05 ` [PATCH v11 02/18] gdbstub: Introduce gdb_find_static_feature() Akihiko Odaki
2023-10-12 13:05 ` [PATCH v11 03/18] gdbstub: Introduce GDBFeatureBuilder Akihiko Odaki
2023-10-12 13:05 ` [PATCH v11 04/18] target/arm: Use GDBFeature for dynamic XML Akihiko Odaki
2023-10-12 13:05 ` [PATCH v11 05/18] target/ppc: " Akihiko Odaki
2023-10-12 13:06 ` [PATCH v11 06/18] target/riscv: " Akihiko Odaki
2023-10-12 13:06 ` [PATCH v11 07/18] gdbstub: Use GDBFeature for gdb_register_coprocessor Akihiko Odaki
2023-10-12 13:06 ` [PATCH v11 08/18] gdbstub: Use GDBFeature for GDBRegisterState Akihiko Odaki
2023-10-12 13:06 ` [PATCH v11 09/18] gdbstub: Change gdb_get_reg_cb and gdb_set_reg_cb Akihiko Odaki
2023-10-12 13:40   ` Philippe Mathieu-Daudé
2023-10-12 13:06 ` [PATCH v11 10/18] gdbstub: Simplify XML lookup Akihiko Odaki
2023-10-12 13:06 ` [PATCH v11 11/18] gdbstub: Infer number of core registers from XML Akihiko Odaki
2023-10-12 13:43   ` Philippe Mathieu-Daudé [this message]
2023-10-12 14:45     ` Akihiko Odaki
2023-10-12 15:53       ` Philippe Mathieu-Daudé
2023-10-12 13:06 ` [PATCH v11 12/18] hw/core/cpu: Remove gdb_get_dynamic_xml member Akihiko Odaki
2023-10-12 13:45   ` Philippe Mathieu-Daudé
2023-10-12 13:06 ` [PATCH v11 13/18] gdbstub: Add members to identify registers to GDBFeature Akihiko Odaki
2023-10-12 13:06 ` [PATCH v11 14/18] gdbstub: Expose functions to read registers Akihiko Odaki
2023-10-12 13:06 ` [PATCH v11 15/18] cpu: Call plugin hooks only when ready Akihiko Odaki
2023-10-12 13:06 ` [PATCH v11 16/18] plugins: Use different helpers when reading registers Akihiko Odaki
2023-10-12 13:06 ` [PATCH v11 17/18] plugins: Allow to read registers Akihiko Odaki
2023-10-12 13:06 ` [PATCH v11 18/18] contrib/plugins: Allow to log registers 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=62fd649b-1c07-c0f5-11cc-ca17ad0675e5@linaro.org \
    --to=philmd@linaro.org \
    --cc=a.anenkov@yadro.com \
    --cc=akihiko.odaki@daynix.com \
    --cc=alex.bennee@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=bcain@quicinc.com \
    --cc=bin.meng@windriver.com \
    --cc=david@redhat.com \
    --cc=dbarboza@ventanamicro.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=eduardo@habkost.net \
    --cc=gaosong@loongson.cn \
    --cc=iii@linux.ibm.com \
    --cc=laurent@vivier.eu \
    --cc=liweiwei@iscas.ac.cn \
    --cc=m.tyutin@yadro.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mrolnik@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    --cc=wangyanan55@huawei.com \
    --cc=yangxiaojuan@loongson.cn \
    --cc=ysato@users.sourceforge.jp \
    --cc=zhiwei_liu@linux.alibaba.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).