From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24872 invoked by alias); 6 Jul 2002 01:23:42 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 24834 invoked from network); 6 Jul 2002 01:23:38 -0000 Received: from unknown (HELO penguin.wetton.prism.co.za) (196.41.175.250) by sources.redhat.com with SMTP; 6 Jul 2002 01:23:38 -0000 Received: (from berndj@localhost) by penguin.wetton.prism.co.za (8.9.3/8.9.3) id DAA11604 for gdb@sources.redhat.com; Sat, 6 Jul 2002 03:23:30 +0200 Date: Fri, 05 Jul 2002 18:23:00 -0000 From: Bernd Jendrissek To: gdb@sources.redhat.com Subject: Re: Who's insane: gdb or I? (Answer: I am) Message-ID: <20020706032330.E20820@prism.co.za> References: <20020703151547.A28413@prism.co.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <20020703151547.A28413@prism.co.za> X-SW-Source: 2002-07/txt/msg00070.txt.bz2 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