This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Proposal : Implement SEH exceptions into [ce]gcc
- From: mosfet <forumer at smartmobili dot com>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 29 Nov 2008 13:04:19 +0100
- Subject: Proposal : Implement SEH exceptions into [ce]gcc
Hi,
I am working on mobile CE devices and I use cegcc (when it's possible) to
developp software.
There is one feature I miss with gcc called SEH exceptions and since I have
seen a recent post
about SEH x64 I think it's the right moment to talk about it.
First SEH exceptions exists in two kinds :
1) SEH called "frame-based" and I think that historically it was the first
kind of implementation. This
is described here
http://www.microsoft.com/msj/0197/exception/exception.aspx.
I think this mechanism is used only on x86(32 bits) because it relies on a
specific register FS:[0] and is based on a linked list.
2) SEH called "table-based" used on all other platforms(x64, ARM, MIPS,
...) than x86.
In this case exception info are stored into a .pdata section (at least on
ARM not sure about x64)
The Function Table (interpreted .pdata section contents)
vma: Begin Prolog Function Flags Exception EH
Address Length Length 32b exc Handler Data
00014000 00011008 00000004 00000015 1 1 00011090 000120dc
00014008 0001105c 00000001 00000009 1 0 e24bd010 e89da810
00014010 000110a0 00000002 00000093 1 0 e12fff1c 00013004
00014018 000112f4 00000004 00000030 1 1 00011090 000120f0
00014020 000113b4 00000001 0000000b 1 0 e91b6810 e12fff1e
00014028 000113e0 00000001 0000001b 1 0 0001305c 00013058
00014030 0001144c 00000001 00000041 1 0 00013040 0001303c
00014038 00011550 00000001 00000006 1 0 00013070 00013074
00014040 0001157c 00000002 0000000e 1 0 01b0c820 012fff1e
00014048 000115c0 00000001 00000014 1 0 00013054 0000b064
typedef struct _SCOPE_TABLE {
ULONG Count;
struct
{
ULONG BeginAddress;
ULONG EndAddress;
ULONG HandlerAddress;
ULONG JumpTarget;
} ScopeRecord[1];
} SCOPE_TABLE, *PSCOPE_TABLE;
SEH and gcc seems to be a long story because someone called Casper
Hornstrup already had implemented
frame-based SEH in 2003 for gcc 3.2 but his patch was never accepted for
some bad reasons(it's a MS thing, Borland patents, ...).
So I have proposed an internship to one student and he will try to
implement table-based SEH exceptions into cegcc.
He will work on it for six months, three days a week so I hope he will find
some help on this ML.
Normally this work will also benefit to x64 because the mechanism is almost
the same.
If you have suggestions/remarks/advice or if you want to participate please
let us know.
Some resources :
[Frame Based SEH]
http://www.microsoft.com/msj/0197/exception/exception.aspx
[Table Based SEH on X64 - available only through Google cache]
http://209.85.129.132/search?q=cache:ycabCQnoeFoJ:www.osronline.com/article.cfm%3Farticle%3D469+SEh+x64&hl=fr&ct=clnk&cd=1&gl=fr
[Table Based SEH on ARM]
http://code-factor.blogspot.com/2007/04/windows-ce-seh-for-arm-with-gcc.html
[Misc]
http://code-factor.blogspot.com/2007/09/windows-seh-revisited.html
http://blogs.msdn.com/jaredpar/archive/2008/01/11/mixing-seh-and-c-exceptions.aspx
http://cygwin.com/ml/cygwin/2002-08/msg01598.html
Vincent Richomme
http://www.smartmobili.com