I had put a simple trap instruction to simulate a breakpoint on the inferior, but when this instruction is reached I got a CLD_KILLED instead of CLD_SIGTRAP, like the one below.
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=12668, si_uid=10157, si_status=SIGTRAP, si_utime=2692, si_stime=875}
It seems that gdb is able to prevent SIGTRAP to kill the inferior by using the command "handle SIGSTOP nopass".
How can I do it in C?
Thanks