*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / hppa-hpux-tdep.c
index b0cdd5dc36022a475fb1779f9a27c8c04f504aa6..b5a9bd6d55bb30d923f7fa2a4954fabe6ce38422 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for HP-UX on PA-RISC.
 
-   Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -16,8 +16,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
 
 #include "defs.h"
 #include "arch-utils.h"
@@ -844,52 +844,54 @@ GDB will be unable to intercept exception events."),
       return 0;
     }
 
-#ifndef GDB_TARGET_IS_HPPA_20W
-  /* Check whether the executable is dynamically linked or archive bound */
-  /* With an archive-bound executable we can use the raw addresses we find
-     for the callback function, etc. without modification. For an executable
-     with shared libraries, we have to do more work to find the plabel, which
-     can be the target of a call through $$dyncall from the aCC runtime support
-     library (libCsup) which is linked shared by default by aCC. */
-  /* This test below was copied from somsolib.c/somread.c.  It may not be a very
-     reliable one to test that an executable is linked shared. pai/1997-07-18 */
-  shlib_info = bfd_get_section_by_name (symfile_objfile->obfd, "$SHLIB_INFO$");
-  if (shlib_info && (bfd_section_size (symfile_objfile->obfd, shlib_info) != 0))
+  if (!gdbarch_tdep (current_gdbarch)->is_elf)
     {
-      /* The minsym we have has the local code address, but that's not
-         the plabel that can be used by an inter-load-module call.  */
-      /* Find solib handle for main image (which has end.o), and use
-         that and the min sym as arguments to __d_shl_get() (which
-         does the equivalent of shl_findsym()) to find the plabel.  */
-
-      args_for_find_stub args;
-      static char message[] = "Error while finding exception callback hook:\n";
-
-      args.solib_handle = gdbarch_tdep (current_gdbarch)->solib_get_solib_by_pc (eh_notify_callback_addr);
-      args.msym = msym;
-      args.return_val = 0;
-
-      recurse++;
-      catch_errors (cover_find_stub_with_shl_get, &args, message,
-                   RETURN_MASK_ALL);
-      eh_notify_callback_addr = args.return_val;
-      recurse--;
-
-      deprecated_exception_catchpoints_are_fragile = 1;
-
-      if (!eh_notify_callback_addr)
-       {
-         /* We can get here either if there is no plabel in the export list
-            for the main image, or if something strange happened (?) */
-         warning (_("\
+    /* Check whether the executable is dynamically linked or archive bound */
+    /* With an archive-bound executable we can use the raw addresses we find
+       for the callback function, etc. without modification. For an executable
+       with shared libraries, we have to do more work to find the plabel, which
+       can be the target of a call through $$dyncall from the aCC runtime 
+       support library (libCsup) which is linked shared by default by aCC. */
+    /* This test below was copied from somsolib.c/somread.c.  It may not be a very
+       reliable one to test that an executable is linked shared. 
+       pai/1997-07-18 */
+    shlib_info = bfd_get_section_by_name (symfile_objfile->obfd, "$SHLIB_INFO$");
+    if (shlib_info && (bfd_section_size (symfile_objfile->obfd, shlib_info) != 0))
+      {
+        /* The minsym we have has the local code address, but that's not
+           the plabel that can be used by an inter-load-module call.  */
+        /* Find solib handle for main image (which has end.o), and use
+           that and the min sym as arguments to __d_shl_get() (which
+           does the equivalent of shl_findsym()) to find the plabel.  */
+
+        args_for_find_stub args;
+
+        args.solib_handle = gdbarch_tdep (current_gdbarch)->solib_get_solib_by_pc (eh_notify_callback_addr);
+        args.msym = msym;
+        args.return_val = 0;
+
+        recurse++;
+        catch_errors (cover_find_stub_with_shl_get, &args,
+                     _("Error while finding exception callback hook:\n"),
+                     RETURN_MASK_ALL);
+        eh_notify_callback_addr = args.return_val;
+        recurse--;
+
+        deprecated_exception_catchpoints_are_fragile = 1;
+
+        if (!eh_notify_callback_addr)
+         {
+           /* We can get here either if there is no plabel in the export list
+              for the main image, or if something strange happened (?) */
+           warning (_("\
 Couldn't find a plabel (indirect function label) for the exception callback.\n\
 GDB will not be able to intercept exception events."));
-         return 0;
-       }
+           return 0;
+         }
+      }
+    else
+      deprecated_exception_catchpoints_are_fragile = 0;
     }
-  else
-    deprecated_exception_catchpoints_are_fragile = 0;
-#endif
 
   /* Now, look for the breakpointable routine in end.o */
   /* This should also be available in the SOM symbol dict. if end.o linked in */
@@ -1063,9 +1065,6 @@ Interception of exception events may not work."));
 
 /* Record some information about the current exception event */
 static struct exception_event_record current_ex_event;
-/* Convenience struct */
-static struct symtab_and_line null_symtab_and_line =
-{NULL, 0, 0, 0};
 
 /* Report current exception event.  Returns a pointer to a record
    that describes the kind of the event, where it was thrown from,
@@ -1233,9 +1232,6 @@ hppa_hpux_sigtramp_frame_unwind_cache (struct frame_info *next_frame,
 
   /* TODO: fp regs */
 
-  info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].addr = 
-    info->saved_regs[HPPA_RP_REGNUM].addr;
-
   info->base = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM);
 
   return info;
@@ -1279,6 +1275,22 @@ hppa_hpux_sigtramp_unwind_sniffer (struct frame_info *next_frame)
 
   u = find_unwind_entry (pc);
 
+  /* If this is an export stub, try to get the unwind descriptor for
+     the actual function itself.  */
+  if (u && u->stub_unwind.stub_type == EXPORT)
+    {
+      gdb_byte buf[HPPA_INSN_SIZE];
+      unsigned long insn;
+
+      if (!safe_frame_unwind_memory (next_frame, u->region_start,
+                                    buf, sizeof buf))
+       return NULL;
+
+      insn = extract_unsigned_integer (buf, sizeof buf);
+      if ((insn & 0xffe0e000) == 0xe8400000)
+       u = find_unwind_entry(u->region_start + hppa_extract_17 (insn) + 8);
+    }
+
   if (u && u->HP_UX_interrupt_marker)
     return &hppa_hpux_sigtramp_frame_unwind;
 
@@ -1646,7 +1658,7 @@ hppa_hpux_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp,
                           CORE_ADDR *real_pc, CORE_ADDR *bp_addr)
 {
   CORE_ADDR pc, stubaddr;
-  int argreg;
+  int argreg = 0;
 
   pc = read_pc ();
 
This page took 0.027963 seconds and 4 git commands to generate.