]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Write entire buffer in gdbserver write_prim
authorTom Tromey <tromey@adacore.com>
Thu, 16 Oct 2025 14:58:38 +0000 (08:58 -0600)
committerTom Tromey <tromey@adacore.com>
Fri, 7 Nov 2025 18:53:28 +0000 (11:53 -0700)
commitcdb59494071a30ad56fd76b1ef5ba73d4ca73bf9
treefb5287a74d0f2e702926078bb184208eda6ee31c
parent9452b2fb4608087b4fae0acbbb9b73685db7f600
Write entire buffer in gdbserver write_prim

We had a customer bug report which was eventually tracked down to
gdbserver not fully sending a target description to gdb.  (This
presented as a timeout on the gdb side.)

The customer was using the WINAPI code, which does this:

  # define write(fd, buf, len) send (fd, (char *) buf, len, 0)

In this setup, I think it's possible to have a partial write.
However, gdbserver does not account for this possibility, despite the
fact that write_prim documents this.

This patch attempts to fix the problem by always writing the full
buffer in write_prim.  In this case the customer fixed their bug in a
different way, so we haven't actually tested this in the wild.

v2: Return bool from write_prim.

Reviewed-by: Kévin Le Gouguec <legouguec@adacore.com>
gdbserver/remote-utils.cc