This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello, Suppose you have a directory called "root", inside which you have a directory called "foo". You also have an executable called "foo" in your PATH that you would like to debug. Suppose now that you launch gdb from "root" using the following command: % gdb foo Here is what is going to happen: << GNU gdb 2002-04-17-cvs [...] This GDB was configured as "i686-pc-linux-gnu"..."/bonn.a/brobecke/gdb-public-ssh/gdb": not in executable format: Is a directory >> As you see, GDB found directory "foo" in the current directory, and thought it was the executable it was asked to debug. More generally, this problem can also happen if GDB finds in the PATH a directory sharing the same name before the executable. For instance, say your PATH is ~/bin:/usr/local/bin:/usr/bin, and that the directory ~/bin/sh exists, invoking GDB using the following command from your home directory will also demonstrate the problem. % gdb sh This is because openp does not verify that the file it opens is a regular file (ie not a directory, or a device, etc). From the description of this function, and the name of the parameters, it seems that this was the intent, and the attached patch fixes this. 2002-04-18 Joel Brobecker <brobecker@gnat.com> * source.c (is_regular_file): New function. (openp): Check wether file to open is a regular file to avoid opening directories. I verified that this patch does not introduce any regression: Summary 1 2 FAIL 60 60 PASS 8242 8242 XFAIL 170 170 XPASS 11 11 Differences: 0 -- Joel
Attachment:
source.c.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |