Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Bernd Jendrissek <berndj@prism.co.za>
To: gdb@sources.redhat.com
Subject: Re: Who's insane: gdb or I?  (Answer: I am)
Date: Fri, 05 Jul 2002 18:23:00 -0000	[thread overview]
Message-ID: <20020706032330.E20820@prism.co.za> (raw)
In-Reply-To: <20020703151547.A28413@prism.co.za>

Okay, I think I'm convinced that this is simply normal -O2 behaviour.

On Wed, Jul 03, 2002 at 03:15:47PM +0200, Bernd Jendrissek wrote:
> 1083            OVERtime+=(etv.tv_sec - stv.tv_sec) * 1000;
> (gdb) s
> 1084            OVERtime+=(etv.tv_usec - stv.tv_usec) / 1000;
> (gdb) s
> 1083            OVERtime+=(etv.tv_sec - stv.tv_sec) * 1000;
> (gdb) s
> 1084            OVERtime+=(etv.tv_usec - stv.tv_usec) / 1000;
> (gdb) s
> 1083            OVERtime+=(etv.tv_sec - stv.tv_sec) * 1000;
> (gdb) s
> 1084            OVERtime+=(etv.tv_usec - stv.tv_usec) / 1000;
> (gdb) list
> 1079            return;
> 1080        }
> 1081        if (PERMaccessconf->nnrpdoverstats) {
> 1082            gettimeofday(&etv, NULL);
> 1083            OVERtime+=(etv.tv_sec - stv.tv_sec) * 1000;
> 1084            OVERtime+=(etv.tv_usec - stv.tv_usec) / 1000;
> 1085        }

For those still interested, here's the assembly generated by gcc -save-temps
at -O2.  (Complete gcc options: -g -O2 -save-temps)

        movl PERMaccessconf,%eax
        cmpl $0,116(%eax)
        je .L799
.stabn 68,0,1082,.LM674-CMDxover
.LM674:
        addl $-8,%esp
        pushl $0
        leal -48(%ebp),%ebx
        pushl %ebx
        call gettimeofday
.stabn 68,0,1083,.LM675-CMDxover
.LM675:
        movl -40(%ebp),%eax
        movl -48(%ebp),%ecx
        subl %eax,%ecx
.stabn 68,0,1084,.LM676-CMDxover
.LM676:
        movl -36(%ebp),%eax
        movl 4(%ebx),%esi
.stabn 68,0,1083,.LM677-CMDxover
.LM677:
        imull $1000,%ecx,%ecx
.stabn 68,0,1084,.LM678-CMDxover
.LM678:
        subl %eax,%esi
        movl $274877907,%ebx
        movl %esi,%eax
        imull %ebx
.stabn 68,0,1083,.LM679-CMDxover
.LM679:
        addl OVERtime,%ecx
.stabn 68,0,1084,.LM680-CMDxover
.LM680:
        sarl $6,%edx
        movl %esi,%eax
        sarl $31,%eax
        subl %eax,%edx
        addl %edx,%ecx
        movl %ecx,OVERtime
.stabn 68,0,1085,.LM681-CMDxover
.LM681:
        addl $16,%esp
.L799:

So it appears the bouncing between lines 1083 and 1084 really is due to
interleaving of instructions.  Thanks for everyone's help; I consider this
resolved.

-- 
berndj@users.sourceforge.net is probably better to bookmark than any


      parent reply	other threads:[~2002-07-06  1:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-03  6:16 Who's insane: gdb or I? Bernd Jendrissek
2002-07-03  6:24 ` Eli Zaretskii
2002-07-03  6:42   ` Kris Warkentin
2002-07-03  9:29 ` Carlo Wood
2002-07-05  3:05 ` Bernd Jendrissek
2002-07-05 18:23 ` Bernd Jendrissek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020706032330.E20820@prism.co.za \
    --to=berndj@prism.co.za \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox