If you need to hook the currently running program in another virtual terminal (lost access of it or something likely, I see there're some people mentioned), you can redirect it. For example, if your new virtual terminal is:
tty
/dev/pts/16
$ tty
/dev/pts/16
Attach gdbgdb to your program (find the pidpid with psps and grepgrep), and
(gdb) close(0)
(gdb) close(1)
(gdb) call open("/dev/pts/16", 2, 0)
(gdb) call open("/dev/pts/16", 2, 1)
(gdb) close(0)
(gdb) close(1)
(gdb) call open("/dev/pts/16", 2, 0)
(gdb) call open("/dev/pts/16", 2, 1)
Then quit gdbgdb, you can interact with it from the new terminal.