This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] Implement darwin remote TARGET_OBJECT_DARWIN_DYLD_INFO.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]