Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Handling Segfaults

Name: Anonymous 2016-09-09 22:18

What is the most portable way to catch segfaults together with their addresses and then resuming at the place where it happened? I.e. to handle array out of bounds exception by expanding array.

I know it is done with signal() on POSIX and with SetUnhandledExceptionFilter() on Windows. But you cant define signal() for Windows, because it has its own stripped down version, useful only for the purpose of handling CTRL-C.

Both don't signal() and SetUnhandledExceptionFilter() have no means of recovering from error.

Name: Anonymous 2016-09-18 11:20

>>33
You can implement your own printf and fopen. Anyway, in my case that wont help, because SetUnhandledExceptionFilter requires UNWIND_INFO structs to be generated by compiler, and I wanted to get away without them, because unwind tables greatly increase code size and reside in .xdata section, which has to be loaded into memory. Probably one can add his own .xdata just enough so that top level exception handler will work. All this bloated nonsense is required to maintain compatibility with C++ code, even if you don't use C++ or exceptions.

https://msdn.microsoft.com/en-us/library/ft9x1kdx.aspx?f=255&MSPPError=-2147217396
https://msdn.microsoft.com/en-us/library/ddssxxy8.aspx

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List