Catching a hot potato

Steven Schveighoffer schveiguy at yahoo.com
Mon Oct 17 05:58:11 PDT 2011


On Sun, 16 Oct 2011 12:49:22 -0400, Norbert Nemec  
<Norbert at nemec-online.de> wrote:

> In fact, I have been wondering about the very same issue. Indeed, it  
> seems to be possible to catch SIGSEGV in userspace, there even is a  
> library for this
>
> 	http://libsigsegv.sourceforge.net/
>
> I have never used it myself, but it would certainly be interesting to  
> hear about any experience you might make.

Note that this is intended to allow user space page-fault handling.

A segmentation fault means memory that is not allocated is written to.   
The underlying cause is actually a hardware page fault, which cues the OS  
to handle it.  Many times, it's handled by the OS simply loading the  
missing page from swap, and you never get the segv signal.  If the OS  
isn't aware of the memory being valid, it issues a SEGV signal to the  
process.

The libsigsegv is for doing funky things like loading pages from a  
database or something that the OS does not support.  It's not for handling  
seg faults due to memory corruption.

-Steve


More information about the Digitalmars-d mailing list