* RFA: Ugly "show user" output revisited
@ 2001-12-13 7:00 Jackie Smith Cashion
2001-12-13 10:45 ` Fernando Nasser
0 siblings, 1 reply; 3+ messages in thread
From: Jackie Smith Cashion @ 2001-12-13 7:00 UTC (permalink / raw)
To: GDB Patches
[-- Attachment #1: Type: text/plain, Size: 696 bytes --]
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 <jsmith@redhat.com>
* 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 <jsmith@redhat.com>
* gdb.base/commands.exp (user_defined_command_test): Make "show user"
test
expect string more specific.
[-- Attachment #2: cli-script.c.diff --]
[-- Type: text/plain, Size: 2622 bytes --]
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;
}
[-- Attachment #3: commands.exp.diff --]
[-- Type: text/plain, Size: 1151 bytes --]
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"
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: RFA: Ugly "show user" output revisited
2001-12-13 7:00 RFA: Ugly "show user" output revisited Jackie Smith Cashion
@ 2001-12-13 10:45 ` Fernando Nasser
2001-12-13 14:45 ` Jackie Smith Cashion
0 siblings, 1 reply; 3+ messages in thread
From: Fernando Nasser @ 2001-12-13 10:45 UTC (permalink / raw)
To: Jackie Smith Cashion; +Cc: GDB Patches
Jackie,
Have you checked if the output is OK with -i=mi as well?
Asuuming you did test that, you can check this in.
And thanks for the fix.
Fernando
Jackie Smith Cashion wrote:
>
> 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 <jsmith@redhat.com>
>
> * 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 <jsmith@redhat.com>
>
> * gdb.base/commands.exp (user_defined_command_test): Make "show user"
> test
> expect string more specific.
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> 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;
> }
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> 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"
> }
>
--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: RFA: Ugly "show user" output revisited
2001-12-13 10:45 ` Fernando Nasser
@ 2001-12-13 14:45 ` Jackie Smith Cashion
0 siblings, 0 replies; 3+ messages in thread
From: Jackie Smith Cashion @ 2001-12-13 14:45 UTC (permalink / raw)
To: Fernando Nasser; +Cc: GDB Patches
Fernando Nasser wrote:
>
> Jackie,
>
> Have you checked if the output is OK with -i=mi as well?
>
> Asuuming you did test that, you can check this in.
>
> And thanks for the fix.
>
> Fernando
I ran "gdb -nw -i=mi" and defined a command containing "while" and "if".
The output looked okay to me. I've committed my changes. -- Jackie
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-12-13 22:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-13 7:00 RFA: Ugly "show user" output revisited Jackie Smith Cashion
2001-12-13 10:45 ` Fernando Nasser
2001-12-13 14:45 ` Jackie Smith Cashion
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox