From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 621 invoked by alias); 29 Oct 2011 08:23:25 -0000 Received: (qmail 612 invoked by uid 22791); 29 Oct 2011 08:23:23 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 29 Oct 2011 08:23:05 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9T8N4YN016238 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 29 Oct 2011 04:23:05 -0400 Received: from host1.jankratochvil.net (ovpn-116-23.ams2.redhat.com [10.36.116.23]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p9T8N26g024743 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 29 Oct 2011 04:23:04 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p9T8N26E014273; Sat, 29 Oct 2011 10:23:02 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p9T8N10O013759; Sat, 29 Oct 2011 10:23:01 +0200 Date: Sat, 29 Oct 2011 09:21:00 -0000 From: Jan Kratochvil To: Aleksandar Ristovski Cc: gdb-patches@sources.redhat.com Subject: Re: [patch] Workaround gcc bug 49906 Message-ID: <20111029082300.GA17020@host1.jankratochvil.net> References: <20111028205157.GA18860@host1.jankratochvil.net> <4EAB17C4.6030902@qnx.com> <20111028212305.GA19920@host1.jankratochvil.net> <4EAB43E4.4050004@qnx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4EAB43E4.4050004@qnx.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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: 2011-10/txt/msg00796.txt.bz2 On Sat, 29 Oct 2011 02:08:04 +0200, Aleksandar Ristovski wrote: > if we are > talking about what would be intuitive, then I think the very first > line of code must be 'for' loop (even if it evaluates to 'nop'). > > Consider this test (which is what I was concentrating on): > > (gdb) b foo > Breakpoint 1 at 0x4004ba: file foo.c, line 8. > (gdb) list foo > 1 static int i; > 2 static void > 3 foo(void) > 4 { > 5 for (;;) > 6 if (i++) > 7 break; > 8 } > 9 > 10 > > Line 8 is totally unintuitive and weird. I agree line 8 is wrong, this is what is filed as GCC PR debug/49906. The question is whether the right line is 6 or whether it should be 5. If it is 5 with so many nops everywhere I am not sure the debugging is more comfortable. IMO when one does "step" one expects some changes in the inferior happen. > In any case, I will revisit the whole thing paying attention to your > test case - maybe there is no generic solution, but then again, I > would choose the less bad solution over the plain broken one. It is questionable how hard it should be pushed for in GDB when the right fix should be done in GCC anyway (I pinged Dodji Seketeli for it yesterday). My most serious concern is the workaround should not affect any correctly produced debuginfo (by non-GCC or future GCC compilers). If there is no other way than a hack with side-effects then it is IMHO more suitable for vendor branches of GDB (I make sometimes such hacks in Fedora Rawhide for fresh GCCs). There is for example a possibility to make the workaround arch-dependent finding the last jump instruction and breaking on it, I made a similar .debug_line workaround recently which should have no side-effects: [patch] workaround gcc46: prologue skip skips too far (PR 12435) #2 http://sourceware.org/ml/gdb-patches/2011-07/msg00645.html Thanks, Jan