From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20139 invoked by alias); 11 May 2009 20:49:16 -0000 Received: (qmail 20127 invoked by uid 22791); 11 May 2009 20:49:15 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtaout3.012.net.il (HELO mtaout3.012.net.il) (84.95.2.7) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 May 2009 20:49:10 +0000 Received: from conversion-daemon.i_mtaout3.012.net.il by i_mtaout3.012.net.il (HyperSendmail v2004.12) id <0KJH00E00Z1WCR00@i_mtaout3.012.net.il> for gdb-patches@sourceware.org; Mon, 11 May 2009 23:49:07 +0300 (IDT) Received: from HOME-C4E4A596F7 ([84.228.73.80]) by i_mtaout3.012.net.il (HyperSendmail v2004.12) with ESMTPA id <0KJH00CU5Z5UGRJ0@i_mtaout3.012.net.il>; Mon, 11 May 2009 23:49:07 +0300 (IDT) Date: Mon, 11 May 2009 20:49:00 -0000 From: Eli Zaretskii Subject: Re: [RFA] Fix "break foo" when `foo's prologue ends before line table In-reply-to: <20090511192709.GG14773@adacore.com> To: Joel Brobecker Cc: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <83tz3rxt4p.fsf@gnu.org> References: <83skjebbef.fsf@gnu.org> <20090511125644.GD14773@adacore.com> <83zldjxzzr.fsf@gnu.org> <20090511192709.GG14773@adacore.com> X-IsSubscribed: yes 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/msg00227.txt.bz2 > Date: Mon, 11 May 2009 21:27:09 +0200 > From: Joel Brobecker > Cc: gdb-patches@sourceware.org > > I'm always reluctant to introduce code I don't understand, and usually > leave it out until I see a bug - that's why I was asking. Have you > tried without this part? No, but I will. Keep in mind, though, that the program which I was using as my test case is just a toy test case. Even if it works there, I cannot be sure it will work in more complex cases. I will take your word for it, though ;-) > foo () > { > a (); > b (); > } > > If for some reason the optimizer rearanged the code like this: > > foo () > { > b (); > a (); > } Are such rearrangements permitted? I mean, are we talking about a real-life situation here? > Do you really want "break foo" to break on the line where a () is > called? It's hard to say, really. There are arguments for both, but I personally tend to think that stopping on the call to `a' is what I'd want. What do others think? > 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? > > Is it guaranteed that the line table is always sorted by PC? > > Yep: > > /* The order of entries in the linetable is significant. They should > be sorted by increasing values of the pc field. 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...