How to attach a process in gdb How to attach a process in gdb unix unix

How to attach a process in gdb


Try one of these:

gdb -p 12271gdb /path/to/exe 12271gdb /path/to/exe(gdb) attach 12271


The first argument should be the path to the executable program. So

gdb progname 12271


With a running instance of myExecutableName having a PID 15073:

hitting Tab twice after $ gdb myExecu in the command line, will automagically autocompletes to:

$ gdb myExecutableName 15073

and will attach gdb to this process. That's nice!