From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8344 invoked by alias); 9 Oct 2008 02:49:48 -0000 Received: (qmail 8335 invoked by uid 22791); 9 Oct 2008 02:49:48 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.113.40.141) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 09 Oct 2008 02:49:12 +0000 Received: from mailhost5.vmware.com (mailhost5.vmware.com [10.16.68.131]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id CFF826A2F; Wed, 8 Oct 2008 19:49:11 -0700 (PDT) Received: from [10.20.92.59] (promb-2s-dhcp59.eng.vmware.com [10.20.92.59]) by mailhost5.vmware.com (Postfix) with ESMTP id 99815DC07D; Wed, 8 Oct 2008 19:49:11 -0700 (PDT) Message-ID: <48ED70A2.7040509@vmware.com> Date: Thu, 09 Oct 2008 02:49:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20080411) MIME-Version: 1.0 To: Pedro Alves CC: "gdb-patches@sourceware.org" Subject: Re: [RFA] Resubmit reverse debugging [4/5] References: <48EC18B9.5050209@vmware.com> <200810090135.56035.pedro@codesourcery.com> <48ED5BD0.7050107@vmware.com> <200810090312.16021.pedro@codesourcery.com> In-Reply-To: <200810090312.16021.pedro@codesourcery.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: 2008-10/txt/msg00271.txt.bz2 Pedro Alves wrote: >> So what should it be? Just "error"? > > Ah, I think I see what's going on. "finish" is not meaningful > in the outermost frame, so, you'd get an error before reaching > here, if you had no symbols. > > (gdb) finish > "finish" not meaningful in the outermost frame. > (gdb) reverse-finish > "finish" not meaningful in the outermost frame. > > Is it possible to be at frame != #0 and not find a function? > > Wait, what does your remark about the frame #0 special > case mean then? This stuff makes your head spin, eh? OK, so this is the inverse of the example that I posted for Joel (about stepping into a function backward). This is "what happens if I say "finish" and I'm going backward?" So consider the function: 18: int foo (int a) 19: { 20: return a + 1; 21: } Now if I'm at line 20 and I want to finish forward, I have to find the caller, set a bp AFTER the call, run to it, then extract the return value for printing. If I want to "reverse-finish", I still find the caller, but now I want to set a breakpoint BEFORE (or at) the call insn. I'm going to execute backward thru the call, rather than execute forward thru the return. My "special case" comment had nothing to do with frame #0. The special case is that, if I happen to be starting from the first instruction of the callee (the label or entry point), then there is no need to set a breakpoint. I can just do a singlestep, and that will take me to the caller. Also, when I am going backward, there is no return value for me to extract when I get back to the caller, since the callee is not returning. As for the command name, I'm still not gonna argue about that. ;-) I just figured that a logical starting place would be, we have to know what we're going to do in the case of each existing command if we need to do it backward.