From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2518 invoked by alias); 18 Mar 2010 14:06:49 -0000 Received: (qmail 2503 invoked by uid 22791); 18 Mar 2010 14:06:47 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp.nokia.com (HELO mgw-mx03.nokia.com) (192.100.122.230) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 18 Mar 2010 14:06:38 +0000 Received: from esebh106.NOE.Nokia.com (esebh106.ntc.nokia.com [172.21.138.213]) by mgw-mx03.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o2IE6Irp001601 for ; Thu, 18 Mar 2010 16:06:33 +0200 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 18 Mar 2010 16:06:18 +0200 Received: from mgw-da01.ext.nokia.com ([147.243.128.24]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Thu, 18 Mar 2010 16:06:18 +0200 Received: from gar.localnet (berwst16747.europe.nokia.com [172.25.167.47]) by mgw-da01.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o2IE6FTT002950 for ; Thu, 18 Mar 2010 16:06:16 +0200 From: =?iso-8859-1?q?Andr=E9_P=F6nitz?= To: gdb@sourceware.org Subject: Re: Getting pissed off by gdb. Please help with stepping in. Date: Thu, 18 Mar 2010 14:06:00 -0000 User-Agent: KMail/1.12.2 (Linux/2.6.31-19-generic; KDE/4.3.2; i686; ; ) References: <11611.203.63.255.139.1268879984.squirrel@webmail5.pair.com> <20100318133334.GA7732@caradoc.them.org> In-Reply-To: <20100318133334.GA7732@caradoc.them.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201003181506.15964.andre.poenitz@nokia.com> X-Nokia-AV: Clean 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: 2010-03/txt/msg00127.txt.bz2 On Thursday 18 March 2010 14:33:37 Daniel Jacobowitz wrote: > On Thu, Mar 18, 2010 at 12:22:20AM -0700, Doug Evans wrote: > > This patch for cvs head gets things working for me. I haven't run it > > through the testsuite, and it might be nice compare more than just > > frame ids (and for the gdb crowd, yes, the FIXME needs to go before > > being checked in ...), but .... this patch seems otherwise reasonable > > to me. At the point where the patch is applied gdb has already > > decided to continue - what's a case where it *should* continue at this > > point *if* the frame has changed? [Note that gdb has already handled > > various cases like stopping in trampolines and such.] > > In addition to what Eli said... here's the previous block: > > if ((stop_pc == stop_pc_sal.pc) > && (ecs->event_thread->current_line != stop_pc_sal.line > || ecs->event_thread->current_symtab != stop_pc_sal.symtab)) > { > /* We are at the start of a different line. So stop. Note that > we don't stop if we step into the middle of a different line. > That is said to make things like for (;;) statements work > better. */ > > IOW, if we are at a line boundary, we stop stepping. If we've ended > up in the middle of a line, we keep going. This prevents us from > ending up in a weird state where we show the line containing the > function call, but the function has already been called. I think it'd > be even more confusing. Since this code turns up in discussion: The condition fires back in case of an ill-behaved remote stub. I unfortunately have to care for such a beast that sometimes "overshoots" when stepping over a range by two or three instructions. In this case the condition is false and gdb will execute the code below the the block leading to keep_going (ecs); This means a 'next' effectively jumps over two lines, which is rather nasty. So I have been removing this optimization in gdb for a while (as the stub is not under my control) without experiencing any bad side effects. Most notably, stepping over for (;;) does not seem to be affected at all. I understand the (for me unfortunate) gdb behaviour this is entirely the fault of the stub, but nevertheless I wonder whether this optimization is really needed. I dug a bit in gdb's history, and the code is older than anything I could access, i.e. before 1991 or so. Together with the comment "That is said to make things like for (;;) statements work better" one might get the impression that it was a workaround for some particular compiler or such. Does anybody happen to remember what triggered the inclusion of this optimization into gdb code? Andre'