[PATCH] Fix _Unwind_Backtrace for libc++abi built with libgcc.
Logan Chien
tzuhsiang.chien at gmail.com
Wed Jan 21 09:28:31 PST 2015
================
Comment at: src/cxa_personality.cpp:1105
@@ +1104,3 @@
+ // Check the undocumented force unwinding behavior
+ const unsigned _US_FORCE_UNWIND = 8u;
+ bool is_force_unwinding = static_cast<unsigned>(state) & _US_FORCE_UNWIND;
----------------
jroelofs wrote:
> Why not add this to the public interface in include/unwind.h? If we're matching the behavior between gcc's unwinder, then perhaps it makes sense to 'advertise' that fact.
Thanks. I have moved this flag to `unwind.h`.
================
Comment at: src/cxa_personality.cpp:1106
@@ +1105,3 @@
+ const unsigned _US_FORCE_UNWIND = 8u;
+ bool is_force_unwinding = static_cast<unsigned>(state) & _US_FORCE_UNWIND;
+ state = static_cast<_Unwind_State>(static_cast<unsigned>(state) & ~_US_FORCE_UNWIND);
----------------
danalbert wrote:
> It's already a `uint32_t`, what do you need the cast for? If you really do need a cast, use something explicitly sized.
Thanks. Removed.
================
Comment at: src/cxa_personality.cpp:1107
@@ +1106,3 @@
+ bool is_force_unwinding = static_cast<unsigned>(state) & _US_FORCE_UNWIND;
+ state = static_cast<_Unwind_State>(static_cast<unsigned>(state) & ~_US_FORCE_UNWIND);
+
----------------
danalbert wrote:
> jroelofs wrote:
> > rengolin wrote:
> > > Why do you need to clear the forced flag?
> > The _US_* things are a bitmask. Not clearing it means that the switch below won't match it.
> Would be more intention revealing to clear the flag for the switch condition itself.
Some explaination on this: Although `_Unwind_Backtrace()` only uses one of the case, it is required to implement the personality for both `_US_VIRTUAL_UNWIND_FRAME` and `_US_UNWIND_FRAME_STARTING` cases.
p.s. The later case is used by `_Unwind_ForcedUnwind()`. However, it is not working yet. I am debugging at the moment.
http://reviews.llvm.org/D7031
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list