OSDN Git Service

Change TARGET_ALTIVEC to TARGET_ALTIVEC_ABI.
[pf3gnuchains/gcc-fork.git] / gcc / unwind-dw2.c
index eadd88b..09396c8 100644 (file)
@@ -9,6 +9,15 @@
    the Free Software Foundation; either version 2, or (at your option)
    any later version.
 
+   In addition to the permissions in the GNU General Public License, the
+   Free Software Foundation gives you unlimited permission to link the
+   compiled version of this file into combinations with other programs,
+   and to distribute those combinations without any restriction coming
+   from the use of this file.  (The General Public License restrictions
+   do apply in other respects; for example, they cover modification of
+   the file, and distribution when not linked into a combined
+   executable.)
+
    GCC is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
 #define DWARF_REG_TO_UNWIND_COLUMN(REGNO) (REGNO)
 #endif
 
+/* A target can do some update context frobbing.  */
+#ifndef MD_FROB_UPDATE_CONTEXT
+#define MD_FROB_UPDATE_CONTEXT(CTX, FS) do { } while (0)
+#endif
+
 /* This is the register and unwind state for a particular frame.  This
    provides the information necessary to unwind up past a frame and return
    to its caller.  */
@@ -68,7 +82,7 @@ struct _Unwind_Context
 };
 
 /* Byte size of every register managed by these routines.  */
-static unsigned char dwarf_reg_size_table[DWARF_FRAME_REGISTERS];
+static unsigned char dwarf_reg_size_table[DWARF_FRAME_REGISTERS+1];
 
 \f
 /* The result of interpreting the frame unwind info for a frame.
@@ -172,6 +186,8 @@ _Unwind_GetGR (struct _Unwind_Context *context, int index)
   void *ptr;
 
   index = DWARF_REG_TO_UNWIND_COLUMN (index);
+  if (index >= sizeof(dwarf_reg_size_table))
+    abort ();
   size = dwarf_reg_size_table[index];
   ptr = context->reg[index];
 
@@ -208,6 +224,8 @@ _Unwind_SetGR (struct _Unwind_Context *context, int index, _Unwind_Word val)
   void *ptr;
 
   index = DWARF_REG_TO_UNWIND_COLUMN (index);
+  if (index >= sizeof(dwarf_reg_size_table))
+    abort ();
   size = dwarf_reg_size_table[index];
   ptr = context->reg[index];
 
@@ -988,6 +1006,9 @@ uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
   context->args_size = 0;
   context->lsda = 0;
 
+  if (context->ra == 0)
+    return _URC_END_OF_STACK;
+
   fde = _Unwind_Find_FDE (context->ra - 1, &context->bases);
   if (fde == NULL)
     {
@@ -1203,6 +1224,8 @@ uw_update_context_1 (struct _Unwind_Context *context, _Unwind_FrameState *fs)
        }
        break;
       }
+
+  MD_FROB_UPDATE_CONTEXT (context, fs);
 }
 
 /* CONTEXT describes the unwind state for a frame, and FS describes the FDE