#include <signal.h>
int main()
{
signal(SIGTRAP, SIG_IGN);
raise(SIGTRAP);
}
When outside a debugger, the `raise`d signal will be ignored (of course, if you want a coredump you can remove the `signal` line).When inside a debugger, requests to ignore `SIGTRAP` have no effect, unlike other signals. That's because this is literally what `SIGTRAP` is for.