* arm-tdep.c (arm_frame_chain_valid): Remove unnecessary test.
[deliverable/binutils-gdb.git] / gdb / i386-tdep.c
index e7b166f412e8197678719cb87f85a8c741de5ad5..9b4cf0286b058023a174a1b8ed51dc4b10af84d4 100644 (file)
@@ -1,7 +1,7 @@
 /* Intel 386 target-dependent stuff.
 
    Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
-   1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -39,6 +39,7 @@
 #include "gdb_assert.h"
 #include "reggroups.h"
 #include "dummy-frame.h"
+#include "osabi.h"
 
 #include "i386-tdep.h"
 #include "i387-tdep.h"
@@ -707,7 +708,7 @@ i386_frame_init_saved_regs (struct frame_info *fip)
   CORE_ADDR pc;
   int i;
 
-  if (fip->saved_regs)
+  if (get_frame_saved_regs (fip))
     return;
 
   frame_saved_regs_zalloc (fip);
@@ -726,16 +727,16 @@ i386_frame_init_saved_regs (struct frame_info *fip)
            break;
 #ifdef I386_REGNO_TO_SYMMETRY
          /* Dynix uses different internal numbering.  Ick.  */
-         fip->saved_regs[I386_REGNO_TO_SYMMETRY (op - 0x50)] = addr;
+         get_frame_saved_regs (fip)[I386_REGNO_TO_SYMMETRY (op - 0x50)] = addr;
 #else
-         fip->saved_regs[op - 0x50] = addr;
+         get_frame_saved_regs (fip)[op - 0x50] = addr;
 #endif
          addr -= 4;
        }
     }
 
-  fip->saved_regs[PC_REGNUM] = fip->frame + 4;
-  fip->saved_regs[FP_REGNUM] = fip->frame;
+  get_frame_saved_regs (fip)[PC_REGNUM] = fip->frame + 4;
+  get_frame_saved_regs (fip)[FP_REGNUM] = fip->frame;
 }
 
 /* Return PC of first real instruction.  */
@@ -867,7 +868,7 @@ i386_do_pop_frame (struct frame_info *frame)
   for (regnum = 0; regnum < NUM_REGS; regnum++)
     {
       CORE_ADDR addr;
-      addr = frame->saved_regs[regnum];
+      addr = get_frame_saved_regs (frame)[regnum];
       if (addr)
        {
          read_memory (addr, regbuf, REGISTER_RAW_SIZE (regnum));
@@ -1407,9 +1408,6 @@ i386_svr4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section);
   set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
 
-  /* FIXME: kettenis/20020511: Why do we override this function here?  */
-  set_gdbarch_frame_chain_valid (gdbarch, generic_func_frame_chain_valid);
-
   set_gdbarch_pc_in_sigtramp (gdbarch, i386_svr4_pc_in_sigtramp);
   tdep->sigcontext_addr = i386_svr4_sigcontext_addr;
   tdep->sc_pc_offset = 14 * 4;
@@ -1437,9 +1435,6 @@ i386_nw_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
-  /* FIXME: kettenis/20020511: Why do we override this function here?  */
-  set_gdbarch_frame_chain_valid (gdbarch, generic_func_frame_chain_valid);
-
   tdep->jb_pc_offset = 24;
 }
 \f
@@ -1499,22 +1494,11 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 {
   struct gdbarch_tdep *tdep;
   struct gdbarch *gdbarch;
-  enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
-
-  /* Try to determine the OS ABI of the object we're loading.  */
-  if (info.abfd != NULL)
-    osabi = gdbarch_lookup_osabi (info.abfd);
 
-  /* Find a candidate among extant architectures.  */
-  for (arches = gdbarch_list_lookup_by_info (arches, &info);
-       arches != NULL;
-       arches = gdbarch_list_lookup_by_info (arches->next, &info))
-    {
-      /* Make sure the OS ABI selection matches.  */
-      tdep = gdbarch_tdep (arches->gdbarch);
-      if (tdep && tdep->osabi == osabi)
-        return arches->gdbarch;
-    }
+  /* If there is already a candidate, use it.  */
+  arches = gdbarch_list_lookup_by_info (arches, &info);
+  if (arches != NULL)
+    return arches->gdbarch;
 
   /* Allocate space for the new architecture.  */
   tdep = XMALLOC (struct gdbarch_tdep);
@@ -1524,8 +1508,6 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
      ready to unwind the PC first (see frame.c:get_prev_frame()).  */
   set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default);
 
-  tdep->osabi = osabi;
-
   /* The i386 default settings don't include the SSE registers.
      FIXME: kettenis/20020614: They do include the FPU registers for
      now, which probably is not quite right.  */
@@ -1634,7 +1616,6 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_frameless_function_invocation (gdbarch,
                                            i386_frameless_function_invocation);
   set_gdbarch_frame_chain (gdbarch, i386_frame_chain);
-  set_gdbarch_frame_chain_valid (gdbarch, generic_file_frame_chain_valid);
   set_gdbarch_frame_saved_pc (gdbarch, i386_frame_saved_pc);
   set_gdbarch_saved_pc_after_call (gdbarch, i386_saved_pc_after_call);
   set_gdbarch_frame_num_args (gdbarch, i386_frame_num_args);
@@ -1652,7 +1633,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_register_reggroup_p (gdbarch, i386_register_reggroup_p);
 
   /* Hook in ABI-specific overrides, if they have been registered.  */
-  gdbarch_init_osabi (info, gdbarch, osabi);
+  gdbarch_init_osabi (info, gdbarch);
 
   return gdbarch;
 }
This page took 0.207113 seconds and 4 git commands to generate.