Re: MI3 and async notifications

Jan Vrany
2019-06-17T20:58:04Z

On Mon, 2019-06-17 at 16:45 -0400, Joel Brobecker wrote:
> > > Jonah, I was about to ask the same. I understand that you need to know
> > > which breakpoint has been inserted by given command, but this
> > > if we respond with something like
> > >
> > > 1-break-insert main
> > > =breakpoint-created,bkpt={number="1",type=...}
> > > 1^done,bkpt-number=1
> > >
> > > then you just search for breakpoint with that id, no? Given that MI
> > > guarantees that =breakpoint-created arrives before ^done reply to command.
> > > Am I missing something?
> > >
> >
> > No you aren't missing anything. That would be a perfectly acceptable
> > solution for CDT.
> >
> > There would still be some other new logic needed for CDT, we would
> > still have to store all the =breakpoint-created if there is a
> > -break-insert active and then process all of them when the ^done is
> > received. However that seems fairly reasonable.
>
> Do we even need the bkpt-number=1 attribute in the "done" command?
> The notification includes that information, so the GUI should have
> enough info from there to determine which UI element to update, right?
>

I think so. Imagine you have a UI with breakpoint list and there's
an "Add Breakpoint" button. When "Add Breakpoint" is pressed, user
fills location, press "OK", new breakpoint is added and
*UI pre-selects just added breakpoint*. This is IMO sensible UI behavior.

Now, when you press "OK" to add the breakpoint on a location, behind the scenes
frontend issues -break-insert command and waits for ^done confirmation.
But as Jonah mentioned, another breakpoint could be inserted meanwhile so
you'd get something like this on MI channel.

10-break-insert main
=breakpoint-created,bkpt={number="1",type=...<some unrelated breakpoint from CLI or script>}
=breakpoint-created,bkpt={number="2",type=...<the breakpoint on main you just requested>}
=breakpoint-created,bkpt={number="3",type=...<some unrelated breakpoint from CLI or script>}
10^done

Now, if ^done response would not contain bkpt-number=2 attribute, how would you know which
is the breakpoint you need to pre-select in the UI?

Jan