C++ Exception object layout

DE-DINECHIN,CHRISTOPHE (HP-Cupertino,ex1) christophe_de-dinechin at hp.com
Mon Dec 4 19:40:09 UTC 2000


Ravi,


I think the code example is correct. The text is misleading, but I think the
intent is that the second occurence of "exception object" in 2.2.1 refered
to the C++ object being thrown, as explained in a further paragraph in
2.2.1:

By convention, a __cxa_exception pointer points at the C++ object
representing the exception being thrown, immediately following the header.
The header structure is accessed at a negative offset from the
__cxa_exception pointer. This layout allows consistent treatment of
exception objects from different languages (or different implementations of
the same language), and allows future extensions of the header structure
while maintaining binary compatibility. 

To clarify, I propose we rephrase the initial paragraph from:

A C++ exception object consists of a header, which is a wrapper around an
unwind object header with additional C++ specific information, followed by
the exception object itself. The structure of the header is as follows: 

to:

A complete C++ exception object consists of a header, which is a wrapper
around an unwind object header with additional C++ specific information,
followed by the thrown C++ exception object itself. The structure of the
header is as follows: 

 

Regards

Christophe de Dinechin

 



> -----Original Message-----
> From: owner-cxx-abi at corp.sgi.com [ mailto:owner-cxx-abi at corp.sgi.com
<mailto:owner-cxx-abi at corp.sgi.com> ]On
> Behalf Of Narayanaswamy, Ravi
> Sent: Thursday, November 30, 2000 10:09 AM
> To: cxx-abi at baalbek.engr.sgi.com
> Subject: C++ Exception object layout
>
>
> In section 2.2.1 C++ Exception Objects,  the text part says
> that the unwind
> header
> structure is followed by the exception object itself, where
> as the layout
> of the structure is just the opposite.  Can someone tell me
> which is the
> correct
> one.
> Below is part of the section.
> Thanks
> Ravi
> Intel Corporation.
>
> 2.2.1 C++ Exception Objects
> A C++ exception object consists of a header, which is a
> wrapper around an
> unwind object header with additional C++ specific
> information, followed by
> the exception object itself. The structure of the header is
> as follows:
>
>   struct __cxa_exception {
>       std::type_info *        exceptionType;
>       void (*exceptionDestructor) (void *);
>       unexpected_handler      unexpectedHandler;
>       terminate_handler       terminateHandler;
>       __cxa_exception *       nextException;
>
>       int                     handlerCount;
>       int                     handlerSwitchValue;
>       const char *            actionRecord;
>       const char *            languageSpecificData;
>       void *                  catchTemp;
>       void *                  adjustedPtr;
>
>       _Unwind_Exception       unwindHeader;
>    };
>
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/cxx-abi-dev/attachments/20001204/8408a1ba/attachment.html>


More information about the cxx-abi-dev mailing list