Created attachment 8093 [details] Proposed patch (This is on 7.8, but a quick glance at the source suggests it is also present in more recent versions). Consider the following transcript of a GDB session: $ gdb ... (gdb) file /home/ /home/: Success. ... Clearly, it would be nice if the GDB output were more helpful. (The transcript may seem trivial; however, this problem leads to significantly more confusion in the context of KDevelop's gdb plugin.) I am attaching a patch proposal which changes the behavior to: (gdb) file /home/haehnle /home/haehnle: Is a directory. (gdb) file /home/haehnle/asdfs /home/haehnle/asdfs: No such file or directory. (gdb) file /dev/null /dev/null: Exec format error. (The last case is a bit of an odd one out. Unfortunately, there is no ENOTAREGULARFILE as far as I can tell, and ENOEXEC was the best I could come up with.)
I tripped over this this morning, and came up with a similar patch, posted here: https://sourceware.org/ml/gdb-patches/2015-09/msg00491.html
Patch committed here: https://sourceware.org/ml/gdb-patches/2016-04/msg00461.html