From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fernando Nasser To: Jackie Smith Cashion Cc: GDB Patches Subject: Re: RFA: "show user" output Date: Sun, 09 Sep 2001 08:15:00 -0000 Message-id: <3B9B86B7.99F8745F@redhat.com> References: <3B97F051.7D3E36C2@redhat.com> <3B98D43B.777559DD@redhat.com> <3B990AFF.2B2AD149@redhat.com> <3B9A5FF3.6F86B916@redhat.com> <3B9ACF17.52E37573@redhat.com> X-SW-Source: 2001-09/msg00122.html Jackie Smith Cashion wrote: > > Thanks for the ui_out explanation. This means I need to use > ui_out_spaces to do the indenting and ui_out_field_fmt and > ui_out_field_string to print the keywords. Following the example set in > the current version of the code I will use ui_out_text to print the > carriage returns. Here's my modified patch: > You've got it. From visual inspection it looks perfect. I have only one question: how come there wasn't a FAILing test in gdb.base/commands.exp (or there was)? And in gdb.mi? Tradition says that as you've fixed it you should also add a little test to prevent it to be broken again ;-) Thanks for the fix. Regards, Fernando > -- > 2001-09-08 Jackie Smith Cashion > > * cli/cli-script.c (print_command_lines): Remove extra > "if", "else", "while", and "end" from show user output. > > -- > Index: cli-script.c > =================================================================== > RCS file: /cvs/src/src/gdb/cli/cli-script.c,v > retrieving revision 1.7 > diff -c -3 -p -r1.7 cli-script.c > *** cli-script.c 2001/06/17 15:16:12 1.7 > --- cli-script.c 2001/09/09 01:56:47 > *************** print_command_lines (struct ui_out *uiou > *** 171,184 **** > /* A while command. Recursively print its subcommands and > continue. */ > if (list->control_type == while_control) > { > - ui_out_text (uiout, "while "); > ui_out_field_fmt (uiout, NULL, "while %s", list->line); > ui_out_text (uiout, "\n"); > print_command_lines (uiout, *list->body_list, depth + 1); > - ui_out_field_string (uiout, NULL, "end"); > if (depth) > ui_out_spaces (uiout, 2 * depth); > ! ui_out_text (uiout, "end\n"); > list = list->next; > continue; > } > --- 171,183 ---- > /* A while command. Recursively print its subcommands and > continue. */ > if (list->control_type == while_control) > { > ui_out_field_fmt (uiout, NULL, "while %s", list->line); > ui_out_text (uiout, "\n"); > print_command_lines (uiout, *list->body_list, depth + 1); > if (depth) > ui_out_spaces (uiout, 2 * depth); > ! ui_out_field_string (uiout, NULL, "end"); > ! ui_out_text (uiout, "\n"); > list = list->next; > continue; > } > *************** print_command_lines (struct ui_out *uiou > *** 186,192 **** > /* An if command. Recursively print both arms before > continueing. */ > if (list->control_type == if_control) > { > - ui_out_text (uiout, "if "); > ui_out_field_fmt (uiout, NULL, "if %s", list->line); > ui_out_text (uiout, "\n"); > /* The true arm. */ > --- 185,190 ---- > *************** print_command_lines (struct ui_out *uiou > *** 198,211 **** > 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"); > list = list->next; > continue; > } > --- 196,209 ---- > if (depth) > ui_out_spaces (uiout, 2 * depth); > ui_out_field_string (uiout, NULL, "else"); > ! ui_out_text (uiout, "\n"); > print_command_lines (uiout, list->body_list[1], depth + 1); > } > > if (depth) > ui_out_spaces (uiout, 2 * depth); > ! ui_out_field_string (uiout, NULL, "end"); > ! ui_out_text (uiout, "\n"); > list = list->next; > continue; > } > > -- > 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