Each time I step the first time into code belonging to some library like QtCore or QtGui, gdb goes to 100% CPU for 10-20 seconds. That time is spent almost entirely in find_minsym_and_objfile (char *name, struct objfile **objfile_p) in glibc-tdep.c. The change below removes the delay and does not seem to have ill side-effects for me. --- glibc-tdep.c.orig 2010-01-20 16:00:22.000000000 +0100 +++ glibc-tdep.c 2010-01-20 17:04:41.000000000 +0100 @@ -41,15 +41,12 @@ ALL_OBJFILES (objfile) { struct minimal_symbol *msym; - ALL_OBJFILE_MSYMBOLS (objfile, msym) - { - if (SYMBOL_LINKAGE_NAME (msym) - && strcmp (SYMBOL_LINKAGE_NAME (msym), name) == 0) - { + msym = lookup_minimal_symbol (name, NULL, objfile); + if ( msym ) + { *objfile_p = objfile; return msym; - } - } + } }
Created attachment 4543 [details] proposed patch Please try this patch. If it works for you, I will check it in. Thanks.
Yes, it solves the performance problem. Time for the initial step into libQtCore.so is down to 0.4 seconds from 10.2 seconds, both "real" time averaged over four "warm" runs.
Subject: Bug 11198 CVSROOT: /cvs/src Module name: src Changes by: tromey@sourceware.org 2010-01-21 17:12:19 Modified files: gdb : ChangeLog minsyms.c symtab.h glibc-tdep.c Log message: PR symtab/11198: * symtab.h (lookup_minimal_symbol_and_objfile): Declare. * minsyms.c (lookup_minimal_symbol_and_objfile): New function. * glibc-tdep.c (find_minsym_and_objfile): Remove. (glibc_skip_solib_resolver): Use lookup_minimal_symbol_and_objfile. Patches: http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.11284&r2=1.11285 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/minsyms.c.diff?cvsroot=src&r1=1.70&r2=1.71 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/symtab.h.diff?cvsroot=src&r1=1.144&r2=1.145 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/glibc-tdep.c.diff?cvsroot=src&r1=1.12&r2=1.13
Thanks for trying this. I've checked in the fix.