From: Daniel Jacobowitz Date: Fri, 4 Mar 2005 17:47:59 +0000 (+0000) Subject: * target.c (target_read_memory_partial): Always initialize X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f90221d302a76d152db1ff293985d0c018593dc2;p=binutils-gdb.git * target.c (target_read_memory_partial): Always initialize ERR. (target_write_memory_partial): Likewise. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 31d5950b97e..8ba47451fec 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2005-03-04 Daniel Jacobowitz + + * target.c (target_read_memory_partial): Always initialize + ERR. + (target_write_memory_partial): Likewise. + 2005-03-03 Daniel Jacobowitz * remote.c (remote_open_1): Call observer_notify_inferior_created. diff --git a/gdb/target.c b/gdb/target.c index c008bfc1015..e2bb96d0ccf 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -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); }