This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: probing GDB for MI versions


On Wed, Oct 13, 2004 at 06:47:37AM +0200, Eli Zaretskii wrote:
> > Date: Tue, 12 Oct 2004 20:31:35 -0400
> > From: 'Bob Rossi' <bob@brasko.net>
> > 
> > With this idea there are 2 alternatives I can think of.
> >    * put the handshaking under a different interpreter (-i=mi-handshake)
> >    * integrate the handshaking as part of the MI protocol (version 3 and on)
> 
> What's wrong with a simpler idea already suggested here: that GDB will
> output the MI version as part of the starting blurb when invoked with
> "-interpreter=mi" option?

That method is fine if GDB supports only one stable MI protocol at a
time. However, I have been told that GDB will support multiple versions
of MI at a time.

If GDB supported only one stable MI version at a time, then it could
just do what you are saying, tell the front end what version it is going
to output. This is basically how XML and HTML documents work. The first
line is the version of the file, and the client reads that and uses the
appropriate parser.

However, GDB is not that simple. It can support several versions of the
MI protocol. Some of the versions can be developmental, others can be
stable, and others can be unstable. For instance, the current GDB has
mi2 being stable, and mi1 being unstable (not tested). For this reason,
GDB and the front end actually need to handshake to determine what
protocol should be used. I'm assuming that this is more like the
Ethernet example someone brought up were all of the devices have to
query each other to figure out what protocol to use.

Here is something I came up with last night,

   GDB/MI Handshaking output

   mi-handshake-input  => mi-protocol-output [ "," mi-protocol-output ]* nl
   mi-protocol-output  => mi-protocol-class "=" mi-protocol
   mi-protocol-class   => "mi_unsupported" | "mi_supported" | "mi_development"
   mi-protocol         => "mi" digit
   digit               => 1 | 1 + digit
   nl                  => CR | CR NL | NL

   GDB/MI Handshaking input

   mi-handshake-input => mi-protocol nl

Obviously, that results in GDB outputting something like,
   mi_unsupported=mi1,mi_supported=mi2,mi_development=mi3
and the front end sending to GDB simply "mi2".

Thanks,
Bob Rossi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]