* somsolib.c (som_solib_get_got_by_pc): New function.
authorJeff Law <law@redhat.com>
Thu, 1 Dec 1994 05:34:30 +0000 (05:34 +0000)
committerJeff Law <law@redhat.com>
Thu, 1 Dec 1994 05:34:30 +0000 (05:34 +0000)
* somsolib.h (som_solib_get_got_by_pc): Add extern decl.
* hppa-tdep.c (hppa_fix_call_dummy): Handle case where FUN is the
function's export stub or real address in a shared library.

gdb/ChangeLog
gdb/hppa-tdep.c
gdb/somsolib.c
gdb/somsolib.h

index 1cc50c5..ebdacb0 100644 (file)
@@ -1,3 +1,10 @@
+Wed Nov 30 22:27:27 1994  Jeff Law  (law@snake.cs.utah.edu)
+
+       * somsolib.c (som_solib_get_got_by_pc): New function.
+       * somsolib.h (som_solib_get_got_by_pc): Add extern decl.
+       * hppa-tdep.c (hppa_fix_call_dummy): Handle case where FUN is the
+       function's export stub or real address in a shared library.
+
 Tue Nov 29 13:40:25 1994  J.T. Conklin  (jtc@rtl.cygnus.com)
 
        * config/i386/nbsd.mh (REGEX, REGEX1): No longer define.
index 687b309..d765b94 100644 (file)
@@ -1378,6 +1378,19 @@ hppa_fix_call_dummy (dummy, pc, fun, nargs, args, type, gcc_p)
         at *fun.  */
       fun = (CORE_ADDR) read_memory_integer (fun & ~0x3, 4);
     }
+  else
+    {
+
+      /* FUN could be either an export stub, or the real address of a
+        function in a shared library.
+
+        To call this function we need to get the GOT/DP value for the target
+        function.  Do this by calling shared library support routines in
+        somsolib.c.  Once the GOT value is in %r19 we can call the procedure
+        in the normal fashion.  */
+
+        write_register (19, som_solib_get_got_by_pc (fun));
+    }
 
   /* If we are calling an import stub (eg calling into a dynamic library)
      then have sr4export call the magic __d_plt_call routine which is linked
index f75ad9c..fc3d2ad 100644 (file)
@@ -43,8 +43,6 @@ and by Cygnus Support.  */
 
    * Do we need/want a command to load a shared library?
 
-   * Test attaching to running dynamically linked code.
-
    * Support for hpux8 dynamic linker.
 
    * Support for tracking user calls to dld_load, dld_unload.  */
@@ -544,6 +542,29 @@ som_solib_create_inferior_hook()
   som_solib_add ((char *) 0, 0, (struct target_ops *) 0);
 }
 
+/* Return the GOT value for the shared library in which ADDR belongs.  If
+   ADDR isn't in any known shared library, return zero.  */
+
+CORE_ADDR
+som_solib_get_got_by_pc (addr)
+     CORE_ADDR addr;
+{
+  struct so_list *so_list = so_list_head;
+  CORE_ADDR got_value = 0;
+
+  while (so_list)
+    {
+      if (so_list->som_solib.text_addr <= addr
+         && so_list->som_solib.text_end > addr)
+       {
+         got_value = so_list->som_solib.got_value;
+         break;
+       }
+      so_list = so_list->next;
+    }
+  return got_value;
+}
+
 /* Dump information about all the currently loaded shared libraries.  */
 
 static void
index f6b0115..8df2062 100644 (file)
@@ -32,6 +32,9 @@ struct target_ops;
 extern void
 som_solib_add PARAMS ((char *, int, struct target_ops *));
 
+extern CORE_ADDR
+som_solib_get_got_by_pc PARAMS ((CORE_ADDR));
+
 /* Function to be called when the inferior starts up, to discover the names
    of shared libraries that are dynamically linked, the base addresses to
    which they are linked, and sufficient information to read in their symbols