aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2004-09-10 23:12:12 +0000
committerJason Molenda <jmolenda@apple.com>2004-09-10 23:12:12 +0000
commit33f2d567787fbbb2103a462d0f10678a3e9af211 (patch)
tree04c56d924e1800dba8ec2e9e4e6022bc0069e615 /gdb/cli
parentf4eae89cf7214078d2e9b5c2ab5f50e74c5f1d0f (diff)
downloadgdb-33f2d567787fbbb2103a462d0f10678a3e9af211.zip
gdb-33f2d567787fbbb2103a462d0f10678a3e9af211.tar.gz
gdb-33f2d567787fbbb2103a462d0f10678a3e9af211.tar.bz2
[gdb/ChangeLog]
2004-09-10 Jason Molenda (jmolenda@apple.com) * cli/cli-script.c (read_next_line): Accept zero or more whitespace chars after 'if' or 'while' commands in user-defined commands. [gdb/testsuite/ChangeLog] 2004-09-10 Jason Molenda (jmolenda@apple.com) * gdb.base/define.exp: Two new tests to verify zero space chars after 'if' and 'while' commands in a user-defined command is correctly parsed. Approved here: http://sources.redhat.com/ml/gdb-patches/2004-09/msg00160.html http://sources.redhat.com/ml/gdb-patches/2004-09/msg00157.html
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-script.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 165702d..1f1cf1d 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -1,7 +1,7 @@
/* GDB CLI command scripting.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
- 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software
+ 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004 Free Software
Foundation, Inc.
This file is part of GDB.
@@ -727,9 +727,21 @@ read_next_line (struct command_line **command)
/* Check for while, if, break, continue, etc and build a new command
line structure for them. */
if (p1 - p > 5 && !strncmp (p, "while", 5))
- *command = build_command_line (while_control, p + 6);
+ {
+ char *first_arg;
+ first_arg = p + 5;
+ while (first_arg < p1 && isspace (*first_arg))
+ first_arg++;
+ *command = build_command_line (while_control, first_arg);
+ }
else if (p1 - p > 2 && !strncmp (p, "if", 2))
- *command = build_command_line (if_control, p + 3);
+ {
+ char *first_arg;
+ first_arg = p + 2;
+ while (first_arg < p1 && isspace (*first_arg))
+ first_arg++;
+ *command = build_command_line (if_control, first_arg);
+ }
else if (p1 - p == 10 && !strncmp (p, "loop_break", 10))
{
*command = (struct command_line *)