gdblib: add ability to attach to an already running program

introduce NewGDBWithPID to attach to an already running program (by PID)
refactor common parts of NewGDB and NewGDBWithPID into newGDB.