Right now you can confuse yourself by starting gdb with one file, then attaching to a running program that is executing a different file. (The typical problem here is if the two files have the same name, so you think you are doing the right thing...) gdb could help with this by comparing build-ids, when available, and offering to switch the exec file.
*** Bug 17626 has been marked as a duplicate of this bug. ***