This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Set _UA_HANDLER_FRAME based on CFA, not IP


The C++ ABI says

_UA_HANDLER_FRAME
  During phase 2, indicates to the personality routine that the current
  frame is the one which was flagged as the handler frame during phase
  1.

It turns out that every personality routine that GCC provides will
return _URC_HANDLER_FOUND based only on the IP, and so will never
return _URC_CONTINUE_UNWIND the first time it sees a stack frame for a
particular IP and then _URC_HANDLER_FOUND when looking at a later
stack frame.  (Apple has a developer who is generating their own
object code and providing their own personality routine, and theirs
apparently doesn't have this property.)

Since the ABI says that it is frames, not object code, which are
flagged, this means the context should be based on the CFA not on the
IP.

uw_identify_context appears to be used only in unwind.inc so this
should not cause any incompatibilities.

Bootstrapped & tested on powerpc-darwin8.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/gcc-unwind-cfacontext.patch===============
2007-05-16  Geoffrey Keating  <geoffk@apple.com>

	* unwind-dw2.c (uw_identify_context): Use the CFA, not the IP.

Index: unwind-dw2.c
===================================================================
--- unwind-dw2.c	(revision 124749)
+++ unwind-dw2.c	(working copy)
@@ -1526,7 +1526,7 @@
 static inline _Unwind_Ptr
 uw_identify_context (struct _Unwind_Context *context)
 {
-  return _Unwind_GetIP (context);
+  return _Unwind_GetCFA (context);
 }
 
 
============================================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]