GDB: catching a signal and continue debugging
gdb
Solution
The problem is that when you continue a program after a synchronous signal, it reexecutes the same instruction that caused the signal, which means you'll just get the signal again. If you tell it to ignore the signal (either directly or via gdb) it will go into a tight loop reexecuting that instruction repeatedly.
If you want to actually continue the program somewhere after the instruction that causes the signal, you need to manually set the `$pc` register to the next (or some other) instruction before issuing the `continue` command.
Problem
I am trying to catch floating point exception (SIGFPE) in GDB, not pass it to the process and continue debugging onwards. I have given gdb this: ``` handle SIGFPE stop nopass ``` When a SIGFPE occurs GDB stops at the correct place. The problem is I can't and don't know how can I continue debugging. I have tried giving GDB ``` continue ``` or ``` signal 0 ``` but it still hangs on the offending line and refuses to continue. Is there a way to continue debugging after receiving a signal? I am using GDB 7.5.1, which I have compiled myself and I have also tried with GDB 7.4, which comes with my 12.04 Ubuntu distribution. Both have the same behaviour.