From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22761 invoked by alias); 11 May 2009 21:28:00 -0000 Received: (qmail 22752 invoked by uid 22791); 11 May 2009 21:27:59 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 May 2009 21:27:50 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id EDAD32BABFB; Mon, 11 May 2009 17:27:47 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id fN3f2wQBaK4o; Mon, 11 May 2009 17:27:47 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id A46132BABFA; Mon, 11 May 2009 17:27:47 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 7E8A9F5905; Mon, 11 May 2009 23:27:44 +0200 (CEST) Date: Mon, 11 May 2009 21:28:00 -0000 From: Joel Brobecker To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: [RFA] Fix "break foo" when `foo's prologue ends before line table Message-ID: <20090511212744.GB7584@adacore.com> References: <83skjebbef.fsf@gnu.org> <20090511125644.GD14773@adacore.com> <83zldjxzzr.fsf@gnu.org> <20090511192709.GG14773@adacore.com> <83tz3rxt4p.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83tz3rxt4p.fsf@gnu.org> User-Agent: Mutt/1.5.18 (2008-05-17) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-05/txt/msg00233.txt.bz2 > Are such rearrangements permitted? I mean, are we talking about a > real-life situation here? I think they are permitted, especially if the statements are not function calls. For instance, the compiler can certainly reverse the following two statements: a = 1; b = 2; I am not versed in the art of optimizing, but why not. I don't think anything is forbidden as long as the program works as expected. That being said, the example was just an extreme on meant to show what it means to chose the line with the smaller number, and why I prefer to select the first line in your case. But, like you, I'm not too concerned about which line to select. In practice, it's not going to happen much. Even for you, I'm betting that it's only happen when breaking on "main", because the compiler should generate that stack re-alignment code only in the main, and on functions that have special attributes meaning that it might be called from some code whose stack is less aligned. > > In other words, when I break on > > a function, I expect that by the time I reach that function breakpoint, > > none of the real code has been executed yet - I want to debug the > > function :-). > > This could be impossible anyway, if the compiler moves some of the > body into the prologue, right? I can't remember what we do in that case. I'd have to look at the code again. > Well, granted, I've seen that comment. But (a) are we sure all of our > comments are necessarily accurate to rely on them?, and (b) it > continues to say > > If there is more than > one entry for a given pc, then I'm not sure what should happen (and > I not sure whether we currently handle it the best way). > > Not very reassuring... At least for the part that lines are sorted by ascending PC order, I'm pretty sure. If we break that assumption, we should fix it, because I think we rely on it in several places. -- Joel