This is the mail archive of the gdb-patches@sourceware.org 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,
We are using the FILENAME_CMP macro in GDB quite a bit, and it is
currently defined in include/filenames.h as:
#define FILENAME_CMP(s1, s2) strcasecmp(s1, s2)
This is for "DOSish" filesystems. For other filesystems, it's defined as
a straight strcmp:
#define FILENAME_CMP(s1, s2) strcmp(s1, s2)
I came across a case where the DWARF debug info unfortunately used '\'
as the directory separator in one case (in the .debug_info section),
while using '/' in another case (in the .debug_line section).
As a result, FILENAME_CMP returned that the following two files were
not equal:
c:\cygwin\home\brobecke\tgdb\ex\\foo.adb
c:/cygwin/home/brobecke/tgdb/ex//foo.adb
This causes the following problem in GDB, when we compile the unit
by giving GCC the full path name to the associated file, such as:
% gcc -c -g c:\full\path\to\foo.adb
The GDB error looks like this:
% gdb foo
(gdb) b foo.adb:3
No line 3 in file "c:\cygwin\home\brobecke\tgdb\ex\\foo.adb".
I propose to add a new filename_cmp function to libiberty:
- On Unix, no change, it calls strcmp
- On Windows, we make slash and backslash equal.
This is a modest improvement, since there are many other things we
can do to enhance it (such as normalizing the path so that '//' and '/'
are treated as equal for instance). But this paves the path for
further improvements of that sort. And in the meantime, if fixes
the problem we are facing.
For that, I added a new file, filename_cmp.c, updated the Makefile
to add this file to the list of required objects, and then changed
the FILENAME_CMP define to unconditionally call this new function.
libiberty/ change:
2007-03-28 Joel Brobecker <brobecker@adacore.com>
* filename_cmp.c: New file.
* Makefile.in (CFILES): Add filename_cmp.c.
(REQUIRED_OFILES): Add filename_cmp.o
(filename_cmp.o): New rule.
include/ change:
2007-03-28 Joel Brobecker <brobecker@adacore.com>
* filenames.h (FILENAME_CMP): Adjust define to call filename_cmp
regardless of the type of file system.
Tested on x86-linux and x86-windows, without any regression (using
the GDB testsuite).
OK to apply?
Thank you,
--
Joel
Attachment:
filename_cmp.c
Description: Text document
Attachment:
filename_cmp.diff
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |