*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / ia64-hpux-nat.c
index fd58bbaf204a3fc8e51cf3d428fe8659d1753ba3..4b42c2252f01dbcae27ef0a73be4a14ebae59523 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010 Free Software Foundation, Inc.
+/* Copyright (C) 2010, 2012 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -252,7 +252,7 @@ ia64_hpux_fetch_register (struct regcache *regcache, int regnum)
   buf = alloca (len * sizeof (gdb_byte));
   status = ia64_hpux_read_register_from_save_state_t (offset, buf, len);
   if (status < 0)
-    warning (_("Failed to read register value for %s.\n"),
+    warning (_("Failed to read register value for %s."),
              gdbarch_register_name (gdbarch, regnum));
 
   regcache_raw_supply (regcache, regnum, buf);
@@ -312,7 +312,7 @@ ia64_hpux_store_register (const struct regcache *regcache, int regnum)
   status = ia64_hpux_write_register_to_saved_state_t (offset, buf, len);
 
   if (status < 0)
-    error (_("failed to write register value for %s.\n"),
+    error (_("failed to write register value for %s."),
            gdbarch_register_name (gdbarch, regnum));
 }
 
@@ -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);
This page took 0.023669 seconds and 4 git commands to generate.