Improving GDB startup time with large programs

Daniel Jacobowitz
Tue May 4 19:44:00 GMT 2004

On Sun, May 02, 2004 at 07:48:50PM -0700, Nick Savoiu wrote:
> >> How do I profile gdb?
> >
> >When you build gdb, configure as normal.
> >Then use this command to build:
> Here's what I got (the most significant stuff) with g++ 3.2. Seems
> that the number of symbols is the culprit.

First of all, as Andrew said, use something like oprofile instead of
gprof / -pg profiling.  The top three functions on your profile below
are called extremely often and do extremely little work -> call graph
profiling inflates their time significantly.

Secondly, the big change in the 6.0 / 6.1 profiles you've posted is the
increased use of strcmp_iw_ordered.  David Carlton noticed that this
change was in fact necessary for correctness.  I've been thinking about
alternate approaches to avoid it - the comparison is quite expensive -
but it's going to take a lot of work.

Third, most of the time in your example is spent reading partial
symbols.  If you use a GCC new enough to support
-g -feliminate-dwarf2-dups, and a GDB snapshot from the
"drow_intercu-20040221-branch" branch of CVS, there will be many fewer
partial symbols; that should improve your startup time somewhat.

Daniel Jacobowitz

More information about the Gdb mailing list