I have a program that I am trying to reverse, which contains an int3 (0xCC) which emits a SIGTRAP signal, which is then handled by a sighandler defined in sigaction.
The handler performs calculations on certain values.

When I'm debugging with GDB, the SIGTRAP is raised, and the handler does not receive the signal because it is GDB which intercepts it. I need the signal to be caught in order to see what the handler is dynamically returning as a value.

I tried to disable SIGTRAP interception with the command :

handle SIGTRAP nostop noprint noignore  

but I have the following error:

Program terminated with signal SIGTRAP, Trace / breakpoint trap.
The program no longer exists.

My goal is to make sure that I can let the SIGTRAP be intercepted by the sighandler and not by GDB, but still be able to launch the program and place breakpoints.

1 Answer 1


I managed to find a solution.
When the SIGTRAP emitted by the program causes a breakpoint in gdb, I use the command :

signal SIGTRAP

to send the signal to the program (and then to the handler), the program continues as expected.
Don't need to use the "handle" command shown in the question, because it seems to make gdb malfunction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.