Ctrl+Z regularly at the shell to temporarily stop a program and then continue its running using the
fg command. However, doing the same in GDB does not work as expected:
Ctrl+Z. GDB catches it and prints out a message saying
SIGTSTP has been received.
continue does not continue the execution of the program. The program keeps getting stopped again and prints this message:
(gdb) c Continuing. Program received signal SIGTSTP, Stopped (user). [Switching to Thread 0x7fffe7e28700 (LWP 1492)] 0x00007ffff5b5112d in poll () at ../sysdeps/unix/syscall-template.S:81 81 T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
To view the signals handled by GDB and how they are handled:
(gdb) info signals
(gdb) info signal SIGTSTP Signal Stop Print Pass to program Description SIGTSTP Yes Yes Yes Stopped (user)
(gdb) handle SIGTSTP nopass
continuenow and the program continues from where it was stopped.
Tried with: GDB 7.7.1 and Ubuntu 14.04