From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28786 invoked by alias); 24 Dec 2009 18:35:01 -0000 Received: (qmail 28776 invoked by uid 22791); 24 Dec 2009 18:35:00 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-2.vmware.com (HELO smtp-outbound-2.vmware.com) (65.115.85.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 24 Dec 2009 18:34:57 +0000 Received: from mailhost2.vmware.com (mailhost2.vmware.com [10.16.67.167]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id B82C25706D; Thu, 24 Dec 2009 10:34:55 -0800 (PST) Received: from [10.20.94.141] (msnyder-server.eng.vmware.com [10.20.94.141]) by mailhost2.vmware.com (Postfix) with ESMTP id B01358E579; Thu, 24 Dec 2009 10:34:55 -0800 (PST) Message-ID: <4B33B37D.1000308@vmware.com> Date: Thu, 24 Dec 2009 18:35:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20090624) MIME-Version: 1.0 To: Greg Law CC: Julian Smith , "gdb@sources.redhat.com" Subject: Re: reverse-next doing repeated reverse-stepi's ? References: <20091223170048.88d90ba6.jsmith@undo-software.com> <4B325D82.4010102@vmware.com> <4B3370A2.8000701@undo-software.com> In-Reply-To: <4B3370A2.8000701@undo-software.com> Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 2009-12/txt/msg00149.txt.bz2 Greg Law wrote: > Michael Snyder wrote: >> Julian Smith wrote: >>> I've been trying out reverse-next with UndoDB as a remote debug server, >>> and it looks like reverse-next works by doing repeated >>> `bs' (reverse-stepi) commands. >>> >>> I was expecting it to set breakpoints and do `bc' (reverse-continue) >>> commands, by analogy with normal forwards step etc. >>> >>> Am i doing something wrong here ? Or is this the expected behaviour ? >> Short answer: this is expected behavior. >> >> Forward-next works the same way, in general. >> Both forward-next and reverse-next will set breakpoints >> under some circumstances, but will often work by >> singlestepping. > > If I understand correctly, when doing a 'next' gdb does something like: > > while (PC in current line) { > ptrace (PTRACE_SINGLESTEP) > if (PC outside current function) { > plant breakpoint at return address > ptrace (PTRACE_CONT) > remove breakpoint > } > } > > however, when doing a reverse-next, we don't see this. We just see > repeated reverse single-steps. If trying to do a reverse-next over a > non-trivial function, this can take a very long time. Is this expected? No, it should work similarly to forward next. When you have stepped backward into a function, it should place a breakpoint at the entry point, run backward to that, and then step back into the caller.