This is the mail archive of the
mailing list for the GDB project.
Re: RFA: attach to a PID using a different exec
> This seems like a bad idea to me. The canonical example is:
> /usr/bin/prog.stripped &
> gdb /home/drow/prog.debug $(pidof prog.stripped)
> I don't want GDB to prompt my to switch to the stripped program...
In my case, it's usually a procedural mistake on my end. The typical
scenario is when I want to debugger GDB, so in one terminal, I start
"gdb my_process", and then on another terminal is start "gdb gdb"
followed by "attach inferior_gdb_pid". The problem is often that
the inferior GDB I started was the one in the path instead of
the one I just built. In all the cases when this occured, GDB switching
binaries from under me would not have been helpful. The error that
occurs is a little cryptic, so this can be improved, but the only
solution to my mistake is a restart of the inferior GDB.