> Does UNIX have the windows equivalent of the "int 3" instruction that
> will throw a process into the de* (if one exists) or terminate it?
> this proved INCREDIBLY useful in the world of assertions, etc ...
> probably version specific, but I'm specifically interested in
> Free/Open/NetBSD, Linux (RH), and Solaris 7+.
If you're not interested in letting the program continue, this snippet
will do it:
#define PORTABLE_INT3() { char* p = 0; *p = 42; }
("Portable" is defined as systems that trap on accessing memory location
0, which applies at least to PC Unixes and Win95 and up.)
If you want to be more elegant, call abort() -- the main problem with
this is that after the de* pops up, you have to unwind the stack to
get back to the actual fault location. Since this causes a signal, you
will also need a de* that can find its way back from the signal
handler to the code that raised the signal. Not all Unix de*s can
manage that feat.
--
= Warren -- See the *ix pages at http://www.*port.com/~tangent/ix/
=
= ICBM Address: 36.8274040 N, 108.0204086 W, alt. 1714m