]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
server.c:gdb_read_memory: Fix error return.
authorPedro Alves <palves@redhat.com>
Mon, 2 Sep 2013 14:14:58 +0000 (14:14 +0000)
committerPedro Alves <palves@redhat.com>
Mon, 2 Sep 2013 14:14:58 +0000 (14:14 +0000)
When I added gdb_read_memory, with bits factored out from elsewhere, I
missed adjusting this error return.  gdb_read_memory has an interface
similar to Like GDB's xfer_partial:

> /* Read trace frame or inferior memory.  Returns the number of bytes
>   actually read, zero when no further transfer is possible, and -1 on
>   error.  Return of a positive value smaller than LEN does not
>   indicate there's no more to be read, only the end of the transfer.

Returning EIO, a positive value, is obviously bogus, for the caller
will confuse it with a successful partial transfer.

Found by inspection.

Tested on x86_64 Fedora 17.

gdb/gdbserver/
2013-09-02  Pedro Alves  <palves@redhat.com>

* server.c (gdb_read_memory): Return -1 on traceframe memory read
error instead of EIO.

gdb/gdbserver/ChangeLog
gdb/gdbserver/server.c

index 913fe42c45fe98e60aefd95d9d4805b3da23153b..1e15f77c4c1209ac2e50a65203c0ea2ee129a4a5 100644 (file)
@@ -1,3 +1,8 @@
+2013-09-02  Pedro Alves  <palves@redhat.com>
+
+       * server.c (gdb_read_memory): Return -1 on traceframe memory read
+       error instead of EIO.
+
 2013-08-28  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        PR server/15604
index ebdaba504673e05b073b083977a26bb1211a720c..d450779aa1ee39cf9f31dda9d8f4fb7bde2a8e38 100644 (file)
@@ -716,7 +716,7 @@ gdb_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
 
       if (traceframe_read_mem (current_traceframe,
                               memaddr, myaddr, len, &nbytes))
-       return EIO;
+       return -1;
       /* Data read from trace buffer, we're done.  */
       if (nbytes > 0)
        return nbytes;