include/elf/ChangeLog:
[deliverable/binutils-gdb.git] / gdb / i386-tdep.c
index 7c047870b3dded89e522ec830a4355caac40c4e8..47b87d69554f0d69e9204c62000a3d3350efe299 100644 (file)
@@ -1,6 +1,6 @@
 /* Intel 386 target-dependent stuff.
 
-   Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
+   Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
    1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
    Foundation, Inc.
 
@@ -18,8 +18,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"
@@ -225,12 +225,25 @@ i386_svr4_reg_to_regnum (int reg)
       /* Floating-point registers.  */
       return reg - 11 + I387_ST0_REGNUM;
     }
-  else if (reg >= 21)
+  else if (reg >= 21 && reg <= 36)
     {
       /* The SSE and MMX registers have the same numbers as with dbx.  */
       return i386_dbx_reg_to_regnum (reg);
     }
 
+  switch (reg)
+    {
+    case 37: return I387_FCTRL_REGNUM;
+    case 38: return I387_FSTAT_REGNUM;
+    case 39: return I387_MXCSR_REGNUM;
+    case 40: return I386_ES_REGNUM;
+    case 41: return I386_CS_REGNUM;
+    case 42: return I386_SS_REGNUM;
+    case 43: return I386_DS_REGNUM;
+    case 44: return I386_FS_REGNUM;
+    case 45: return I386_GS_REGNUM;
+    }
+
   /* This will hopefully provoke a warning.  */
   return NUM_REGS + NUM_PSEUDO_REGS;
 }
@@ -499,7 +512,8 @@ i386_match_insn (CORE_ADDR pc, struct i386_insn *skip_insns)
     {
       if ((op & insn->mask[0]) == insn->insn[0])
        {
-         unsigned char buf[I386_MAX_INSN_LEN - 1];
+         gdb_byte buf[I386_MAX_INSN_LEN - 1];
+         int insn_matched = 1;
          size_t i;
 
          gdb_assert (insn->len > 1);
@@ -509,10 +523,11 @@ i386_match_insn (CORE_ADDR pc, struct i386_insn *skip_insns)
          for (i = 1; i < insn->len; i++)
            {
              if ((buf[i - 1] & insn->mask[i]) != insn->insn[i])
-               break;
-
-             return insn;
+               insn_matched = 0;
            }
+
+         if (insn_matched)
+           return insn;
        }
     }
 
@@ -1409,9 +1424,9 @@ static const char *valid_conventions[] =
 };
 static const char *struct_convention = default_struct_convention;
 
-/* Return non-zero if TYPE, which is assumed to be a structure or
-   union type, should be returned in registers for architecture
-   GDBARCH.  */
+/* Return non-zero if TYPE, which is assumed to be a structure,
+   a union type, or an array type, should be returned in registers
+   for architecture GDBARCH.  */
 
 static int
 i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
@@ -1420,7 +1435,9 @@ i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
   enum type_code code = TYPE_CODE (type);
   int len = TYPE_LENGTH (type);
 
-  gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION);
+  gdb_assert (code == TYPE_CODE_STRUCT
+              || code == TYPE_CODE_UNION
+              || code == TYPE_CODE_ARRAY);
 
   if (struct_convention == pcc_struct_convention
       || (struct_convention == default_struct_convention
@@ -1452,7 +1469,9 @@ i386_return_value (struct gdbarch *gdbarch, struct type *type,
 {
   enum type_code code = TYPE_CODE (type);
 
-  if ((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION)
+  if ((code == TYPE_CODE_STRUCT
+       || code == TYPE_CODE_UNION
+       || code == TYPE_CODE_ARRAY)
       && !i386_reg_struct_return_p (gdbarch, type))
     {
       /* The System V ABI says that:
@@ -1466,6 +1485,12 @@ i386_return_value (struct gdbarch *gdbarch, struct type *type,
         So the ABI guarantees that we can always find the return
         value just after the function has returned.  */
 
+      /* Note that the ABI doesn't mention functions returning arrays,
+         which is something possible in certain languages such as Ada.
+         In this case, the value is returned as if it was wrapped in
+         a record, so the convention applied to records also applies
+         to arrays.  */
+
       if (readbuf)
        {
          ULONGEST addr;
This page took 0.025499 seconds and 4 git commands to generate.