* configure: Regenerate with proper autoconf 2.13.
[deliverable/binutils-gdb.git] / gdb / i386-linux-tdep.c
index 394699f11684bd64e8dd00e69d154341479e1038..c7bd36a0d56c36073a6c3ac22f891002581a7352 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for GNU/Linux running on i386's, for GDB.
 
-   Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -25,6 +25,7 @@
 #include "value.h"
 #include "regcache.h"
 #include "inferior.h"
+#include "reggroups.h"
 
 /* For i386_linux_skip_solib_resolver.  */
 #include "symtab.h"
@@ -33,6 +34,8 @@
 
 #include "solib-svr4.h"                /* For struct link_map_offsets.  */
 
+#include "osabi.h"
+
 #include "i386-tdep.h"
 #include "i386-linux-tdep.h"
 
@@ -48,26 +51,19 @@ i386_linux_register_name (int reg)
   return i386_register_name (reg);
 }
 
+/* Return non-zero, when the register is in the corresponding register
+   group.  Put the LINUX_ORIG_EAX register in the system group.  */
 static int
-i386_linux_register_byte (int reg)
+i386_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+                               struct reggroup *group)
 {
-  /* Deal with the extra "orig_eax" pseudo register.  */
-  if (reg == I386_LINUX_ORIG_EAX_REGNUM)
-    return (i386_register_byte (I386_LINUX_ORIG_EAX_REGNUM - 1)
-           + i386_register_raw_size (I386_LINUX_ORIG_EAX_REGNUM - 1));
-
-  return i386_register_byte (reg);
+  if (regnum == I386_LINUX_ORIG_EAX_REGNUM)
+    return (group == system_reggroup
+           || group == save_reggroup
+           || group == restore_reggroup);
+  return i386_register_reggroup_p (gdbarch, regnum, group);
 }
 
-static int
-i386_linux_register_raw_size (int reg)
-{
-  /* Deal with the extra "orig_eax" pseudo register.  */
-  if (reg == I386_LINUX_ORIG_EAX_REGNUM)
-    return 4;
-
-  return i386_register_raw_size (reg);
-}
 \f
 /* Recognizing signal handler frames.  */
 
@@ -230,11 +226,17 @@ i386_linux_rt_sigtramp_start (CORE_ADDR pc)
 static int
 i386_linux_pc_in_sigtramp (CORE_ADDR pc, char *name)
 {
-  if (name)
-    return STREQ ("__restore", name) || STREQ ("__restore_rt", name);
-  
-  return (i386_linux_sigtramp_start (pc) != 0
-         || i386_linux_rt_sigtramp_start (pc) != 0);
+  /* If we have NAME, we can optimize the search.  The trampolines are
+     named __restore and __restore_rt.  However, they aren't dynamically
+     exported from the shared C library, so the trampoline may appear to
+     be part of the preceding function.  This should always be sigaction,
+     __sigaction, or __libc_sigaction (all aliases to the same function).  */
+  if (name == NULL || strstr (name, "sigaction") != NULL)
+    return (i386_linux_sigtramp_start (pc) != 0
+           || i386_linux_rt_sigtramp_start (pc) != 0);
+
+  return (strcmp ("__restore", name) == 0
+         || strcmp ("__restore_rt", name) == 0);
 }
 
 /* Assuming FRAME is for a GNU/Linux sigtramp routine, return the
@@ -457,9 +459,8 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   set_gdbarch_write_pc (gdbarch, i386_linux_write_pc);
   set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS + 1);
   set_gdbarch_register_name (gdbarch, i386_linux_register_name);
+  set_gdbarch_register_reggroup_p (gdbarch, i386_linux_register_reggroup_p);
   set_gdbarch_register_bytes (gdbarch, I386_SSE_SIZEOF_REGS + 4);
-  set_gdbarch_register_byte (gdbarch, i386_linux_register_byte);
-  set_gdbarch_register_raw_size (gdbarch, i386_linux_register_raw_size);
 
   tdep->jb_pc_offset = 20;     /* From <bits/setjmp.h>.  */
 
@@ -483,6 +484,6 @@ extern void _initialize_i386_linux_tdep (void);
 void
 _initialize_i386_linux_tdep (void)
 {
-  gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_LINUX,
+  gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_LINUX,
                          i386_linux_init_abi);
 }
This page took 0.029962 seconds and 4 git commands to generate.