On 5/1/23 17:43, Alex Bennée wrote:
This is a hangover from the original code. addr is misleading as it is
only a really a register id. While len will never exceed

"a really"?

MAX_PACKET_LENGTH I've used size_t as that is what strlen returns.

Signed-off-by: Alex Bennée <alex.ben...@linaro.org>
---
  gdbstub/gdbstub.c | 17 ++++++++++-------
  1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index 4547ca3367..c50c2f8e0f 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -1192,7 +1192,8 @@ static void handle_read_mem(GArray *params, void 
*user_ctx)
static void handle_write_all_regs(GArray *params, void *user_ctx)
  {
-    target_ulong addr, len;
+    int reg_id;

'unsigned'?

+    size_t len;
      uint8_t *registers;
      int reg_size;
@@ -1204,9 +1205,10 @@ static void handle_write_all_regs(GArray *params, void *user_ctx)
      len = strlen(get_param(params, 0)->data) / 2;
      gdb_hextomem(gdbserver_state.mem_buf, get_param(params, 0)->data, len);
      registers = gdbserver_state.mem_buf->data;
-    for (addr = 0; addr < gdbserver_state.g_cpu->gdb_num_g_regs && len > 0;
-         addr++) {
-        reg_size = gdb_write_register(gdbserver_state.g_cpu, registers, addr);
+    for (reg_id = 0;
+         reg_id < gdbserver_state.g_cpu->gdb_num_g_regs && len > 0;
+         reg_id++) {
Regardless:
Reviewed-by: Philippe Mathieu-Daudé <phi...@linaro.org>


Reply via email to