[patch] Speed up read_psymtabs_with_fullname
Doug Evans
dje@google.com
Wed Apr 3 15:01:00 GMT 2013
Hi.
I happened to do "list 1" in a trivial program and it was taking forever.
I traced this to read_psymtabs_with_fullname trying to open every source file.
I have libc debug info installed which exacerbated the problem.
I will apply this fix (which is what we do elsewhere for this issue)
in a few days if there are no objections.
2013-04-02 Doug Evans <dje@google.com>
* psymtab.c (read_psymtabs_with_fullname): Don't call
psymtab_to_fullname if the basenames are different.
Index: psymtab.c
===================================================================
RCS file: /cvs/src/src/gdb/psymtab.c,v
retrieving revision 1.70
diff -u -p -r1.70 psymtab.c
--- psymtab.c 20 Mar 2013 18:28:48 -0000 1.70
+++ psymtab.c 2 Apr 2013 22:58:36 -0000
@@ -1114,7 +1114,11 @@ read_psymtabs_with_fullname (struct objf
if (p->anonymous)
continue;
- if (filename_cmp (fullname, psymtab_to_fullname (p)) == 0)
+ /* psymtab_to_fullname tries to open the file which is unnecessarily
+ slow. Don't call it if we know the basenames don't match. */
+ if ((basenames_may_differ
+ || filename_cmp (lbasename (fullname), lbasename (p->filename)) == 0)
+ && filename_cmp (fullname, psymtab_to_fullname (p)) == 0)
psymtab_to_symtab (objfile, p);
}
}
More information about the Gdb-patches
mailing list