logo       

Re: C++ exceptions: msg#00028

gnu.cegcc.devel

Subject: Re: C++ exceptions

On Thu, Jul 05, 2007 at 01:46:30AM +0100, Pedro Alves wrote:
> This is the part I was trying to get right with the macros:
>
> > __asm__(
> > // Data to be placed at start of .text section
> > "\t.section .init\n"
> > "\t.word eh_handler\n"
> > "\t.word 0\n"
> > "start_eh_text:\n"
> >
>
> This is documented to having to be placed immediately before the function it
> corresponds to ...

The trick here is that the default linker script will put sections
labeled with ".init" into the very first part of .text.

$ /opt/mingw32ce/bin/arm-wince-mingw32ce-objdump -Dr out/haret-debug

Disassembly of section .text:

00011000 <___crt_xc_end__>:
11000: 000183b8 streqh r8, [r1], -r8
11004: 00000000 andeq r0, r0, r0

00011008 <WinMainCRTStartup>:
11008: e92d40f0 stmdb sp!, {r4, r5, r6, r7, lr}
1100c: e1a04000 mov r4, r0
11010: e1a05001 mov r5, r1
[...]

Disassembly of section .pdata:

00035000 <.pdata>:
35000: 00011008 andeq r1, r1, r8
35004: cfffff02 svcgt 0x00ffff02

> Anyway,
> Looks nice and simple, I'll give it a try tomorrow too. Thanks.

Thanks. And thanks Danny for your code and comments as well.

BTW, I've attached a newer version. I think I'll check this into
haret's cvs if testing continues to look good.

Sample usage:

TRY_EXCEPTION_HANDLER
{
while (wcount--)
*vaddr++ = value;
}
CATCH_EXCEPTION_HANDLER
{
Output(C_ERROR "EXCEPTION while writing %08x to address %p",
value, vaddr);
}

I still don't know why I can't leave the exception handler with
EXCEPTION_CONTINUE_EXECUTION..

-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