This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Finding the type of an exception


On Sun, Oct 29, 2006 at 05:15:47PM -0500, Kulkarni, Mayuresh (IT) wrote:
> Hello,
> 
> I am looking at a core generated by a C++ process because a throw spec
> was violated by a function.
> 
> The concerned frame in the stack trace is :
> #5  0xf65c2485 in __cxa_call_unexpected (exc_obj_in=0xb58cbb4) at
> /sw/gcc/src/libstdc++-v3/libsupc++/eh_personality.cc:485
> 
> 
> At this point in the process (after std::unexpected() has been called
> and we end up in the above function), is it still somehow possible to
> deduce the type of the exception from the exc_obj_in void * argument?
> Say by trying to interpret the above void * argument as a std::exception
> (from other reasons, I am pretty sure that this was a std::exception)
> and then doing what typeid does to get at the type_info ?

The best place to look for more information about this is the common
C++ ABI document; it's named for Itanium, but don't let that throw you
off, it is actually used with only minor variations (such as the sizes
of types) on other platforms.  You can learn more about it here:

  http://www.codesourcery.com/cxx-abi/abi.html
  http://www.codesourcery.com/cxx-abi/abi-eh.html

The object you've got there is a __cxa_exception, if I'm remembering
how this works right.  If so then the first pointer is going to be to a
type_info.

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]