[ia64-hpux] inferior function call support
[external/binutils.git] / gdb / ia64-hpux-nat.c
index fd58bba..32160aa 100644 (file)
@@ -590,6 +590,40 @@ ia64_hpux_xfer_uregs (struct target_ops *ops, const char *annex,
   return len;
 }
 
+/* Handle the transfer of TARGET_OBJECT_HPUX_SOLIB_GOT objects on ia64-hpux.
+
+   The current implementation does not support write transfers (because
+   we do not currently do not need these transfers), and will raise
+   a failed assertion if WRITEBUF is not NULL.  */
+
+static LONGEST
+ia64_hpux_xfer_solib_got (struct target_ops *ops, const char *annex,
+                         gdb_byte *readbuf, const gdb_byte *writebuf,
+                         ULONGEST offset, LONGEST len)
+{
+  CORE_ADDR fun_addr;
+  /* The linkage pointer.  We use a uint64_t to make sure that the size
+     of the object we are returning is always 64 bits long, as explained
+     in the description of the TARGET_OBJECT_HPUX_SOLIB_GOT object.
+     This is probably paranoia, but we do not use a CORE_ADDR because
+     it could conceivably be larger than uint64_t.  */
+  uint64_t got;
+
+  gdb_assert (writebuf == NULL);
+
+  if (offset > sizeof (got))
+    return 0;
+
+  fun_addr = string_to_core_addr (annex);
+  got = ia64_hpux_get_solib_linkage_addr (fun_addr);
+
+  if (len > sizeof (got) - offset)
+    len = sizeof (got) - offset;
+  memcpy (readbuf, &got + offset, len);
+
+  return len;
+}
+
 /* The "to_xfer_partial" target_ops routine for ia64-hpux.  */
 
 static LONGEST
@@ -603,6 +637,9 @@ ia64_hpux_xfer_partial (struct target_ops *ops, enum target_object object,
     val = ia64_hpux_xfer_memory (ops, annex, readbuf, writebuf, offset, len);
   else if (object == TARGET_OBJECT_HPUX_UREGS)
     val = ia64_hpux_xfer_uregs (ops, annex, readbuf, writebuf, offset, len);
+  else if (object == TARGET_OBJECT_HPUX_SOLIB_GOT)
+    val = ia64_hpux_xfer_solib_got (ops, annex, readbuf, writebuf, offset,
+                                   len);
   else
     val = super_xfer_partial (ops, object, annex, readbuf, writebuf, offset,
                              len);