* target.c (target_read_memory_partial): Always initialize
authorDaniel Jacobowitz <drow@false.org>
Fri, 4 Mar 2005 17:47:59 +0000 (17:47 +0000)
committerDaniel Jacobowitz <drow@false.org>
Fri, 4 Mar 2005 17:47:59 +0000 (17:47 +0000)
ERR.
(target_write_memory_partial): Likewise.

gdb/ChangeLog
gdb/target.c

index 31d5950b97e67cb0bd17998aea80029e60975fe4..8ba47451fecbe804a4f4d4d33a223e5d07e2a04a 100644 (file)
@@ -1,3 +1,9 @@
+2005-03-04  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * target.c (target_read_memory_partial): Always initialize
+       ERR.
+       (target_write_memory_partial): Likewise.
+
 2005-03-03  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * remote.c (remote_open_1): Call observer_notify_inferior_created.
index c008bfc10156c02bb34d75eac04e556dab40f6ee..e2bb96d0ccf6c5ad73dbfb37565e31addedb2918 100644 (file)
@@ -1,7 +1,7 @@
 /* Select target systems and architectures at runtime for GDB.
 
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
    Contributed by Cygnus Support.
 
@@ -1249,8 +1249,26 @@ int
 target_read_memory_partial (CORE_ADDR memaddr, char *buf, int len, int *err)
 {
   if (target_xfer_partial_p ())
-    return target_xfer_partial (target_stack, TARGET_OBJECT_MEMORY, NULL,
-                               buf, NULL, memaddr, len);
+    {
+      int retval;
+
+      retval = target_xfer_partial (target_stack, TARGET_OBJECT_MEMORY,
+                                   NULL, buf, NULL, memaddr, len);
+
+      if (retval <= 0)
+       {
+         if (errno)
+           *err = errno;
+         else
+           *err = EIO;
+         return -1;
+       }
+      else
+       {
+         *err = 0;
+         return retval;
+       }
+    }
   else
     return target_xfer_memory_partial (memaddr, buf, len, 0, err);
 }
@@ -1259,8 +1277,26 @@ int
 target_write_memory_partial (CORE_ADDR memaddr, char *buf, int len, int *err)
 {
   if (target_xfer_partial_p ())
-    return target_xfer_partial (target_stack, TARGET_OBJECT_MEMORY, NULL,
-                               NULL, buf, memaddr, len);
+    {
+      int retval;
+
+      retval = target_xfer_partial (target_stack, TARGET_OBJECT_MEMORY,
+                                   NULL, NULL, buf, memaddr, len);
+
+      if (retval <= 0)
+       {
+         if (errno)
+           *err = errno;
+         else
+           *err = EIO;
+         return -1;
+       }
+      else
+       {
+         *err = 0;
+         return retval;
+       }
+    }
   else
     return target_xfer_memory_partial (memaddr, buf, len, 1, err);
 }