Subject: bug#10580: 24.0.92; gdb initialization takes more than one minute at 100% CPU

From: Dov Grobgeld <[email-masked]>
Date: Thu, 10 May 2012 21:43:39 +0300

I just downloaded gdb from cvs and tried with the latest version and there
are still duplicates. Perhaps it is because of gcc? But on the positive
side there is indeed a huge difference in the gdb output.

prompt> gdb --version
GNU gdb (GDB) Fedora (7.3.50.20110722-13.fc16)
prompt> /usr/local/public-dev/bin/gdb --version
GNU gdb (GDB) 7.4.50.20120509-cvs
prompt> gdb -i=mi MyExec < /tmp/gdb.in > /tmp/gdb-old.out
prompt> /usr/local/public-dev/bin/gdb -i=mi MyExec < /tmp/gdb.in >
/tmp/gdb-new.out
prompt> ls -1s --block-size=1 /tmp/gdb*.out
 884736 /tmp/gdb-new.out
3727360 /tmp/gdb-old.out
prompt> perl -ne 'while(/(\w+)=\"(.*?)\"/g) { print "$1=$2\n"; }'
/tmp/gdb-old.out | sort | wc
  67311   67311 3522494
prompt> perl -ne 'while(/(\w+)=\"(.*?)\"/g) { print "$1=$2\n"; }'
/tmp/gdb-new.out | sort | wc
  14221   14221  837082
prompt> perl -ne 'while(/(\w+)=\"(.*?)\"/g) { print "$1=$2\n"; }'
/tmp/gdb-old.out | sort |uniq| wc
   3931    3931  220654
prompt> perl -ne 'while(/(\w+)=\"(.*?)\"/g) { print "$1=$2\n"; }'
/tmp/gdb-new.out | sort |uniq| wc
   2245    2245  137404

But even the factor 837k vs 137k is substantial, so it is still valid to do
an internal uniq within gdb. I'll try to put together a patch.

Regards,
Dov

On Thu, May 10, 2012 at 7:32 PM, Eli Zaretskii <[email-masked]> wrote:

> > Date: Thu, 10 May 2012 09:00:49 +0300
> > From: Dov Grobgeld <[email-masked]>
> > Cc: [email-masked], [email-masked], [email-masked]
> >
> > I tried running file-list-exec-source-files and I get duplicates as well.
> > Try the following:
> >
> > prompt> echo -file-list-exec-source-files > /tmp/gdb.in
> > prompt> gdb -i=mi emacs < /tmp/gdb.in > /tmp/gdb.out
> > prompt> perl -ne 'while(/(\w+)=\"(.*?)\"/g) { print "$1=$2\n"; }'
> > /tmp/gdb.out | sort | head -15
> > file=alloc.c
> > file=alloc.c
> > file=allocator.c
> > file=atimer.c
> > file=atimer.c
> > file=bidi.c
> > file=bidi.c
> > file=buffer.c
> > file=buffer.c
> > file=buffer.h
> > file=buffer.h
> > file=buffer.h
> > file=buffer.h
> > file=buffer.h
> > file=buffer.h
>
> I don't see anything like that.  Here's my output:
>
>  addr=0x011b4ea5
>  addr=0x011b4ea5
>  addr=0x012329a8
>  disp=del
>  disp=del
>  disp=keep
>  enabled=y
>  enabled=y
>  enabled=y
>  file=../lib/allocator.h
>  file=../lib/careadlinkat.h
>  file=../lib/ignore-value.h
>  file=../lib/intprops.h
>  file=../lib/intprops.h
>  file=../lib/intprops.h
>
> IOW, all the duplicates I see are header files.  Not a single .c file
> shows up, not even if I change "head -15" into "head -100".
>
> > My version of gdb is:
> >
> > GNU gdb (GDB) Fedora (7.2-52.fc14)
>
> Maybe you should upgrade, I dunno.  I use 7.4.1, FWIW.
>
> Or maybe GCC versions later than what I have do that.
>
> > For my executable gdb outputs full paths as well as the fullname field,
> > which expands the output considerably.
>
> Here too, but that's expected (and necessary).
>