_Unwind_GetCFA

Richard Henderson rth@redhat.com
Thu Apr 3 02:12:00 GMT 2003


I need this to properly implement longjmp_unwind.  Obviously
the sjlj and libunwind versions are just placeholders.

Committed to 3.3 and mainline.


r~


        * libgcc-std.ver (_Unwind_GetCFA): New.
        * unwind-dw2.c (_Unwind_GetCFA): New.
        * unwind-libunwind.c (_Unwind_GetCFA): New.
        * unwind-sjlj.c (_Unwind_GetCFA): New.
        * unwind.h: Declare it.

Index: libgcc-std.ver
===================================================================
RCS file: /cvs/gcc/gcc/gcc/libgcc-std.ver,v
retrieving revision 1.18
diff -c -p -d -r1.18 libgcc-std.ver
*** libgcc-std.ver	9 Feb 2003 18:35:22 -0000	1.18
--- libgcc-std.ver	3 Apr 2003 02:04:29 -0000
*************** GCC_3.0 {
*** 179,184 ****
--- 179,185 ----
  %inherit GCC_3.3 GCC_3.0
  GCC_3.3 {
    _Unwind_FindEnclosingFunction
+   _Unwind_GetCFA
  }
  
  %inherit GCC_3.4 GCC_3.3
Index: unwind-dw2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind-dw2.c,v
retrieving revision 1.25
diff -c -p -d -r1.25 unwind-dw2.c
*** unwind-dw2.c	11 Mar 2003 20:40:49 -0000	1.25
--- unwind-dw2.c	3 Apr 2003 02:04:29 -0000
*************** _Unwind_GetGR (struct _Unwind_Context *c
*** 173,178 ****
--- 173,186 ----
    return * (_Unwind_Word *) context->reg[index];
  }
  
+ /* Get the value of the CFA as saved in CONTEXT.  */
+ 
+ _Unwind_Word
+ _Unwind_GetCFA (struct _Unwind_Context *context)
+ {
+   return context->cfa;
+ }
+ 
  /* Overwrite the saved value for register REG in CONTEXT with VAL.  */
  
  inline void
Index: unwind-libunwind.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind-libunwind.c,v
retrieving revision 1.4
diff -c -p -d -r1.4 unwind-libunwind.c
*** unwind-libunwind.c	27 Mar 2003 18:13:59 -0000	1.4
--- unwind-libunwind.c	3 Apr 2003 02:04:29 -0000
*************** _Unwind_GetGR (struct _Unwind_Context *c
*** 105,110 ****
--- 105,119 ----
    return ret;
  }
  
+ /* Get the value of the CFA as saved in CONTEXT.  */
+ 
+ _Unwind_Word
+ _Unwind_GetCFA (struct _Unwind_Context *context)
+ {
+   /* ??? Is there any way to get this information?  */
+   return NULL;
+ } 
+ 
  /* Overwrite the saved value for register REG in CONTEXT with VAL.  */
  
  void
Index: unwind-sjlj.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind-sjlj.c,v
retrieving revision 1.12
diff -c -p -d -r1.12 unwind-sjlj.c
*** unwind-sjlj.c	16 Dec 2002 18:20:02 -0000	1.12
--- unwind-sjlj.c	3 Apr 2003 02:04:29 -0000
*************** _Unwind_GetGR (struct _Unwind_Context *c
*** 170,175 ****
--- 170,184 ----
    return context->fc->data[index];
  }
  
+ /* Get the value of the CFA as saved in CONTEXT.  */
+ 
+ _Unwind_Word
+ _Unwind_GetCFA (struct _Unwind_Context *context)
+ {
+   /* ??? Ideally __builtin_setjmp places the CFA in the jmpbuf.  */
+   return NULL;
+ }
+ 
  void
  _Unwind_SetGR (struct _Unwind_Context *context, int index, _Unwind_Word val)
  {
Index: unwind.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind.h,v
retrieving revision 1.9
diff -c -p -d -r1.9 unwind.h
*** unwind.h	5 Mar 2003 13:04:30 -0000	1.9
--- unwind.h	3 Apr 2003 02:04:29 -0000
*************** extern void _Unwind_SetGR (struct _Unwin
*** 138,143 ****
--- 138,146 ----
  extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *);
  extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr);
  
+ /* @@@ Retrieve the CFA of the given context.  */
+ extern _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *);
+ 
  extern void *_Unwind_GetLanguageSpecificData (struct _Unwind_Context *);
  
  extern _Unwind_Ptr _Unwind_GetRegionStart (struct _Unwind_Context *);



More information about the Gcc-patches mailing list