<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">In 2.6 (which I have not checked to see if any updates exist for the release):<div><br></div><div>- line 3992 in SelectionDAGBuild.cpp, in function:</div><div><br></div><div>const char *SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic)</div><div><br></div><div>This is is beginning of the IR Function to MachineFunction lowering for eh_selector_X</div><div><br></div><div>- llvm::AddCatchInfo for function:</div><div><br></div><div>void AddCatchInfo(CallInst &I, MachineModuleInfo *MMI, MachineBasicBlock *MBB) in SelectionDAGBuild.cpp</div><div><br></div><div>This is where the arguments to llvm.eh.selector.X are handled during above lowering.</div><div><br></div><div>Note: I have never tested with 2.6 so I don't know what the possible issues are for this version.</div><div><br></div><div>In 2.7:</div><div><br></div><div>- llvm::SelectionDAGBuilder::visitIntrinsicCall </div><div>at source: case eh_selector:<span class="Apple-tab-span" style="white-space:pre">     </span></div><div><br></div><div>This is is beginning of the IR Function to MachineFunction lowering for eh_selector</div><div><br></div><div><div>- llvm::AddCatchInfo for function:</div><div><br></div><div>void AddCatchInfo(CallInst &I, MachineModuleInfo *MMI, MachineBasicBlock *MBB) in FunctionLoweringInfo.cpp</div><div><br></div><div>This is where the arguments to llvm.eh.selector are handled during above lowering.</div><div><br></div><div>Hope this helps</div><div><br></div><div>Garrison</div></div><div><br></div><div><div><div><div>On Jan 22, 2010, at 8:55, James Williams wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br><br><div class="gmail_quote">2010/1/22 Garrison Venn <span dir="ltr"><<a href="mailto:gvenn.cfe.dev@gmail.com">gvenn.cfe.dev@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="word-wrap: break-word;">Yes. The issue here, as you pointed out, is that your personality function is not called at all.<div>Even if you did nothing in the personality function, associated with the setup caused by</div>
<div>llvm.eh.selector, but returned _URC_CONTINUE_UNWIND (8), it should still be called.</div><div>Your results are acting like either dwarf exception header info is not emitted (llvm::DwarfExceptionHandling = true; </div>
<div>not executed could affect this), _Unwind_RaiseException(...) is not being called, or the default  or another personality </div><div>function (_gcc_personality_v0(...)) is called instead by the unwind infrastructure. Although you implied you </div>
<div>dumped the exception headers and found your personality function, I can if you wish instead given you breaks for </div><div>gbd so you can see if lvm.eh.selector is correctly prepping your personality function for eventual dwarf emission.</div>
<div><br></div></div></blockquote><div>It looks like __gxx_personality_v0 is getting called at least once but I might expect
that to tear down the frame of the C++ test function calling throw? It then disappears into std::terminate() and the aborts.<br><br>If there is some sane way I can debug this it would be really handy so if you can tell me some good spots to set breakpoints I'd be grateful. As it is I'm stepping through reams of unfamiliar assembly with little clue what's going on.<br>
<br>-- James<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div style="word-wrap: break-word;"><div></div><font color="#888888"><div>
Garrison</div></font><div><div></div><div class="h5"><div> </div><div><div><div>On Jan 22, 2010, at 8:06, James Williams wrote:</div><br><blockquote type="cite"><br><br><div class="gmail_quote">2010/1/22 Duncan Sands <span dir="ltr"><<a href="mailto:baldrick@free.fr" target="_blank">baldrick@free.fr</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Garrison,<div><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
%7 = invoke i8* (...)* bitcast (i32 (%struct._Unwind_Exception*)* @_Unwind_RaiseException to i8* (...)*)(i64* %6)<br>
          to label %8 unwind label %.finally_pad  ; <i8*> [#uses=0]<br>
<br>
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<br>
the invoke instruction, not from a frame that contains the invoke instruction.<br>
</blockquote>
<br></div>
I'm pretty sure this doesn't matter.  It seems to me more likely that the<br>
exception object was not initialized properly.<br></blockquote><div>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?<br>

<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Ciao,<br><font color="#888888">
<br>
Duncan.<br>
<br>
</font></blockquote></div><br>
</blockquote></div><br></div></div></div></div></blockquote></div><br>
</blockquote></div><br></div></div></body></html>