OSDN Git Service

2007-04-16 H.J. Lu <hongjiu.lu@intel.com>
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / linux-unwind.h
index ecbce1d..58eb733 100644 (file)
@@ -1,5 +1,5 @@
 /* DWARF2 EH unwinding support for AMD x86-64 and x86.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -8,6 +8,14 @@ it under the terms of the GNU General Public License as published by
 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 with other programs, and to distribute
+those programs 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 another program.)
+
 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
@@ -15,8 +23,8 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
 
 /* Do code reading to identify a signal frame, and set the frame
    state data appropriately.  See unwind-dw2.c for the structs.
@@ -44,16 +52,19 @@ x86_64_fallback_frame_state (struct _Unwind_Context *context,
       && *(unsigned long *)(pc+1) == 0x050f0000000fc0c7)
     {
       struct ucontext *uc_ = context->cfa;
-      sc = (struct sigcontext *) &uc_->uc_mcontext;
+      /* The void * cast is necessary to avoid an aliasing warning.
+         The aliasing warning is correct, but should not be a problem
+         because it does not alias anything.  */
+      sc = (struct sigcontext *) (void *) &uc_->uc_mcontext;
     }
   else
     return _URC_END_OF_STACK;
 
   new_cfa = sc->rsp;
-  fs->cfa_how = CFA_REG_OFFSET;
+  fs->regs.cfa_how = CFA_REG_OFFSET;
   /* Register 7 is rsp  */
-  fs->cfa_reg = 7;
-  fs->cfa_offset = new_cfa - (long) context->cfa;
+  fs->regs.cfa_reg = 7;
+  fs->regs.cfa_offset = new_cfa - (long) context->cfa;
 
   /* The SVR4 register numbering macros aren't usable in libgcc.  */
   fs->regs.reg[0].how = REG_SAVED_OFFSET;
@@ -89,6 +100,7 @@ x86_64_fallback_frame_state (struct _Unwind_Context *context,
   fs->regs.reg[16].how = REG_SAVED_OFFSET;
   fs->regs.reg[16].loc.offset = (long)&sc->rip - new_cfa;
   fs->retaddr_column = 16;
+  fs->signal_frame = 1;
   return _URC_NO_REASON;
 }
 
@@ -130,34 +142,38 @@ x86_fallback_frame_state (struct _Unwind_Context *context,
        struct siginfo info;
        struct ucontext uc;
       } *rt_ = context->cfa;
-      sc = (struct sigcontext *) &rt_->uc.uc_mcontext;
+      /* The void * cast is necessary to avoid an aliasing warning.
+         The aliasing warning is correct, but should not be a problem
+         because it does not alias anything.  */
+      sc = (struct sigcontext *) (void *) &rt_->uc.uc_mcontext;
     }
   else
     return _URC_END_OF_STACK;
 
-  new_cfa = sc->esp;
-  fs->cfa_how = CFA_REG_OFFSET;
-  fs->cfa_reg = 4;
-  fs->cfa_offset = new_cfa - (long) context->cfa;
+  new_cfa = sc->REG_NAME(esp);
+  fs->regs.cfa_how = CFA_REG_OFFSET;
+  fs->regs.cfa_reg = 4;
+  fs->regs.cfa_offset = new_cfa - (long) context->cfa;
 
   /* The SVR4 register numbering macros aren't usable in libgcc.  */
   fs->regs.reg[0].how = REG_SAVED_OFFSET;
-  fs->regs.reg[0].loc.offset = (long)&sc->eax - new_cfa;
+  fs->regs.reg[0].loc.offset = (long)&sc->REG_NAME(eax) - new_cfa;
   fs->regs.reg[3].how = REG_SAVED_OFFSET;
-  fs->regs.reg[3].loc.offset = (long)&sc->ebx - new_cfa;
+  fs->regs.reg[3].loc.offset = (long)&sc->REG_NAME(ebx) - new_cfa;
   fs->regs.reg[1].how = REG_SAVED_OFFSET;
-  fs->regs.reg[1].loc.offset = (long)&sc->ecx - new_cfa;
+  fs->regs.reg[1].loc.offset = (long)&sc->REG_NAME(ecx) - new_cfa;
   fs->regs.reg[2].how = REG_SAVED_OFFSET;
-  fs->regs.reg[2].loc.offset = (long)&sc->edx - new_cfa;
+  fs->regs.reg[2].loc.offset = (long)&sc->REG_NAME(edx) - new_cfa;
   fs->regs.reg[6].how = REG_SAVED_OFFSET;
-  fs->regs.reg[6].loc.offset = (long)&sc->esi - new_cfa;
+  fs->regs.reg[6].loc.offset = (long)&sc->REG_NAME(esi) - new_cfa;
   fs->regs.reg[7].how = REG_SAVED_OFFSET;
-  fs->regs.reg[7].loc.offset = (long)&sc->edi - new_cfa;
+  fs->regs.reg[7].loc.offset = (long)&sc->REG_NAME(edi) - new_cfa;
   fs->regs.reg[5].how = REG_SAVED_OFFSET;
-  fs->regs.reg[5].loc.offset = (long)&sc->ebp - new_cfa;
+  fs->regs.reg[5].loc.offset = (long)&sc->REG_NAME(ebp) - new_cfa;
   fs->regs.reg[8].how = REG_SAVED_OFFSET;
-  fs->regs.reg[8].loc.offset = (long)&sc->eip - new_cfa;
+  fs->regs.reg[8].loc.offset = (long)&sc->REG_NAME(eip) - new_cfa;
   fs->retaddr_column = 8;
+  fs->signal_frame = 1;
   return _URC_NO_REASON;
 }
 #endif /* not glibc 2.0 */