This is the mail archive of the gdb-patches@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]

Re: RFA: "show user" output


Jackie Smith Cashion wrote:
>
> (...)
> 
> Is
> there a general rule?
> 

Yes.

uiout_text() only generates formatting output so things look good for
human 
eyes.  The MI incarnation of it produces no output (other machine
oriented 
implementations would do the same).  ui_out_spaces() is just a
specialized
version of uiout_text().

uiout_field_*() functions produce output that conveys information.  The
"cli_"
implementation of output prints them while the "mi_" version formats
them for
machine decoding.

So, if your console output is not looking good, you adjust your
uiout_text()
or uiout_spaces() so it looks nice.  Avoid meddling with the
uiout_field_*()
calls.

P.S.: I believe there is a test case for the MI output of commands in
the
gdb/testsuite/gdb.mi subdirectory.

Regards,
Fernando

> 
> Fernando Nasser wrote:
> >
> > Have you checked the MI output before and after your patch?
> >
> > In particular, this bit suggests that in this last chunk you've removed
> > the
> > "good" else/end and left the "bad" ones ;-)
> >
> > > *************** print_command_lines (struct ui_out *uiou
> > > *** 197,208 ****
> > >             {
> > >               if (depth)
> > >                 ui_out_spaces (uiout, 2 * depth);
> > > -             ui_out_field_string (uiout, NULL, "else");
> > >               ui_out_text (uiout, "else\n");
> > >               print_command_lines (uiout, list->body_list[1], depth + 1);
> > >             }
> > >
> > > -         ui_out_field_string (uiout, NULL, "end");
> > >           if (depth)
> > >             ui_out_spaces (uiout, 2 * depth);
> > >           ui_out_text (uiout, "end\n");
> > > --- 194,203 ----
> >
> > Regards,
> > Fernando
> >
> > --
> > Fernando Nasser
> > Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
> > 2323 Yonge Street, Suite #300
> > Toronto, Ontario   M4P 2C9
> 
> --
> 
> Jackie Smith Cashion
> 
> email:  jsmith@redhat.com
> phone:  931 438 2432

-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


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