I built a new version of GDB and it works properly from terminal. Now I want it to be executed when I run M-x gdb from emacs.
M-x gdb, Emacs will present you with a command-line in the minibuffer, like:
Run gdb (like this): gdb -i=mi something
You can edit this to supply a path to
~/my/install/bin/gdb -i=mi something