Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: cagney@gnu.org, gdb-patches@sources.redhat.com
Subject: [rfa] Fix remote debugging
Date: Mon, 04 Oct 2004 20:01:00 -0000	[thread overview]
Message-ID: <20041004200122.GA30774@nevyn.them.org> (raw)

Your recent patch made it mandatory for any target which implements
to_xfer_partial to support TARGET_OBJECT_MEMORY, i.e. its
to_xfer_memory will be ignored.  remote.c doesn't meet this new
requirement.  I didn't check all the other targets with _partial
methods.

OK?  Tested on i386-pc-linux-gnu using gdbserver.  Brings test results
from unspeakable back to merely disappointing.

-- 
Daniel Jacobowitz

2004-10-04  Daniel Jacobowitz  <dan@debian.org>

	* remote.c (remote_xfer_partial): Handle TARGET_OBJECT_MEMORY.

Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.148
diff -u -p -r1.148 remote.c
--- remote.c	24 Sep 2004 19:51:18 -0000	1.148
+++ remote.c	4 Oct 2004 19:58:44 -0000
@@ -4864,6 +4864,31 @@ remote_xfer_partial (struct target_ops *
   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;


             reply	other threads:[~2004-10-04 20:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-04 20:01 Daniel Jacobowitz [this message]
2004-10-05 19:49 ` Andrew Cagney
2004-10-05 19:52   ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041004200122.GA30774@nevyn.them.org \
    --to=drow@false.org \
    --cc=cagney@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox