I am using emacs 24.3.1 to write programs (in C and C++ mode).
After compiling the current buffer, I run below command: M-x gud-gdb. Emacs gives a prompt like below: gdb --fullname prog
However, sometimes the "prog" name is not the same as the executable name compiled from current buffer. e.g. I completed five programs prog1, prog2,... prog5, and is currently working on prog6. But M-x gud-gdb gives me gdb --fullname prog5. (I want prog6 instead.)
Is there a way to correct this? Specifically, "correct" means forcing gud-gdb to use current buffer's name (without suffix) as the prog name.
Thanks in advance.
I think emacs uses a heuristic (based on what executable file is more recent or something like that) to figure out the default program to offer.
If your preferences are very specific you could define and use this function:
This function will execute gdb on a file named like the file you are editing without extension.