start gdb using a pid
c, dbx, gdb, process
Solution
There are two ways.
From the command line, include the pid as an argument after the executable name:
gdb /path/to/prog PID
From within gdb, you can use the attach command:
gdb /path/to/prog
gdb> attach PID
While the specifying on the command line is more concise, there is a slight risk that if you have a core file that has a name that is the same as the pid (i.e. for pid 2345, the core file would have to be named "2345") then gdb will open the core file. Admittedly, the chance of this happening is minuscule.
Problem
In general i see the process's `pid` which is running in the background and start dbx on that process using the command `dbx -a <pid>` similarly how could i do it using gdb?