logo       

Re: C++ exceptions: msg#00026

gnu.cegcc.devel

Subject: Re: C++ exceptions

On Wed, Jul 04, 2007 at 11:31:30PM +0100, Pedro Alves wrote:
> Kevin O'Connor wrote:
> > I think future versions of gcc wont guarantee function placement
> > relative to top-level asm statements.
> >
>
> Ah, you're paying attention. :) It will certainly fail today if
> we use -ffunction-sections. If this ever turns into a real problem,
> and we don't have real __try/__except support in the compiler, we
> can craft an __attribute__((seh ("handler")) into gcc. I think that
> is much easier.

I get things reordered today when using -O. Also, I saw on the gcc
website (can't find link now) that they plan on being more aggressive
with this in the future.

> > I'll try to take some of the sample code and integrate it into haret.
> >
>
> Great, please do post here your findings. I'd be curious if you take the
> simplest route of not tweaking the current thread's context and just longjmp
> from the seh handler, and if it brings any real problems (I don't think it's
> safe, but it would be great to be proved wrong).

Attached is what I've done. Oddly, longjmp directly from the handler
seems to work, but returning via EXCEPTION_CONTINUE_EXECUTION fails.
Not sure what I'm doing wrong.

I use my new handlers with:

struct eh_data ehd;
if (start_ehandling(&ehd)) {
while (wcount--)
*vaddr++ = value;
end_ehandling(&ehd);
} else {
Output(C_ERROR "EXCEPTION while writing %08x to address %p",
value, vaddr);
}

Finally, I call init_ehandling at startup.

-Kevin

Attachment: exceptions.h
Description: Text document

Attachment: exceptions.cpp
Description: Text document

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/_______________________________________________
Cegcc-devel mailing list
Cegcc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/cegcc-devel
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise