Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: [commit] Adjust ia64_linux_xfer_partial following to_xfer_partial API change.
Date: Tue, 25 Feb 2014 16:24:00 -0000	[thread overview]
Message-ID: <1393345450-20878-1-git-send-email-brobecker@adacore.com> (raw)

Hello,

ia64-linux-nat.c no longer compiles because ia64_linux_xfer_partial
no longer matches the to_xfer_partial prototype.  This patch fixes
the problem by adjusting it accordingly.

gdb/ChangeLog:

        * ia64-linux-nat.c (ia64_linux_xfer_partial): Add function
        documentation.  Adjust prototype to match the target_ops
        to_xfer_partial method.  Adjust implementation accordingly.

The official testsuite badly crashed our ia64-linux machine :-(.
But I was able to run the AdaCore testsuite to test this change.

Pushed.

---
 gdb/ChangeLog        |    6 ++++++
 gdb/ia64-linux-nat.c |   28 +++++++++++++++++++++++-----
 2 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d3ae4f2..b2385c1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2014-02-25  Joel Brobecker  <brobecker@adacore.com>
+
+	* ia64-linux-nat.c (ia64_linux_xfer_partial): Add function
+	documentation.  Adjust prototype to match the target_ops
+	to_xfer_partial method.  Adjust implementation accordingly.
+
 2014-02-25  Hui Zhu  <hui@codesourcery.com>
 
 	* target.h (target_ops): Fix TARGET_DEFAULT_RETURN of
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index ccd55b2..c057b55 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -838,18 +838,36 @@ ia64_linux_store_registers (struct target_ops *ops,
 
 static target_xfer_partial_ftype *super_xfer_partial;
 
-static LONGEST 
+/* Implement the to_xfer_partial target_ops method.  */
+
+static enum target_xfer_status
 ia64_linux_xfer_partial (struct target_ops *ops,
 			 enum target_object object,
 			 const char *annex,
 			 gdb_byte *readbuf, const gdb_byte *writebuf,
-			 ULONGEST offset, ULONGEST len)
+			 ULONGEST offset, ULONGEST len,
+			 ULONGEST *xfered_len)
 {
-  if (object == TARGET_OBJECT_UNWIND_TABLE && writebuf == NULL && offset == 0)
-    return syscall (__NR_getunwind, readbuf, len);
+  if (object == TARGET_OBJECT_UNWIND_TABLE && readbuf != NULL)
+    {
+      gdb_byte *tmp_buf = alloca (offset + len);
+      ULONGEST xfered;
+
+      xfered = syscall (__NR_getunwind, readbuf, offset + len);
+      if (xfered <= 0)
+	return TARGET_XFER_E_IO;
+      else if (xfered <= offset)
+	return TARGET_XFER_EOF;
+      else
+	{
+	  memcpy (readbuf, tmp_buf + offset, xfered - offset);
+	  *xfered_len = xfered - offset;
+	  return TARGET_XFER_OK;
+	}
+    }
 
   return super_xfer_partial (ops, object, annex, readbuf, writebuf,
-			     offset, len);
+			     offset, len, xfered_len);
 }
 
 /* For break.b instruction ia64 CPU forgets the immediate value and generates
-- 
1.7.9.5


             reply	other threads:[~2014-02-25 16:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-25 16:24 Joel Brobecker [this message]
2014-02-25 17:31 ` Pedro Alves
2014-02-26  2:14   ` Joel Brobecker
2014-02-26 11:16     ` Pedro Alves
2014-02-26 14:10       ` Joel Brobecker
2014-02-26 11:19     ` Pedro Alves

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=1393345450-20878-1-git-send-email-brobecker@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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