On 6/5/07, Kevin O'Connor <[EMAIL PROTECTED]> wrote: > On Sun, Jun 03, 2007 at 11:09:34PM +0100, Pedro Alves wrote: > > Kevin O'Connor wrote: > > > So, is it possible to have mingw32ce install a global SEH handler that > > > just translates the exception into an sjlj one? That is, can we > > > modify the standard crt0.S file so that it causes wince exceptions to > > > raise C++ exceptions that g++ can then handle? > > > > > > > Maybe, but it would be tricky. > >[...] > > The cegcc's crt0.S, start.c and __eh_handler.S files implement > > something similar which may help as a starting point. > > Hrmm. I have another problem - it looks like gcc will optimize away > try/catch blocks if it doesn't think the code can throw an exception. > If we went down this route, would it be possible to prevent gcc from > doing that? >
I don't know if it is possible with a command line option, but the obvious workaround is to insert a call into a dummy function in the try scope. Maybe asking at gcc-help@ will yield better results. > > > However, I'm a bit concerned with using IsBad{Read,Write}Ptr. > > You're right, the WinCE version of the docs isn't clear. I've seen > > several discussions on IsBad*Ptr, and always understood it as using > > a __try/__except block inside. > > I'm not sure how it would do that. What would IsBadWritePtr(x, 400) > actually write to memory? If it did actually generate extra > read/write memory accesses that would be really bad - in haret we use > these routines to get at memory mapped registers, and extra accesses > could confuse the chips. > I don't know MSFT's implementation, but here is one: http://www.google.com/codesearch?hl=en&q=+isbadwriteptr+show:5v_C0idOToQ:_iDKRUTKWrM:Y2l423JHiIo&sa=N&cd=4&ct=rc&cs_p=http://www.acc.umu.se/~bosse/libcpp2.zip&cs_f=libcpp/src/virtual.c#a0 It ors (|=) page boundary address values with 0. Of course it would be a problem for memory mapped registers. On the other hand, reactos', Wine's or Rewinds implementations should be more close to what Windows does. They use VirtualQuery: http://www.google.com/codesearch?hl=en&q=+isbadwriteptr+show:BwznxkJ_dvg:2wkRGv-GtGA:FgDW0L8NqJ8&sa=N&cd=13&ct=rc&cs_p=ftp://ftp.heanet.ie/mirrors/download.sourceforge.net/pub/sourceforge/r/re/reactos/reactos-0.2.4-rc1-src.zip&cs_f=reactos/lib/kernel32/mem/isbad.c#a0 ... which will not catch problems other than access violations. Other than doing the dangerous work in a MSVC built dll, I'm out of ideas. 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