This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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: (libgcc) what does _Unwind_Resume do ?


On Sat, 2007-10-20 at 19:23 +0100, Andrew Haley wrote:
> Sunzir Deepur writes:
>  > Hi Andrew,
>  > 
>  > On 10/20/07, Andrew Haley <aph-gcc@littlepinkcloud.com> wrote:
>  > > Sunzir Deepur writes:
>  > >  > I have noticed that glibc has extensive use of the _Unwind_Resume procedure
>  > >  > Can anyone please explain me what is it ? why is it needed for C programs
>  > >
>  > > It's needed for pthread_cancel.
>  > > It resumes unwinding after a cleanup.
>  > >
>  > > http://www.codesourcery.com/cxx-abi/abi-eh.html
>  > > http://www.mit.edu/~sipb-iap/2004/inside-c/day3/exceptions.html
>  > 
>  > Is the winding relevant only to C++ exception catching ?
>  > If so, why would it be needed when compiling simple C apps ?
> 
> I don't know that it is.
> 

The compiler is not going to make a special case for a single file
C application not using any standard libraries. In all other cases,
the compiler must assume it is compiling only *part* of a possibly
multi-lingual program. Even the linker may be linking only part
of a program, given the existence of shared libraries.

Therefore the exception handling mechanism is unified according
to a binary, platform dependent, ABI (Application Binary Interface)
which is designed to handle C, C++, Java, and other languages
co-existing. You can think of this as a low level '.NET'
or 'virtual machine' at the machine code level.

In that model, C or C++ are merely 'front ends' and the exception
handling architecture exists, even for C. After all we want things
to work right with mixed C/C++ programs.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


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