From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6003 invoked by alias); 17 Apr 2002 14:37:36 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 5977 invoked from network); 17 Apr 2002 14:37:32 -0000 Received: from unknown (HELO localhost.redhat.com) (24.112.240.27) by sources.redhat.com with SMTP; 17 Apr 2002 14:37:32 -0000 Received: from cygnus.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 8B1043C69; Wed, 17 Apr 2002 10:37:33 -0400 (EDT) Message-ID: <3CBD88AD.8010001@cygnus.com> Date: Wed, 17 Apr 2002 07:37:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:0.9.9) Gecko/20020328 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Elena Zannoni Cc: Daniel Jacobowitz , cagney@redhat.com, gdb@sources.redhat.com Subject: Re: When isn't there a selected frame? References: <3CBA3543.4010601@cygnus.com> <20020414221403.A26166@nevyn.them.org> <15546.17420.23479.131133@localhost.redhat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-04/txt/msg00286.txt.bz2 > Daniel Jacobowitz writes: > > On Sun, Apr 14, 2002 at 10:04:51PM -0400, Andrew Cagney wrote: > > > Hello, > > > > > Random bits of GDB contain code snipits like: > > > > > if (selected_frame) > > > .. > > > else > > > error ("No selected frame"); > > > > > Is there any time when it doesn't make sense to have a selected frame > > > (except, say when current_frame() is also NULL)? > > > Perhaps to handle when the target is not running? I am pretty sure > > I've reached a couple of those messages. > > Yes, so it seems. What about connecting to a remote target? Do you > get a frame selected right away? How about attach? detach? Hmm, I > just tried with a sim and a native attach, and current_frame and > selected_frame seem to be in sync, i.e, not null at the same time. So, provided the target has ``state'', there is a frame. This is different to ``no stack''. Even with no stack, there can be a frame, it is just that it can't do much :-( Anyway, this means the change: > get_selected_frame () > if (selected_frame) > return selected_frame; > else > return get_current_frame () Well actually: if (selected_frame == NULL) selected_frame = get_current_frame (); return selected_frame; Is looking reasonable as a first cut. Return what ever get_current_frame() thinks is the current frame. > BTW, I always got a bit confused by the 'No stack' vs. 'No selected > frame' message. I know that No stack has to do with the capabilities > of the target as opposed at what your inferior program is doing right > now, but as a *user* I find it a bit confusing. > And don't forget the variations on the theme: > > "No frame selected" > "No selected stack frame" > "no frame selected" > > Should we stick with just one message? Yes. How to fix it, I'm not sure. I suspect no one is really sure if/when selected_frame() can be null. Andrew