Danny Backx wrote:
> I've simplified the _eh_handler_ in
> src/newlib/newlib/libc/sys/wince/startup.c a bit, see attachment.
> 
> This kicks out all the complicated handling in that function, and
> replaces it with a simple message box.
> 


You're removing functionality.  That function does a few things (there
are some log dumps that could 'go away'/'be ifdefs out'):

- converts unaligned accesses to memcpy's.  Questionable if this adds any
real value.  Unaligned accesses should be fixed on the code that produces
them.  Having a handler fix them hides a "bug", and makes programs run
slow.

- implements very rudimentary support for SIGSEGV.

> The downside is that the original (complicated) stuff is gone. I have no
> idea whether this actually worked.
> 

It does.  At least it did many months ago.

> Is replacing this a good idea ?
> 
> My test programs now show a dialog titled "WinCE Exception" and
> containing text such as
>       ILLEGAL_INSTRUCTION
>       Code C000001D
>       Flags 0
> (that's the test program that performs a floating point instruction for
> floating point hardware which isn't on my system), or
>       ACCESS_VIOLATION
>       Code C0000005
>       Flags 0
> when trying to access a NULL pointer.
> 

Should cegcc apps really display dialogs like that?  Maybe
they should do an fprintf (stderr, ...) instead.  I'm thinking
of cegcc console apps over a telnet/ssh for instance.

> Strangely, dividing by 0 doesn't cause such an exception.
> 

Are you sure the compiler didn't optimize the division into nan
or something else?
Try looking at the asm, building without optimization or
do something like:

int main (int argc, char** argv)
{
   return 5/(argc - 1);
}

> I haven't tried this in mingw32ce yet, only in cegcc.
> 

The user should do it himself if he wants it in mingw32ce?

(Any brave soul to implement proper ARM WinCE SEH
support on gcc ?)

Cheers,
Pedro Alves



-------------------------------------------------------------------------
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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to