I've been using gdb normally for 1 or 2 projects. I.e. I invoke gdb --args prog args
. gdb runs in the same tty as the program I'm debugging.
However my latest project is modifying the dtach utility. This is a program like screen, so the tty's are redirected elsewhere, thus I have to use gdb's attach functionality.
The problem with gdb attach is that obviously you can't attach from the very beginning as you need to run the program first in order to get a pid to attach to.
Is there any way I can get a program to wait at a point until gdb is attached?
I can't use gdbserver as I'm on cygwin. Also I tried using pause()
, but that just hung when I tried to continue.