This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: interpreter_p && strcmp (interpreter_p, "mi") == 0
- To: Fernando Nasser <fnasser at redhat dot com>
- Subject: Re: interpreter_p && strcmp (interpreter_p, "mi") == 0
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Sun, 10 Jun 2001 16:42:36 -0400
- Cc: GDB Discussion <gdb at sources dot redhat dot com>
- References: <3B219562.8050609@cygnus.com> <3B239117.F01A090C@redhat.com>
> Hello,
>>
>> In going over the MI sources I've come across this little gem (it is
>> scattered through out both breakpoint.c and infrun.c). I'm now trying
>> to remember what discussion went on about it back when it was introduced
>> and how to now go back and fix it (I know there was some but it would
>> have been Cygnus internal :-( ).
>>
>> Briefly, there are a number of functions for which the behavour changes
>> when the MI output is enabled:
>>
>> o extra information not part of
>> the normal CLI output is added
>>
>> o the output is made fixed
>>
>> The reason I noticed this is because I was playing around with having
>> ``-i=mi1'' for the old syntax and ``-i=mi'' for the final syntax.
>>
>> Andrew
>
>
> The MI is not capable of generating output that was not also printed.
> This must have been added by someone trying to circumvent that.
Yep, you, me and Elena :-)
> As far as I can remember, the way I recommended that to be fixed was by
> splitting the code that used to generate the console output into two
> functions -- the actual task (libgdb function) and a CLI printing part.
> Then, making the MI call the former would allow it to generate the
> output in whatever way it wants.
I don't remember, the libgdb doco paints the same picture. I do
remember that pratically from day one, refusing to include a GDB CLI on
the (now dead) churchill IDE, because we knew we couldn't do it right.
> This, of course, is more work and may be tricky in some cases, but it is
> something that has to be done anyway so we get a UI-free libgdb.
Dig, dig, dig. Elena sumarized the problem in this message:
> Those tests address two needs:
>
> 1. We don't have a function that does the printing only in case of MI.
> We have a function (ui_out_text) that does printing only if CLI and
> not MI mode. We don't have the opposite. If we did, we wouldn't need
> those tests. We can write such a function and embed the test into it.
> Those prints I am referring to should be done (I believe) for any
> interpreter, the check that interpreter_p == MI is kind of redundant.
The first one I'm looking at is breakpoints. For that I think I'll add
an extra parameter to table_begin() to indicate if the number of rows is
nonzero. That way the cli and MI can each decide what to do when there
are no rows.
> 2. The other role those conditionals have is to sligtly alter the
> behavior of gdb. For instance when gdb prints the location and source
> line of where it stopped at. Gdb in cli mode changes the way of
> printing that info depending on the command it was executing, while in
> mi mode, it always prints the info in the same consistent way (I
> needed to overwrite a flag for mi/interpreter mode only). In these
> cases, again I think we could maybe avoid checking whether it is mi.
Now that this code is public, such manipulation becomes possible.
Andrew