Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Xavier Roirand <roirand@adacore.com>
To: gdb-patches@sourceware.org
Cc: brobecker@adacore.com,
	Xavier Roirand <xavier.roirand@adacore.com>,
	tgingold@free.fr
Subject: [RFA] Implement darwin remote TARGET_OBJECT_DARWIN_DYLD_INFO.
Date: Tue, 27 Feb 2018 10:10:00 -0000	[thread overview]
Message-ID: <1519726190-31009-1-git-send-email-roirand@adacore.com> (raw)

From: Xavier Roirand <xavier.roirand@adacore.com>

gdb/ChangeLog (Tristan Gingold <gingold@adacore.com>):

	* remote.c (remote_xfer_partial): Handle DARWIN_DYLD_INFO.
---
 gdb/ChangeLog |  6 ++++++
 gdb/remote.c  | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b9a9bcd..098ebda 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+
+2018-02-27  Tristan Gingold  <gingold@adacore.com>
+
+	Pushed by Xavier Roirand <roirand@adacore.com>.
+	* remote.c (remote_xfer_partial): Handle DARWIN_DYLD_INFO.
+
 2018-02-26  Maciej W. Rozycki  <macro@mips.com>
 
 	* mips-tdep.c (mips_gdbarch_init): Don't use a 32-bit BFD
diff --git a/gdb/remote.c b/gdb/remote.c
index 15d6c5b..95fbfc1 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -10495,6 +10495,39 @@ remote_xfer_partial (struct target_ops *ops, enum target_object object,
 	return TARGET_XFER_E_IO;
     }
 
+  if (object == TARGET_OBJECT_DARWIN_DYLD_INFO)
+    {
+      /* Can only read.  */
+      if (readbuf == NULL)
+	return TARGET_XFER_E_IO;
+
+      if (offset == 0 && len <= 8)
+	{
+	  ULONGEST addr;
+	  int i;
+
+	  putpkt ("qShlibInfoAddr");
+	  getpkt (&rs->buf, &rs->buf_size, 0);
+	  if (packet_check_result (rs->buf) != PACKET_OK)
+	    return TARGET_XFER_E_IO;
+
+	  /* The packet contains the address in hex (but not suitable for
+	     hex2bin as the number of digits is arbitrary.  */
+	  addr = strtoulst (rs->buf, NULL, 16);
+
+	  /* Store it in big-endian.  */
+	  for (i = len - 1; i >= 0; i--)
+	    {
+	      readbuf[i] = addr & 0xff;
+	      addr >>= 8;
+	    }
+
+	  *xfered_len = len;
+	  return TARGET_XFER_OK;
+	}
+      else
+	return TARGET_XFER_EOF;
+    }
   /* Only handle flash writes.  */
   if (writebuf != NULL)
     {
-- 
2.7.4


             reply	other threads:[~2018-02-27 10:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-27 10:10 Xavier Roirand [this message]
2018-02-27 10:26 ` tgingold
2018-02-27 10:42   ` Yao Qi

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=1519726190-31009-1-git-send-email-roirand@adacore.com \
    --to=roirand@adacore.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tgingold@free.fr \
    --cc=xavier.roirand@adacore.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