From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23169 invoked by alias); 20 May 2008 11:05:53 -0000 Received: (qmail 23161 invoked by uid 22791); 20 May 2008 11:05:53 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 20 May 2008 11:05:35 +0000 Received: (qmail 4917 invoked from network); 20 May 2008 11:05:33 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 20 May 2008 11:05:33 -0000 From: Pedro Alves To: gdb@sourceware.org Subject: Re: Single stepping a simple C-program, but... Date: Tue, 20 May 2008 11:05:00 -0000 User-Agent: KMail/1.9.9 Cc: Peter Toft References: <200805192339.20457.pedro@codesourcery.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200805201205.35865.pedro@codesourcery.com> 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/msg00147.txt.bz2 A Tuesday 20 May 2008 08:11:20, Peter Toft wrote: > Pedro - your mail is very interesting and very illustrative. > To be 100% sure that I understand you, and "problem" that we get a line > counter increment of -1 from 8 to 7 above > comes from gcc i.e. gdb does the right thing. Do we agree? Yes. GDB shows the user what the debug info tells it to. > Then the question is why gcc does this?! I don't know. Based on what I see, the bug is that at -O0, if the predicate involves subexpressions, the jump at the end of the then block is attributed to the expression line, while it should be attributed to the same line as the last statement of the then block -- if that were so, stepping over the printf call in your example would only stop at line 12, as expected. -- Pedro Alves