* NEWS: Mention new parameter basenames-may-differ.
[deliverable/binutils-gdb.git] / gdb / psymtab.c
index 6012118e341c5d3a1a5b6381a4a482bb89fa0ae0..6c4507d24d3b900a8d4751d79549167acfb7bd96 100644 (file)
@@ -134,6 +134,7 @@ lookup_partial_symtab (struct objfile *objfile, const char *name,
                       const char *full_path, const char *real_path)
 {
   struct partial_symtab *pst;
+  const char *name_basename = lbasename (name);
 
   ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, pst)
   {
@@ -142,6 +143,12 @@ lookup_partial_symtab (struct objfile *objfile, const char *name,
        return (pst);
       }
 
+    /* Before we invoke realpath, which can get expensive when many
+       files are involved, do a quick comparison of the basenames.  */
+    if (! basenames_may_differ
+       && FILENAME_CMP (name_basename, lbasename (pst->filename)) != 0)
+      continue;
+
     /* If the user gave us an absolute path, try to find the file in
        this symtab and use its absolute path.  */
     if (full_path != NULL)
@@ -172,7 +179,7 @@ lookup_partial_symtab (struct objfile *objfile, const char *name,
 
   /* Now, search for a matching tail (only if name doesn't have any dirs).  */
 
-  if (lbasename (name) == name)
+  if (name_basename == name)
     ALL_OBJFILE_PSYMTABS_REQUIRED (objfile, pst)
     {
       if (FILENAME_CMP (lbasename (pst->filename), name) == 0)
This page took 0.024204 seconds and 4 git commands to generate.