Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Re: asynchronous MI output commands
@ 2006-05-07 22:30 Bjarke Viksoe
  2006-05-07 22:50 ` Daniel Jacobowitz
  2006-05-11 10:31 ` MI: anynchronous vs. synchronous Vladimir Prus
  0 siblings, 2 replies; 54+ messages in thread
From: Bjarke Viksoe @ 2006-05-07 22:30 UTC (permalink / raw)
  To: gdb

>Daniel Jacobowitz wrote:
>
>If I were writing a front-end, I would have an arbitration layer which
>sent questions to GDB and received answers.  The answers will come back
>one at a time, in the same order the questions were asked.  If you send
>two -var-evaluate-expression commands, you'll get back two answers, in
>that same order.
>
>Am I missing something?  Is there a reason that this isn't enough?

No, the abstraction layer is exactly my design - but as I explained: the 
goal of my tool is that it's used over a remote line (eg. SSH over internet) 
where the answer can be a couple of 100ms delayed. It is most desirable to 
be able to send multiple commands and have the front-end digest the answer 
as they slowly arrive - updating the UI in increments.
Yes, my views need to send multiple -var-evaluate-expression and this is the 
reason that I'm forced to restrict the design to what you describe. The 
reason it's not good enough: it so slow.

Because of the latency, my "abstraction layer" runs in its own thread. This 
makes the UI wonderfully responsive, but doesnÂ’t allow a component/view to 
submit a command and read the answer in the same context. Answers arrive out 
of context and are processed separately - creating a high need to know what 
the answer originated from.

bjarke
BVRDE - bvrde.sourceforge.net



^ permalink raw reply	[flat|nested] 54+ messages in thread
* RE: asynchronous MI output commands
@ 2006-05-12  0:19 Alain Magloire
  0 siblings, 0 replies; 54+ messages in thread
From: Alain Magloire @ 2006-05-12  0:19 UTC (permalink / raw)
  To: Daniel Jacobowitz, gdb



> From: Daniel Jacobowitz [mailto:drow@false.org]
> 
> On Thu, May 11, 2006 at 08:42:03AM -0700, Jim Ingham wrote:
> > I think that the lack of notification about what has gone on when
> > somebody uses interpreter-exec to run the target is just a bug in the
> > interpreter-exec command.  Since that command allows lots of stuff to
> > go on behind the MI client's back, you need to inform the client
> > about this.  You could either post asynchronous notifications about
> > what happened (for instance an =running or whatever) or you can just
> > make the -interpreter-exec command behave like -exec-next when it
> > does indeed run the target.  The latter is what we did for Xcode, so
> > you get the *stopped message if the target was run.
> 
> This is a topic I'd like to see a single consensus on, sometime soon.
> I have an ulterior motive.
> 
> I wrote, some time ago, patches to use Guile to implement GDB CLI
> commands.  It works by, roughly, opening a bidirectional MI channel to
> Guile, and temporarily suspending the CLI channel.  But if the front
> end in use is MI, what notifications should that frontend get?  Should
> it be told the target is running, even if e.g. the user defined command
> just calls a function in the target?  Should the Guile interpreter get
> notifications when the user or MI client does something?
> 

IMHO, the MI interpreter should get a notification when the target changes
state from a side effect of CLI commands.  So the example, when the "runs"
command is executed (next, step, call, finish, signal etc...) an OOB should
be drop:
 ^running

Or for example if an external application drops a SIGINT on the inferior, I
do expect a notification. 
 *stopped,...

The GDB CLI channel probably does not need notification because the protocol
was not meant for this but rather a direct access by the users to gdb
commands, strictly query/answers.

> Basically, I think that getting this right requires multiple
> interpreters live at the same time.
> 

Is there really a case for this?  The scenario I see is within one
interpreter (say MI), you want to give more power to the users and let them
access advanced gdb commands, so the interpreter-exec provides this nicely.
The only problems is the side effects.  Notification does not have to be
complex, for example something like:
=state_change

Notification, could tell the front end to reload the settings (the
breakpoints, the watchpoints, dlls, etc ...)

> I'd like to come back to that code someday.  And, preferably, merge
> Perl and Python support also.  Kip Macy posted Perl bindings and the
> Python ones would be easy to write, now that I know Python - in fact
> it's the only one out of the three I'd be comfortable doing myself,
> the Guile bits were very skeletal.
> 


^ permalink raw reply	[flat|nested] 54+ messages in thread
* RE: asynchronous MI output commands
@ 2006-05-11 15:02 Alain Magloire
  2006-05-11 15:42 ` Bob Rossi
  0 siblings, 1 reply; 54+ messages in thread
From: Alain Magloire @ 2006-05-11 15:02 UTC (permalink / raw)
  To: gdb



> > > For the record, that's basically what I have in KDevelop. There's
> command
> > > queue, and commands are sent to gdb one-at-a-time, and responses come
> > > exactly in the same order. Remembering the last issued command (i.e.
> > > instance of GDBCommand class internal to KDevelop) makes it possible
> to
> > > route the response back to the original command.
> > >
> > > I'm don't quite understand the problems being discussed in this
> thread.
> > > It's
> > > not apparent why one has to know the type of the last command while
> > > parsing, and if so, why remembering the last command is bad idea.
> > >
> > > It's hard to believe that response from MI can be useful without
> knowing
> > > the
> > > last issued command. Say, response from -data-evaluate-expression is
> > > useless if you don't know what part of frontend wants that data --
> > > evaluating expression is used in many use cases. So, you need to
> associate
> > > extra data with commands anyway.
> > >
> >
> > I agree, the example that comes to my mind is "next", "step", "finish",
> > "continue" etc ...  To do some optimization front-ends will probably
> need to
> > know the last command issue (for example clearing all the variable state
> in
> > a variable view for "continue").
> 
> I see the point, however, how do you know if the user typed continue? I
> allow the user to have access to the console, and by doing so, I can't
> make any assumptions on what GDB is doing.
> 

I suppose you could intercept the CLI commands before sending it to GDB

> > Maybe I'm mistaken but I have the impression, looking at the thread,
> some
> > folks are confusing OOB and synchronous response that comes after
> issuing a
> > command.
> 
> I'm hopefull not confusing them, but maybe. For synchronous commands, I
> just think it's a little ugly that you need the MI input command to
> determine what an MI output command is.
> 

You can certainly parse the MI output without knowing what the input was.
The problem is when you get answer what do you do with it?  For example
-data-evaluate-expression may be an action for hovering or to update a tree
viewer etc... Most commands are "synchronous" i.e. an answered to a
question.  Usually front ends will have callbacks attach to the MI
question/command.


> For asynchronous commands, there is simply no way to know what you are
> looking at AFAIK. You just have to poke around until your fingers get
> tired. I still need to research this more though.
> 

OOB were suppose to be a way for GDB to notify of changes, that did not come
from a user action. Comes to mind hitting a breakpoint, thread creation,
loading of a library, etc...

> Bob Rossi


^ permalink raw reply	[flat|nested] 54+ messages in thread
* RE: asynchronous MI output commands
@ 2006-05-10 22:15 Alain Magloire
  2006-05-11  3:41 ` Bob Rossi
  0 siblings, 1 reply; 54+ messages in thread
From: Alain Magloire @ 2006-05-10 22:15 UTC (permalink / raw)
  To: Vladimir Prus, gdb



> 
> Daniel Jacobowitz wrote:
> 
> > On Sun, May 07, 2006 at 11:09:51PM +0200, Bjarke Viksoe wrote:
> >> In my case I wish to submit several commands at once and slowly digest
> >> the answer (over a remote line where the network round-trip is slow).
> >> Using the <token> is clumsy and doesn't solve the problem of having
> >> enough information to process the answer without keeping track of the
> >> question. Since separate components handle the output autonomously, I
> had
> >> to give up tracking a command-list, and instead had to make sure only 1
> >> question was lingering - thus making the entire solution run much
> slower
> >> than otherwise needed.
> >>
> >> I found that commands that return "^value" result-records (such as
> >> -var-evaluate-expression and -data-evaluate-expression) doesn't carry
> >> enough information. I don't think a model where the entire command is
> >> repeated in the output is a desirable design, but at least identifying
> >> the question-type and its crucial parameters would suffice.
> >
> > If I were writing a front-end, I would have an arbitration layer which
> > sent questions to GDB and received answers.  The answers will come back
> > one at a time, in the same order the questions were asked.  If you send
> > two -var-evaluate-expression commands, you'll get back two answers, in
> > that same order.
> >
> > Am I missing something?  Is there a reason that this isn't enough?
> 
> For the record, that's basically what I have in KDevelop. There's command
> queue, and commands are sent to gdb one-at-a-time, and responses come
> exactly in the same order. Remembering the last issued command (i.e.
> instance of GDBCommand class internal to KDevelop) makes it possible to
> route the response back to the original command.
> 
> I'm don't quite understand the problems being discussed in this thread.
> It's
> not apparent why one has to know the type of the last command while
> parsing, and if so, why remembering the last command is bad idea.
> 
> It's hard to believe that response from MI can be useful without knowing
> the
> last issued command. Say, response from -data-evaluate-expression is
> useless if you don't know what part of frontend wants that data --
> evaluating expression is used in many use cases. So, you need to associate
> extra data with commands anyway.
>

I agree, the example that comes to my mind is "next", "step", "finish",
"continue" etc ...  To do some optimization front-ends will probably need to
know the last command issue (for example clearing all the variable state in
a variable view for "continue").

Maybe I'm mistaken but I have the impression, looking at the thread, some
folks are confusing OOB and synchronous response that comes after issuing a
command.

An implementation of MI could be made to be totally asynchronous if all
response could be tag to a matching command.  OOB should not be paired to
any commands. 



^ permalink raw reply	[flat|nested] 54+ messages in thread
* RE: asynchronous MI output commands
@ 2006-05-09  9:46 Alain Magloire
  0 siblings, 0 replies; 54+ messages in thread
From: Alain Magloire @ 2006-05-09  9:46 UTC (permalink / raw)
  To: gdb; +Cc: DMI Mailing List



> Daniel Jacobowitz
> 
> On Sun, May 07, 2006 at 08:29:35PM -0400, Bob Rossi wrote:

....
> > Yes, I agree, if I knew the MI input command, I could use that to
> > determine what type of command I was looking at. If I won't be allowed
> > to add the command to the output record, then this is what I will do.
> >
> > However, I would like to be able to do this with out knowing the MI
> input
> > command. First, it makes the code more modular that takes the MI output
> > and turns it into something meaningful. Second, it's easy to gather a
> > bunch of MI output commands from the test suite or from FE user's with
> > FE problem, and parse just that output. Third, it validates that what
> > the user requested is what the user is getting. It is possible that the
> > FE and GDB could get mixed up I'm assumming.
> 
> You're trying to turn a response into a meaningful message without
> knowing what it's a response to.  I just don't see the benefit of this;
> although people keep telling me it's harder than I understand, I
> still haven't seen an example that I consider plausible.
> 

Right, 8-).  I think folks writing front-ends go naturally in that direction
because it is simply easier and it decouples the code so we do not need to
synchronize between commands and response.  Basically you can have one
thread posting commands and another parsing response.  But that said, I have
to agree with you, it is not a necessity and in reality we will need to
associate response with a command or a caller i.e. to update a tree view or
whatever viewer that initiate the sequence.

> It's easy to gather output from e.g. the testsuite, true.  But it's
> equally easy to record the commands - just about everything is going to
> go through mi_gdb_test, or you could even write a proxy between the
> testsuite and GDB which logged, or add the logging to GDB directly.  I
> know Eclipse's MI protocol log includes the commands it sent.
> 
> Your third point is valid, but does not seem particularly important to
> me.  If it's wrong, it's wrong.  GDB would just have to stitch the
> command name on at the end right before outputing the result record,
> so that wouldn't gain you much at all.
>

MI offers a simple way to associate response and commands, by tagging the
commands the ^done will come back with the associated tag.

> > Anyways, Daniel, thanks for taking time out of your busy schedule to
> > think about this issue. If you simply don't want something like this in
> > MI right now, I'll find a way to match the input with the output.
> 
> I'm not supreme dictator of this stuff; someone else is welcome to step
> in and disagree.  I'm just not convinced, either.
> 

OOB messages are important and are not necessarily associated with a
command, they may be side effects of something the front-end did not
initiate, for example loading libraries, creating threads etc ..

As you decoupling completely responses form command, may look like a good
idea only on the surface.


^ permalink raw reply	[flat|nested] 54+ messages in thread
[parent not found: <1147034156.28828.ezmlm@sourceware.org>]
* asynchronous MI output commands
@ 2006-05-06  1:26 Bob Rossi
  2006-05-06  1:59 ` Daniel Jacobowitz
  2006-05-06  3:27 ` Nick Roberts
  0 siblings, 2 replies; 54+ messages in thread
From: Bob Rossi @ 2006-05-06  1:26 UTC (permalink / raw)
  To: gdb

Hi,

I'm finally getting more time to build the next layer on top of my MI
parser. This layer will look at the parse tree and create a data
structure from it that the front end will find more useful. For
instance, for example,

Starting with this MI output command, 
  -file-list-exec-source-file
  ^done,line="1",file="main.c",fullname="/home/bob/cvs/gdbmi/builddir/src/main.c"
  (gdb)
I get back a parse tree, and from that, I'll define something like,

struct file_list_exec_source_file
{
  int line;
  char *filename;
  char *fullname;
};

with the correct values filled in.


So far, I've created the parse tree code, and a small TCL extension
which allows me to grab all of the MI output commands from the
testsuite. I've written all of these output commands to a temporary file,
which I use for input to my drive program.

The first problem that I've run into is determining if an MI output
command is synchronous or asynchronous. I can tell if the MI output
command is asynchronous by looking for, reason="abc", like below,
  47*stopped,reason="end-stepping-range",thread-id="0", ...

I'm assuming reason= has to be the first pair after stopped, or done,.

My question is, should we say it's a bug on GDB's part if reason= isn't
the first pair returned for an asynchronous MI output command? Should I
assume if the MI output command has reason= anywhere in it that it's an
asynchronous command? or should we add an extra piece of information into 
the MI output command stating that the command is asynchronous. 
For instance,

  47*stopped,asynchronous,reason="end-stepping-range",thread-id="0", ...

Thanks,
Bob Rossi


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

end of thread, other threads:[~2006-05-11 19:31 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-07 22:30 asynchronous MI output commands Bjarke Viksoe
2006-05-07 22:50 ` Daniel Jacobowitz
2006-05-08  0:36   ` Bjarke Viksoe
2006-05-08  1:52     ` Daniel Jacobowitz
2006-05-11 10:31 ` MI: anynchronous vs. synchronous Vladimir Prus
  -- strict thread matches above, loose matches on Subject: below --
2006-05-12  0:19 asynchronous MI output commands Alain Magloire
2006-05-11 15:02 Alain Magloire
2006-05-11 15:42 ` Bob Rossi
2006-05-11 16:40   ` Jim Ingham
2006-05-11 17:03     ` Daniel Jacobowitz
2006-05-11 17:35       ` Jim Ingham
2006-05-11 19:24     ` Bob Rossi
2006-05-11 19:25       ` Jim Ingham
2006-05-10 22:15 Alain Magloire
2006-05-11  3:41 ` Bob Rossi
2006-05-11  8:58   ` Vladimir Prus
2006-05-11 10:48     ` Bob Rossi
2006-05-11 10:52       ` Vladimir Prus
2006-05-11 11:14         ` Bob Rossi
2006-05-11 12:50           ` Vladimir Prus
2006-05-11 14:50             ` Bob Rossi
2006-05-09  9:46 Alain Magloire
     [not found] <1147034156.28828.ezmlm@sourceware.org>
2006-05-07 21:27 ` Bjarke Viksoe
2006-05-07 21:41   ` Daniel Jacobowitz
2006-05-10 12:43     ` Vladimir Prus
2006-05-06  1:26 Bob Rossi
2006-05-06  1:59 ` Daniel Jacobowitz
2006-05-06  2:48   ` Bob Rossi
2006-05-06  3:37     ` Nick Roberts
2006-05-06 15:20       ` Bob Rossi
2006-05-06  4:06     ` Daniel Jacobowitz
2006-05-06  4:05       ` Daniel Jacobowitz
2006-05-06 11:53       ` Bob Rossi
2006-05-06 12:06         ` Bob Rossi
2006-05-06  3:14   ` Bob Rossi
2006-05-06  4:04     ` Nick Roberts
2006-05-06 11:49       ` Daniel Jacobowitz
2006-05-06 11:50         ` Bob Rossi
2006-05-06 16:52           ` Daniel Jacobowitz
2006-05-06 19:45             ` Bob Rossi
2006-05-06 20:37               ` Daniel Jacobowitz
2006-05-07  0:44                 ` Bob Rossi
2006-05-07 20:35                   ` Daniel Jacobowitz
2006-05-07 20:42                     ` Bob Rossi
2006-05-07 22:01                       ` Daniel Jacobowitz
2006-05-08  1:22                         ` Bob Rossi
2006-05-08  2:03                           ` Daniel Jacobowitz
2006-05-09 21:48                             ` Bob Rossi
2006-05-08  6:38                           ` Nick Roberts
2006-05-08 11:28                             ` Bob Rossi
2006-05-08  1:26                         ` Bob Rossi
2006-05-06 11:51       ` Bob Rossi
2006-05-06  3:27 ` Nick Roberts
2006-05-06 16:40   ` Bob Rossi

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