From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27126 invoked by alias); 20 May 2008 07:19:51 -0000 Received: (qmail 27116 invoked by uid 22791); 20 May 2008 07:19:50 -0000 X-Spam-Check-By: sourceware.org Received: from cicero4.cybercity.dk (HELO cicero4.cybercity.dk) (212.242.40.52) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 20 May 2008 07:19:20 +0000 Received: from petertoft.dk (0x5552f3de.adsl.cybercity.dk [85.82.243.222]) by cicero4.cybercity.dk (Postfix) with ESMTP id A793A3CBC2A for ; Tue, 20 May 2008 09:19:16 +0200 (CEST) Received: from rc.petertoft.dk (localhost [127.0.0.1]) by petertoft.dk (Postfix) with ESMTP id 5AF315E8BF for ; Tue, 20 May 2008 09:19:16 +0200 (CEST) MIME-Version: 1.0 Date: Tue, 20 May 2008 07:19:00 -0000 From: Peter Toft To: gdb@sourceware.org Subject: Re: Single stepping a simple C-program, but... In-Reply-To: <20080519202847.GA29196@caradoc.them.org> References: <20080519202847.GA29196@caradoc.them.org> Message-ID: <0011f2e53686ecab5b25c90abecfdcb0@petertoft.dk> X-Sender: pto@linuxbog.dk Received: from amprx02x.nokia.com [192.100.130.8] with HTTP/1.1 (POST); Tue, 20 May 2008 09:19:16 +0200 User-Agent: RoundCube Webmail/0.1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-05/txt/msg00146.txt.bz2 On Mon, 19 May 2008 16:28:47 -0400, Daniel Jacobowitz wrote: > On Mon, May 19, 2008 at 10:18:36PM +0200, Peter Toft wrote: >> Why does the second "step" i.e. "s" take me BACK to line 7 after I have >> been in line 8???? > > Probably because you compiled with optimization on. The compiler > scheduled part of the call before the if was finished. > > -- > Daniel Jacobowitz > CodeSourcery Hi Daniel Do you mean that since I have (assume A and B are two expressions - where A is true) if ( A || B) do XYZ then I go "A" -> "XYZ" -> and now "B" -> done rather than the more obvious alternative that I go "A" -> "XYZ" -> done since "A" was true then "B" is never evaluated. This seems to be a sloppy compiled code or what? Are there good reasons for this generated code? Best -- Peter Toft, Ph.D. [pto@linuxbog.dk] http://petertoft.dk Følg min Linux-blog på http://www.version2.dk/blogs/petertoft