Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* When isn't there a selected frame?
@ 2002-04-14 19:04 Andrew Cagney
  2002-04-14 19:13 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2002-04-14 19:04 UTC (permalink / raw)
  To: gdb

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)?

I think the next step on the cache per thread frames is to replace 
selected_frame with:

	get_selected_frame ()
	  if (selected_frame)
	    return selected_frame;
	  else
	    return get_current_frame ()

so that selected frame is created on demand.

Andrew


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: When isn't there a selected frame?
  2002-04-14 19:04 When isn't there a selected frame? Andrew Cagney
@ 2002-04-14 19:13 ` Daniel Jacobowitz
  2002-04-14 20:08   ` Elena Zannoni
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2002-04-14 19:13 UTC (permalink / raw)
  To: gdb

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.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: When isn't there a selected frame?
  2002-04-14 19:13 ` Daniel Jacobowitz
@ 2002-04-14 20:08   ` Elena Zannoni
  2002-04-17  7:37     ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: Elena Zannoni @ 2002-04-14 20:08 UTC (permalink / raw)
  To: Daniel Jacobowitz, cagney; +Cc: gdb

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.

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?

Elena


 > -- 
 > Daniel Jacobowitz                           Carnegie Mellon University
 > MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: When isn't there a selected frame?
  2002-04-14 20:08   ` Elena Zannoni
@ 2002-04-17  7:37     ` Andrew Cagney
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2002-04-17  7:37 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: Daniel Jacobowitz, cagney, gdb

> 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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-04-17 14:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-14 19:04 When isn't there a selected frame? Andrew Cagney
2002-04-14 19:13 ` Daniel Jacobowitz
2002-04-14 20:08   ` Elena Zannoni
2002-04-17  7:37     ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox