<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Dear Andrew,<div><br></div><div>Thank you very much.  A command like “info catch” would be very handy right now.</div><div><br></div><div>I put a breakpoint on RuntimeDyld::registerEHFrames and on entry the registers read as shown below.  It doesn’t matter if I compile the example with the old compiler (that generates code that works) or the new compiler (that generates code that terminates when the exception is thrown)   “rdx” == 0x0 in both cases.  So I don’t think that is the source of the problem.</div><div><br></div><div>I’m narrowing down on the problem by hacking my compiler to load a module from a bitcode file rather than generate a new module and systematically changing the new generated code into the old generated code.</div><div><br></div><div><div><font face="Courier">On entry to RuntimeDyld::registerEHFrames</font></div><div><font face="Courier">       rax = 0x00007f8518441c70</font></div><div><font face="Courier">       rbx = 0x00007f8518441ba0</font></div><div><font face="Courier">       rcx = 0x00007f8519923600</font></div><div><font face="Courier">       rdx = 0x0000000000000000   <<<< argument 3  Size</font></div><div><font face="Courier">       rdi = 0x00007f8518441bd8   <<<< argument 1  Addr</font></div><div><font face="Courier">       rsi = 0xffffffffffffffff   <<<< argument 2  LoadAddr</font></div><div><font face="Courier">       rbp = 0x00007fff5625e390</font></div><div><font face="Courier">       rsp = 0x00007fff5625e2a8</font></div><div><font face="Courier">        r8 = 0x00000000000003ff</font></div><div><font face="Courier">        r9 = 0x00007f8519921600</font></div><div><font face="Courier">       r10 = 0x00000001139d8000</font></div><div><font face="Courier">       r11 = 0x0000000000000000</font></div><div><font face="Courier">       r12 = 0x00007fff5625e2e0</font></div><div><font face="Courier">       r13 = 0x00007f8518441bd8</font></div><div><font face="Courier">       r14 = 0x00007f8518441c50</font></div><div><font face="Courier">       r15 = 0x00007f8518441b10</font></div><div><font face="Courier">       rip = 0x000000010b1c1bb0  clasp_boehm_o`llvm::RuntimeDyld::registerEHFrames()</font></div><div><font face="Courier">    rflags = 0x0000000000000257</font></div><div><font face="Courier">        cs = 0x000000000000002b</font></div><div><font face="Courier">        fs = 0x0000000000000000</font></div><div><font face="Courier">        gs = 0x0000000017da0000</font></div></div><div><font face="Courier"><br></font></div><div><table class="memname" style="font-family: 'Lucida Grande', Verdana, Geneva, Arial, sans-serif; font-size: 13px; line-height: 16px; white-space: nowrap; font-weight: bold; margin-left: 6px; color: rgb(37, 53, 85); background-color: rgb(226, 232, 242);"><tbody><tr><td class="memname" style="margin-left: 6px;">void <a class="el" href="http://llvm.org/docs/doxygen/html/classllvm_1_1RTDyldMemoryManager.html#a34aa575afca6c18d934c5fd87da71043" style="color: rgb(70, 101, 162); text-decoration: none;">llvm::RTDyldMemoryManager::registerEHFrames</a></td><td>(</td><td class="paramtype">uint8_t * </td><td class="paramname" style="color: rgb(96, 32, 32);">Addr, </td></tr><tr><td class="paramkey" style="text-align: right;"></td><td></td><td class="paramtype">uint64_t </td><td class="paramname" style="color: rgb(96, 32, 32);">LoadAddr, </td></tr><tr><td class="paramkey" style="text-align: right;"></td><td></td><td class="paramtype">size_t </td><td class="paramname" style="color: rgb(96, 32, 32);">Size </td></tr><tr><td></td><td>)</td><td></td><td><code>[override, virtual]</code></td></tr></tbody></table><div><br></div></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><div><div>On Apr 9, 2015, at 2:43 PM, Kaylor, Andrew <<a href="mailto:andrew.kaylor@intel.com">andrew.kaylor@intel.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="WordSection1" style="page: WordSection1;"><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">Hi Christian,<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">I suspect that at least some of the details depend on what platform you’re working on.  I believe that MCJIT attempts to register eh frame information for either MachO or ELF objects (though for some ELF platforms nothing actually happens).  What happens to it after that is a darker area, at least for me.<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">Apparently there was a GDB command that did just what you want -- “info catch” -- but I had never used it and it has been removed.  It’s too bad because it sounds like a nice feature.  It was supposed to dump a list of catch handlers for whatever frame you’re looking at.  I suspect, however, that it would have just confirmed that your catch handler isn’t properly hooked up without being helpful in figuring out why.<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">You could try debugging the RuntimeDyld code that registers eh frames and see if that looks right.  RuntimeDyld::registerEHFrames() might be a helpful starting point.<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">-Andy<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></div><div><div style="border-style: solid none none; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0in 0in;"><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><b><span style="font-size: 10pt; font-family: Tahoma, sans-serif;">From:</span></b><span style="font-size: 10pt; font-family: Tahoma, sans-serif;"><span class="Apple-converted-space"> </span><a href="mailto:llvmdev-bounces@cs.uiuc.edu">llvmdev-bounces@cs.uiuc.edu</a> [<a href="mailto:llvmdev-bounces@cs.uiuc.edu">mailto:llvmdev-bounces@cs.uiuc.edu</a>]<span class="Apple-converted-space"> </span><b>On Behalf Of<span class="Apple-converted-space"> </span></b>Christian Schafmeister<br><b>Sent:</b><span class="Apple-converted-space"> </span>Wednesday, April 08, 2015 10:09 PM<br><b>To:</b><span class="Apple-converted-space"> </span>LLVM Developers Mailing List<br><b>Subject:</b><span class="Apple-converted-space"> </span>[LLVMdev] Looking for advice on how to debug a problem with C++ style exception handling code that my compiler generates.<o:p></o:p></span></div></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p> </o:p></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p> </o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">Hi,<o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p> </o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">I’m looking for advice on how to debug a problem with my exception handling code.  <o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">I’m asking a specific question here - but general advice on how to debug something like this would be greatly appreciated.<o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p> </o:p></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">Is there any way to get a list of landing pad clauses that are active at a particular point in a program?<br>I'd like to get something like a backtrace but listing all active landing pad clauses. The typeids of the C++ types <br>I'm trying to debug a problem where an exception that I'm throwing is not being caught.   <o:p></o:p></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">I'm generating JITed code with LLVM and landing pads and I've got shared libraries - lots of things going on that could potentially be going wrong.<o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p> </o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">A list of the pointer values like @_ZTIN4core9DynamicGoE is what I’m looking for.  Then I could compare that to the typeids that I know should be in that list.<o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p> </o:p></div></div><div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-family: Courier;">"(TRY-0).landing-pad":                            ; preds = %"(TRY-0).normal-dest14", %"(TRY-0).tagbody-B-1", %"(TRY-0).normal-dest10", %"(TRY-0).normal-dest9", %"(TRY-0).normal-dest8", %"(TRY-0).normal-dest", %"(TRY-0).tagbody-#:G1621-0"</span><o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-family: Courier;">  %14 = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0</span><o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-family: Courier;">          catch i8* @_ZTIN4core9DynamicGoE</span><o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-family: Courier;">          catch i8* @_ZTIN4core10ReturnFromE, !dbg !26</span><o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-family: Courier;">  %15 = extractvalue { i8*, i32 } %14, 0, !dbg !26</span><o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-family: Courier;">  %16 = extractvalue { i8*, i32 } %14, 1, !dbg !26</span><o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-family: Courier;">  %17 = call i32 @llvm.eh.typeid.for(i8* @_ZTIN4core9DynamicGoE), !dbg !26</span><o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-family: Courier;">  %18 = icmp eq i32 %16, %17, !dbg !26</span><o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-family: Courier;">  br i1 %18, label %"(TRY-0).handler-block14470", label %"(TRY-0).dispatch-header19", !dbg !26</span><o:p></o:p></div></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p> </o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-family: Arial, sans-serif;">I’m getting this error when I throw a core::Unwind exception and I’m certain that there is a landing pad with that clause.</span><o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p> </o:p></div></div><div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-family: Courier;">libc++abi.dylib: terminating with uncaught exception of type core::Unwind</span><o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-family: Courier;">../../src/gctools/<a href="http://memorymanagement.cc/" style="color: purple; text-decoration: underline;">memoryManagement.cc</a>:75 Trapped SIGABRT - starting debugger</span><o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-family: Courier;">ABORT was called!!!!!!!!!!!!</span><o:p></o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-family: Courier;"> </span></div></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p> </o:p></div></div><div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;">I’ve written a Common Lisp compiler that uses LLVM as the backend and it interoperates with C++ code and I use C++ exception handling for non-local exits.</div></div></div></div></blockquote></div><br></div></body></html>