[RFA] Use FILENAME_CMP to compare filenames in compare_search_syms.

Joel Brobecker brobecker@adacore.com
Tue Oct 1 09:07:00 GMT 2013


Hello,

While working on an unrelated issue, I noticed that two symbols were
sorted differently on Windows, compared to the other Unix platforms.
I tracked it down to compare_search_syms which compares filenames
using a plain strcmp instead of FILENAME_CMP.

Not sure how to create a testcase...

gdb/ChangeLog:

        * symtab.c (compare_search_syms): Use FILENAME_CMP instead of
        strcmp to compare two symtab filenames.

Tested on x86-windows and x86_64-linux, no regression.
OK to apply?

Thanks,
-- 
Joel

---
 gdb/symtab.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/symtab.c b/gdb/symtab.c
index dbff042..93d29d6 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3336,7 +3336,7 @@ compare_search_syms (const void *sa, const void *sb)
   struct symbol_search *sym_b = *(struct symbol_search **) sb;
   int c;
 
-  c = strcmp (sym_a->symtab->filename, sym_b->symtab->filename);
+  c = FILENAME_CMP (sym_a->symtab->filename, sym_b->symtab->filename);
   if (c != 0)
     return c;
 
-- 
1.8.1.2



More information about the Gdb-patches mailing list