aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2004-10-05 19:52:04 +0000
committerDaniel Jacobowitz <drow@false.org>2004-10-05 19:52:04 +0000
commit21e3b9b91ad5717058e1bd5fcd58ca407fc83324 (patch)
tree98e9b6c9dbdb741775516365e76de685520e31f1
parent737ffd4f18f7a861452cf94416672c86cae17cd1 (diff)
downloadgdb-21e3b9b91ad5717058e1bd5fcd58ca407fc83324.zip
gdb-21e3b9b91ad5717058e1bd5fcd58ca407fc83324.tar.gz
gdb-21e3b9b91ad5717058e1bd5fcd58ca407fc83324.tar.bz2
* remote.c (remote_xfer_partial): Handle TARGET_OBJECT_MEMORY.
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/remote.c25
2 files changed, 29 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index bb3abd0..702dbe7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2004-10-05 Daniel Jacobowitz <dan@debian.org>
+
+ * remote.c (remote_xfer_partial): Handle TARGET_OBJECT_MEMORY.
+
2004-10-05 Andrew Cagney <cagney@gnu.org>
* version.in: Bump to version 6.2.50_YYYY-MM-DD-cvs.
diff --git a/gdb/remote.c b/gdb/remote.c
index 5ea5d12..7cbbbd8 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -4864,6 +4864,31 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
char *p2 = &buf2[0];
char query_type;
+ /* Handle memory using remote_xfer_memory. */
+ if (object == TARGET_OBJECT_MEMORY)
+ {
+ int xfered;
+ errno = 0;
+
+ if (writebuf != NULL)
+ {
+ void *buffer = xmalloc (len);
+ struct cleanup *cleanup = make_cleanup (xfree, buffer);
+ memcpy (buffer, writebuf, len);
+ xfered = remote_xfer_memory (offset, buffer, len, 1, NULL, ops);
+ do_cleanups (cleanup);
+ }
+ else
+ xfered = remote_xfer_memory (offset, readbuf, len, 0, NULL, ops);
+
+ if (xfered > 0)
+ return xfered;
+ else if (xfered == 0 && errno == 0)
+ return 0;
+ else
+ return -1;
+ }
+
/* Only handle reads. */
if (writebuf != NULL || readbuf == NULL)
return -1;