This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: Who's insane: gdb or I? (Answer: I am)
- From: Bernd Jendrissek <berndj at prism dot co dot za>
- To: gdb at sources dot redhat dot com
- Date: Sat, 6 Jul 2002 03:23:30 +0200
- Subject: Re: Who's insane: gdb or I? (Answer: I am)
- References: <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