From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5372 invoked by alias); 13 Dec 2001 15:00:10 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 5321 invoked from network); 13 Dec 2001 15:00:03 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sources.redhat.com with SMTP; 13 Dec 2001 15:00:03 -0000 Received: from redhat.com (cse.cygnus.com [205.180.230.236]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id HAA21153 for ; Thu, 13 Dec 2001 07:00:01 -0800 (PST) Message-ID: <3C18C219.3AC7CBC1@redhat.com> Date: Thu, 13 Dec 2001 07:00:00 -0000 From: Jackie Smith Cashion X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2 i686) X-Accept-Language: en MIME-Version: 1.0 To: GDB Patches Subject: RFA: Ugly "show user" output revisited Content-Type: multipart/mixed; boundary="------------AFA2F977FADC5439C25CE58F" X-SW-Source: 2001-12/txt/msg00343.txt.bz2 This is a multi-part message in MIME format. --------------AFA2F977FADC5439C25CE58F Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-length: 696 In September I submitted a proposed patch to fix the "show user" output. (Command verbs like "if" and "while" are displayed twice.) I got involved in another project and let that patch fall on the floor. Here is a new variation of that patch with an associated testsuite change that I would like for you to consider. -- Jackie gdb/ChangeLog: 2001-12-13 Jackie Smith Cashion * cli/cli-script.c (print_command_lines): Remove extra "if", "else", "while", and "end" from show user output. testsuite/ChangeLog: 2001-12-13 Jackie Smith Cashion * gdb.base/commands.exp (user_defined_command_test): Make "show user" test expect string more specific. --------------AFA2F977FADC5439C25CE58F Content-Type: text/plain; charset=us-ascii; name="cli-script.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="cli-script.c.diff" Content-length: 2622 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/12/13 14:24:46 *************** 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; } --------------AFA2F977FADC5439C25CE58F Content-Type: text/plain; charset=us-ascii; name="commands.exp.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="commands.exp.diff" Content-length: 1151 Index: commands.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/commands.exp,v retrieving revision 1.9 diff -c -3 -p -r1.9 commands.exp *** commands.exp 2001/05/23 19:04:13 1.9 --- commands.exp 2001/12/13 14:25:52 *************** proc user_defined_command_test {} { *** 261,267 **** "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \ "execute user defined command in user_defined_command_test" gdb_test "show user mycommand" \ ! "while.*set.*if.*p/x.*else.*p/x.*end.*" \ "display user command in user_defined_command_test" } --- 261,267 ---- "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \ "execute user defined command in user_defined_command_test" gdb_test "show user mycommand" \ ! " while \\\$arg0.*set.* if \\\(\\\$arg0.*p/x.* else\[^\n\].*p/x.* end\[^\n\].* end\[^\n\].*" \ "display user command in user_defined_command_test" } --------------AFA2F977FADC5439C25CE58F--