public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Variable read time * 3+ between program compiled w/ gcc 2.95 and w/ gcc 3.2 on Solaris
@ 2003-04-24 14:39 Eric Brunel
  2003-04-24 14:52 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Brunel @ 2003-04-24 14:39 UTC (permalink / raw)
  To: gdb

Hi all,

I don't know if the following problem belongs here or in the gcc
newsgroup: we've noticed a drastic loss of performance when reading
program variables from gdb between the versions 2.95.3 and 3.2.2 of
gcc on Solaris 2.7. Here is a short example showing the problem:

--foo.cpp---------------
int x;

int main(int argc, char *argv[])
{
  x = 12;
  return 0;
}
------------------------

I then compile this program using g++ 2.95.3 and 3.2.2 into the
binaries foo2 and foo3 resp. Then I run:

gdb -batch -x gdb.cmds fooN

with the following commands file:

--gdb.cmds--------------
break foo.cpp:6
run
print x
print x
... (200 times)
print x
quit
-------------------------

Here are typical results:

$  time gdb -batch -x gdb.cmds foo2 > /dev/null

real    0m0.564s
user    0m0.150s
sys     0m0.110s

$ time gdb -batch -x gdb.cmds foo3 > /dev/null

real    0m1.726s
user    0m1.340s
sys     0m0.260s

The reading time has been increased by a factor 3+. This is even worse
if the variable is a structure and if I access fields in it. With a
chained list read via x->next->next->next..., we got times around
.5/.75 seconds with g++ 2.95, and more than 30 seconds (!) with g++
3.2

We tested versions 5.2 and 5.3 of gdb and got similar results.

Is this a bug? Is it known? Is there a workaround or a patch? Thanks a
lot in advance.
--
- Eric Brunel <eric.brunel@pragmadev.com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Variable read time * 3+ between program compiled w/ gcc 2.95 and w/ gcc 3.2 on Solaris
  2003-04-24 14:39 Variable read time * 3+ between program compiled w/ gcc 2.95 and w/ gcc 3.2 on Solaris Eric Brunel
@ 2003-04-24 14:52 ` Daniel Jacobowitz
  2003-04-28  8:40   ` Eric Brunel
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2003-04-24 14:52 UTC (permalink / raw)
  To: Eric Brunel; +Cc: gdb

On Thu, Apr 24, 2003 at 04:45:16PM +0200, Eric Brunel wrote:
> Hi all,
> 
> I don't know if the following problem belongs here or in the gcc
> newsgroup: we've noticed a drastic loss of performance when reading
> program variables from gdb between the versions 2.95.3 and 3.2.2 of
> gcc on Solaris 2.7. Here is a short example showing the problem:
> 
> --foo.cpp---------------
> int x;
> 
> int main(int argc, char *argv[])
> {
>   x = 12;
>   return 0;
> }
> ------------------------
> 
> I then compile this program using g++ 2.95.3 and 3.2.2 into the
> binaries foo2 and foo3 resp. Then I run:
> 
> gdb -batch -x gdb.cmds fooN
> 
> with the following commands file:
> 
> --gdb.cmds--------------
> break foo.cpp:6
> run
> print x
> print x
> ... (200 times)
> print x
> quit
> -------------------------
> 
> Here are typical results:
> 
> $  time gdb -batch -x gdb.cmds foo2 > /dev/null
> 
> real    0m0.564s
> user    0m0.150s
> sys     0m0.110s
> 
> $ time gdb -batch -x gdb.cmds foo3 > /dev/null
> 
> real    0m1.726s
> user    0m1.340s
> sys     0m0.260s
> 
> The reading time has been increased by a factor 3+. This is even worse
> if the variable is a structure and if I access fields in it. With a
> chained list read via x->next->next->next..., we got times around
> .5/.75 seconds with g++ 2.95, and more than 30 seconds (!) with g++
> 3.2
> 
> We tested versions 5.2 and 5.3 of gdb and got similar results.
> 
> Is this a bug? Is it known? Is there a workaround or a patch? Thanks a
> lot in advance.

Probably a bug; not known.  I don't know why this would happen,
especially for such a simple program; if you can get an ida of where
gdb is spending its time that would be interesting.  A decent profiling
tool should be able to do the job.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Variable read time * 3+ between program compiled w/ gcc 2.95 and w/ gcc 3.2 on Solaris
  2003-04-24 14:52 ` Daniel Jacobowitz
@ 2003-04-28  8:40   ` Eric Brunel
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Brunel @ 2003-04-28  8:40 UTC (permalink / raw)
  To: gdb

On Thursday 24 April 2003 16:52, Daniel Jacobowitz wrote:
> On Thu, Apr 24, 2003 at 04:45:16PM +0200, Eric Brunel wrote:
> > Hi all,
> >
> > I don't know if the following problem belongs here or in the gcc
> > newsgroup: we've noticed a drastic loss of performance when reading
> > program variables from gdb between the versions 2.95.3 and 3.2.2 of
> > gcc on Solaris 2.7. Here is a short example showing the problem:
> >
> > --foo.cpp---------------
> > int x;
> >
> > int main(int argc, char *argv[])
> > {
> >   x = 12;
> >   return 0;
> > }
> > ------------------------
> >
> > I then compile this program using g++ 2.95.3 and 3.2.2 into the
> > binaries foo2 and foo3 resp. Then I run:
> >
> > gdb -batch -x gdb.cmds fooN
> >
> > with the following commands file:
> >
> > --gdb.cmds--------------
> > break foo.cpp:6
> > run
> > print x
> > print x
> > ... (200 times)
> > print x
> > quit
> > -------------------------
> >
> > Here are typical results:
> >
> > $  time gdb -batch -x gdb.cmds foo2 > /dev/null
> >
> > real    0m0.564s
> > user    0m0.150s
> > sys     0m0.110s
> >
> > $ time gdb -batch -x gdb.cmds foo3 > /dev/null
> >
> > real    0m1.726s
> > user    0m1.340s
> > sys     0m0.260s
> >
> > The reading time has been increased by a factor 3+. This is even worse
> > if the variable is a structure and if I access fields in it. With a
> > chained list read via x->next->next->next..., we got times around
> > .5/.75 seconds with g++ 2.95, and more than 30 seconds (!) with g++
> > 3.2
> >
> > We tested versions 5.2 and 5.3 of gdb and got similar results.
> >
> > Is this a bug? Is it known? Is there a workaround or a patch? Thanks a
> > lot in advance.
>
> Probably a bug; not known.  I don't know why this would happen,
> especially for such a simple program; if you can get an ida of where
> gdb is spending its time that would be interesting.  A decent profiling
> tool should be able to do the job.

Just to let everybody know: after profiling and with Daniel's help, I 
discovered that what slowed down gdb was simply the libraries libstdc++ and 
libgcc_s that are apparently compiled with debug info in the gcc 3.2.2 distro 
I downloaded from www.sunfreeware.com; just stripping these two libraries 
brought back the performance I got with gcc 2.95.

I'll send a mail to the guy taking care of sunfreeware.com to warn him about 
this issue and to know if he can just build with the right options to avoid 
this problem.

Thanks!
-- 
- Eric Brunel <eric.brunel@pragmadev.com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-04-28  8:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-24 14:39 Variable read time * 3+ between program compiled w/ gcc 2.95 and w/ gcc 3.2 on Solaris Eric Brunel
2003-04-24 14:52 ` Daniel Jacobowitz
2003-04-28  8:40   ` Eric Brunel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).