2002-12-06 Andrew Cagney <ac131313@redhat.com>
[deliverable/binutils-gdb.git] / gdb / hppa-tdep.c
index 5875011f3cd64cbb3bd2897cbdeed3bc57c8a8b0..2890746b5f262642566be98d88f92c9f99cb57ae 100644 (file)
@@ -31,6 +31,7 @@
 #include "regcache.h"
 #include "completer.h"
 #include "language.h"
+#include "osabi.h"
 
 /* For argument passing to the inferior */
 #include "symtab.h"
@@ -915,7 +916,7 @@ hppa_frame_saved_pc (struct frame_info *frame)
        {
          struct frame_saved_regs saved_regs;
 
-         get_frame_saved_regs (frame->next, &saved_regs);
+         deprecated_get_frame_saved_regs (frame->next, &saved_regs);
          if (read_memory_integer (saved_regs.regs[FLAGS_REGNUM],
                                   TARGET_PTR_BIT / 8) & 0x2)
            {
@@ -955,7 +956,7 @@ hppa_frame_saved_pc (struct frame_info *frame)
        {
          struct frame_saved_regs saved_regs;
 
-         get_frame_saved_regs (frame->next, &saved_regs);
+         deprecated_get_frame_saved_regs (frame->next, &saved_regs);
          if (read_memory_integer (saved_regs.regs[FLAGS_REGNUM],
                                   TARGET_PTR_BIT / 8) & 0x2)
            {
@@ -1079,9 +1080,10 @@ init_extra_frame_info (int fromleaf, struct frame_info *frame)
     frame->frame = read_register (SP_REGNUM) - framesize;
 }
 \f
-/* Given a GDB frame, determine the address of the calling function's frame.
-   This will be used to create a new GDB frame struct, and then
-   INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame.
+/* Given a GDB frame, determine the address of the calling function's
+   frame.  This will be used to create a new GDB frame struct, and
+   then INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC will be
+   called for the new frame.
 
    This may involve searching through prologues for several functions
    at boundaries where GCC calls HP C code, or where code which has
@@ -1226,7 +1228,7 @@ frame_chain (struct frame_info *frame)
          /* The unwind entry claims that r3 is saved here.  However,
             in optimized code, GCC often doesn't actually save r3.
             We'll discover this if we look at the prologue.  */
-         get_frame_saved_regs (tmp_frame, &saved_regs);
+         deprecated_get_frame_saved_regs (tmp_frame, &saved_regs);
          saved_regs_frame = tmp_frame;
 
          /* If we have an address for r3, that's good.  */
@@ -1275,7 +1277,7 @@ frame_chain (struct frame_info *frame)
             system call has a variable sized stack frame.  */
 
          if (tmp_frame != saved_regs_frame)
-           get_frame_saved_regs (tmp_frame, &saved_regs);
+           deprecated_get_frame_saved_regs (tmp_frame, &saved_regs);
 
          /* Abominable hack.  */
          if (current_target.to_has_execution == 0
@@ -1310,7 +1312,7 @@ frame_chain (struct frame_info *frame)
        tmp_frame = tmp_frame->next;
 
       if (tmp_frame != saved_regs_frame)
-       get_frame_saved_regs (tmp_frame, &saved_regs);
+       deprecated_get_frame_saved_regs (tmp_frame, &saved_regs);
 
       /* Abominable hack.  See above.  */
       if (current_target.to_has_execution == 0
@@ -1533,7 +1535,7 @@ hppa_pop_frame (void)
   double freg_buffer;
 
   fp = get_frame_base (frame);
-  get_frame_saved_regs (frame, &fsr);
+  deprecated_get_frame_saved_regs (frame, &fsr);
 
 #ifndef NO_PC_SPACE_QUEUE_RESTORE
   if (fsr.regs[IPSW_REGNUM])   /* Restoring a call dummy frame */
@@ -2511,7 +2513,7 @@ pa_do_registers_info (int regnum, int fpregs)
   /* Make a copy of gdb's save area (may cause actual
      reads from the target). */
   for (i = 0; i < NUM_REGS; i++)
-    frame_register_read (selected_frame, i, raw_regs + REGISTER_BYTE (i));
+    frame_register_read (deprecated_selected_frame, i, raw_regs + REGISTER_BYTE (i));
 
   if (regnum == -1)
     pa_print_registers (raw_regs, regnum, fpregs);
@@ -2555,7 +2557,7 @@ pa_do_strcat_registers_info (int regnum, int fpregs, struct ui_file *stream,
   /* Make a copy of gdb's save area (may cause actual
      reads from the target). */
   for (i = 0; i < NUM_REGS; i++)
-    frame_register_read (selected_frame, i, raw_regs + REGISTER_BYTE (i));
+    frame_register_read (deprecated_selected_frame, i, raw_regs + REGISTER_BYTE (i));
 
   if (regnum == -1)
     pa_strcat_registers (raw_regs, regnum, fpregs, stream);
@@ -2807,7 +2809,7 @@ pa_print_fp_reg (int i)
   char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
 
   /* Get 32bits of data.  */
-  frame_register_read (selected_frame, i, raw_buffer);
+  frame_register_read (deprecated_selected_frame, i, raw_buffer);
 
   /* Put it in the buffer.  No conversions are ever necessary.  */
   memcpy (virtual_buffer, raw_buffer, REGISTER_RAW_SIZE (i));
@@ -2825,7 +2827,7 @@ pa_print_fp_reg (int i)
   if ((i % 2) == 0)
     {
       /* Get the data in raw format for the 2nd half.  */
-      frame_register_read (selected_frame, i + 1, raw_buffer);
+      frame_register_read (deprecated_selected_frame, i + 1, raw_buffer);
 
       /* Copy it into the appropriate part of the virtual buffer.  */
       memcpy (virtual_buffer + REGISTER_RAW_SIZE (i), raw_buffer,
@@ -2853,7 +2855,7 @@ pa_strcat_fp_reg (int i, struct ui_file *stream, enum precision_type precision)
   print_spaces_filtered (8 - strlen (REGISTER_NAME (i)), stream);
 
   /* Get 32bits of data.  */
-  frame_register_read (selected_frame, i, raw_buffer);
+  frame_register_read (deprecated_selected_frame, i, raw_buffer);
 
   /* Put it in the buffer.  No conversions are ever necessary.  */
   memcpy (virtual_buffer, raw_buffer, REGISTER_RAW_SIZE (i));
@@ -2864,7 +2866,7 @@ pa_strcat_fp_reg (int i, struct ui_file *stream, enum precision_type precision)
       char raw_buf[MAX_REGISTER_RAW_SIZE];
 
       /* Get the data in raw format for the 2nd half.  */
-      frame_register_read (selected_frame, i + 1, raw_buf);
+      frame_register_read (deprecated_selected_frame, i + 1, raw_buf);
 
       /* Copy it into the appropriate part of the virtual buffer.  */
       memcpy (virtual_buffer + REGISTER_RAW_SIZE (i), raw_buf, REGISTER_RAW_SIZE (i));
@@ -4895,6 +4897,20 @@ static struct gdbarch *
 hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
   struct gdbarch *gdbarch;
+  enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
+  
+  /* Try to determine the ABI of the object we are loading.  */
+
+  if (info.abfd != NULL)
+    {
+      osabi = gdbarch_lookup_osabi (info.abfd);
+      if (osabi == GDB_OSABI_UNKNOWN)
+       {
+         /* If it's a SOM file, assume it's HP/UX SOM.  */
+         if (bfd_get_flavour (info.abfd) == bfd_target_som_flavour)
+           osabi = GDB_OSABI_HPUX_SOM;
+       }
+    }
 
   /* find a candidate among the list of pre-declared architectures.  */
   arches = gdbarch_list_lookup_by_info (arches, &info);
This page took 0.027499 seconds and 4 git commands to generate.