Hi Garrison,> %7 = invoke i8* (...)* bitcast (i32 (%struct._Unwind_Exception*)* > @_Unwind_RaiseException to i8* (...)*)(i64* %6) > to label %8 unwind label %.finally_pad ; <i8*> [#uses=0] > > I am not sure this is going to work, at least from the way I've played > with the system. > In my examples the _Unwind_RaiseException(...) is called from a frame > (function) called via > the invoke instruction, not from a frame that contains the invoke > instruction.I'm pretty sure this doesn't matter. It seems to me more likely that the exception object was not initialized properly. Ciao, Duncan.
Hey Duncan, Yup, you are correct. Just tested to make sure. Invoking _Unwind_RaiseException(...) directly still sets up personality function (and calls it during exception search/cleanup), in corresponding frame headers for frame containing invoke. Well ... ok, at least in a JIT execution environment. :-) I thought maybe __gcc_personality_v0(...) was being called instead. However, I also just tested with a garbage exception (offset exception ptr by 1000), being passed in to _Unwind_RaiseException(...), with the result that the personality function was still called with the cleanup landing pad correctly found. This personality ignored the exception pointer. So I don't believe the problem is with the exception data since his personality function is not invoked. I would test the code directly but I don't yet have non-JIT experience with LLVM. Garrison On Jan 22, 2010, at 6:51, Duncan Sands wrote:> Hi Garrison, > >> %7 = invoke i8* (...)* bitcast (i32 (%struct._Unwind_Exception*)* @_Unwind_RaiseException to i8* (...)*)(i64* %6) >> to label %8 unwind label %.finally_pad ; <i8*> [#uses=0] >> I am not sure this is going to work, at least from the way I've played with the system. In my examples the _Unwind_RaiseException(...) is called from a frame (function) called via >> the invoke instruction, not from a frame that contains the invoke instruction. > > I'm pretty sure this doesn't matter. It seems to me more likely that the > exception object was not initialized properly. > > Ciao, > > Duncan.
Ah! I forgot to mention I'm doing my tests with 2.7, NOT 2.6; also on OS X 10.6.2. Garrison On Jan 22, 2010, at 7:44, Garrison Venn wrote:> Hey Duncan, > > Yup, you are correct. Just tested to make sure. Invoking _Unwind_RaiseException(...) directly still sets up > personality function (and calls it during exception search/cleanup), in corresponding frame headers for frame > containing invoke. Well ... ok, at least in a JIT execution environment. :-) > > I thought maybe __gcc_personality_v0(...) was being called instead. > > However, I also just tested with a garbage exception (offset exception ptr by 1000), being passed in to _Unwind_RaiseException(...), > with the result that the personality function was still called with the cleanup landing pad correctly found. This personality ignored the > exception pointer. So I don't believe the problem is with the exception data since his personality function is not invoked. > > I would test the code directly but I don't yet have non-JIT experience with LLVM. > > Garrison > > On Jan 22, 2010, at 6:51, Duncan Sands wrote: > >> Hi Garrison, >> >>> %7 = invoke i8* (...)* bitcast (i32 (%struct._Unwind_Exception*)* @_Unwind_RaiseException to i8* (...)*)(i64* %6) >>> to label %8 unwind label %.finally_pad ; <i8*> [#uses=0] >>> I am not sure this is going to work, at least from the way I've played with the system. In my examples the _Unwind_RaiseException(...) is called from a frame (function) called via >>> the invoke instruction, not from a frame that contains the invoke instruction. >> >> I'm pretty sure this doesn't matter. It seems to me more likely that the >> exception object was not initialized properly. >> >> Ciao, >> >> Duncan. >
2010/1/22 Duncan Sands <baldrick at free.fr>> Hi Garrison, > > > %7 = invoke i8* (...)* bitcast (i32 (%struct._Unwind_Exception*)* >> @_Unwind_RaiseException to i8* (...)*)(i64* %6) >> to label %8 unwind label %.finally_pad ; <i8*> [#uses=0] >> >> I am not sure this is going to work, at least from the way I've played >> with the system. In my examples the _Unwind_RaiseException(...) is called >> from a frame (function) called via >> the invoke instruction, not from a frame that contains the invoke >> instruction. >> > > I'm pretty sure this doesn't matter. It seems to me more likely that the > exception object was not initialized properly. >Hmm. I've tried a bunch of different ways of creating the exception including calling a C++ function that then does a throw. If I understand right, the personality function should still be offered the foreign exception so it has a chance to call cleanups?> Ciao, > > Duncan. > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100122/2b0395bc/attachment.html>
Yes. The issue here, as you pointed out, is that your personality function is not called at all. Even if you did nothing in the personality function, associated with the setup caused by llvm.eh.selector, but returned _URC_CONTINUE_UNWIND (8), it should still be called. Your results are acting like either dwarf exception header info is not emitted (llvm::DwarfExceptionHandling = true; not executed could affect this), _Unwind_RaiseException(...) is not being called, or the default or another personality function (_gcc_personality_v0(...)) is called instead by the unwind infrastructure. Although you implied you dumped the exception headers and found your personality function, I can if you wish instead given you breaks for gbd so you can see if lvm.eh.selector is correctly prepping your personality function for eventual dwarf emission. Garrison On Jan 22, 2010, at 8:06, James Williams wrote:> > > 2010/1/22 Duncan Sands <baldrick at free.fr> > Hi Garrison, > > > %7 = invoke i8* (...)* bitcast (i32 (%struct._Unwind_Exception*)* @_Unwind_RaiseException to i8* (...)*)(i64* %6) > to label %8 unwind label %.finally_pad ; <i8*> [#uses=0] > > I am not sure this is going to work, at least from the way I've played with the system. In my examples the _Unwind_RaiseException(...) is called from a frame (function) called via > the invoke instruction, not from a frame that contains the invoke instruction. > > I'm pretty sure this doesn't matter. It seems to me more likely that the > exception object was not initialized properly. > Hmm. I've tried a bunch of different ways of creating the exception including calling a C++ function that then does a throw. If I understand right, the personality function should still be offered the foreign exception so it has a chance to call cleanups? > > > Ciao, > > Duncan. > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100122/56a6bb17/attachment.html>