qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 18/24] gdbstub: don't use target_ulong while handling regi


From: Richard Henderson
Subject: Re: [PATCH v3 18/24] gdbstub: don't use target_ulong while handling registers
Date: Tue, 21 Feb 2023 14:51:02 -1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1

On 2/21/23 12:52, Alex Bennée wrote:
This is a hangover from the original code. addr is misleading as it is
only really a register id. While len will never exceed
MAX_PACKET_LENGTH I've used size_t as that is what strlen returns.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
v3
   - fix commit message
   - use unsigned for regid

Don't use unsigned, which you did here:

  static void handle_write_all_regs(GArray *params, void *user_ctx)
  {
-    target_ulong addr, len;
+    unsigned int reg_id;

but not here

  static void handle_read_all_regs(GArray *params, void *user_ctx)
  {
-    target_ulong addr, len;
+    int reg_id;

because the comparison,

+    for (reg_id = 0; reg_id < gdbserver_state.g_cpu->gdb_num_g_regs; reg_id++) 
{

is against signed:

include/hw/core/cpu.h:377:    int gdb_num_g_regs;


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]