[LLVMdev] Looking for advice on how to debug a problem with C++ style exception handling code that my compiler generates.

Christian Schafmeister chris.schaf at verizon.net
Wed Apr 8 22:08:32 PDT 2015


Hi,

I’m looking for advice on how to debug a problem with my exception handling code.  
I’m asking a specific question here - but general advice on how to debug something like this would be greatly appreciated.

Is there any way to get a list of landing pad clauses that are active at a particular point in a program?
I'd like to get something like a backtrace but listing all active landing pad clauses. The typeids of the C++ types 
I'm trying to debug a problem where an exception that I'm throwing is not being caught.   
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.

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.

"(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"
  %14 = landingpad { i8*, i32 } personality i32 (...)* @__gxx_personality_v0
          catch i8* @_ZTIN4core9DynamicGoE
          catch i8* @_ZTIN4core10ReturnFromE, !dbg !26
  %15 = extractvalue { i8*, i32 } %14, 0, !dbg !26
  %16 = extractvalue { i8*, i32 } %14, 1, !dbg !26
  %17 = call i32 @llvm.eh.typeid.for(i8* @_ZTIN4core9DynamicGoE), !dbg !26
  %18 = icmp eq i32 %16, %17, !dbg !26
  br i1 %18, label %"(TRY-0).handler-block14470", label %"(TRY-0).dispatch-header19", !dbg !26

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.

libc++abi.dylib: terminating with uncaught exception of type core::Unwind
../../src/gctools/memoryManagement.cc:75 Trapped SIGABRT - starting debugger
ABORT was called!!!!!!!!!!!!


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150409/33dfb3f0/attachment.html>


More information about the llvm-dev mailing list