Re: How does GDB/MI give the current frame

Alain Magloire
2004-06-30T20:47:28Z

>
> > Daniel Jacobowitz writes:
> > DJ>
> > DJ> Why not use -stack-info-frame?
> >
> > Because AFAIK this MI command has not been implemented (yet).
> >
> > Andrew Cagney writes:
> >
> > AC> When the user does "up", "down", the debugger should generate a selected
> > AC> CLI frame changed event (it currently doesn't). If the GUI so chooses,
> > AC> it can track the users "selected" frame, by responding to these events.
> >
> > I don't know what a selected CLI frame changed event is but up, down, and
> > frame generate MI output, so I imagine its just a case of hooking
> > -stack-info-frame and -stack-select-frame to that output. I will try to do
> > this if you think it's appropriate.
>
> For the CLI, something like this:
>
> -> -interpreter cli "up"
> <- ~"info on new frame..."
> <- *select-frame,<frame-info>...
> <- done
>
> with similar for -stack-select-frame:
>
> -> -stack-select-frame 1
> <- *select-frame,<frame-info>,....
> <- done
>
> Where, yes, <frame-info> would be constructed by calling frame code.
>
> -stack-info-frame would just be just:
>
> -> -stack-info-frame
> <- done,<frame-info>
>
> The important thing is that, in both cases, the GUI is being driven by
> the select-frame event.
>

Cool !!

One thing:

-thread-select 2
^done,...
-stack-select-frame 3
^done
-thread-select 1
^done,..
-thread-select 2
^done,..

If you would do "-stack-info-frame" now, you would notice that current
stackframe for thread 2 is not longer frame 3 but frame 0 !!
It this case would not it be appropriate to fire a "*select-frame" event.

Second thing:
Playing with MI, I've notice in between -var-update|-var-delete|etc ..
operation the frame selection level was reset to 0, failing the other operations
that was still assuming a certain frame level.
Now is this an appropriate behaviour? or a bug? if it is appropriate should
client recall -stack-select-frame XX all the time to make sure things are ok

> Andrew
>
> PS: Better / more consistent event name welcome.
>

How about to put the thread-id part ot the event ?