aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorDoug Evans <xdje42@gmail.com>2013-11-23 11:47:24 -0800
committerDoug Evans <xdje42@gmail.com>2013-11-23 11:47:24 -0800
commit1e9c71b81b1cc28aea5b8cceeeac5435d37b752a (patch)
tree6e3b3e9602943ac406005282aca2063c85d01a4b /gdb
parent9df9dbe031e8f643651f638823eed773a4037af7 (diff)
downloadgdb-1e9c71b81b1cc28aea5b8cceeeac5435d37b752a.zip
gdb-1e9c71b81b1cc28aea5b8cceeeac5435d37b752a.tar.gz
gdb-1e9c71b81b1cc28aea5b8cceeeac5435d37b752a.tar.bz2
cli/cli-script.c (multi_line_command_p): New function.
* cli/cli-script.c (multi_line_command_p): New function. (recurse_read_control_structure, read_command_lines_1): Call it. (execute_control_command): Consistently have a blank line between each case.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/cli/cli-script.c39
2 files changed, 31 insertions, 15 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 77aec04..db947ea 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2013-11-23 Doug Evans <xdje42@gmail.com>
+
+ * cli/cli-script.c (multi_line_command_p): New function.
+ (recurse_read_control_structure, read_command_lines_1): Call it.
+ (execute_control_command): Consistently have a blank line between
+ each case.
+
2013-11-22 Sterling Augustine <saugustine@google.com>
PR gdb/16196:
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 3e8ed7f..387a11e 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -78,6 +78,25 @@ struct user_args
*user_args;
+/* Return non-zero if TYPE is a multi-line command (i.e., is terminated
+ by "end"). */
+
+static int
+multi_line_command_p (enum command_control_type type)
+{
+ switch (type)
+ {
+ case if_control:
+ case while_control:
+ case while_stepping_control:
+ case commands_control:
+ case python_control:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
/* Allocate, initialize a new command line structure for one of the
control commands (if/while). */
@@ -556,6 +575,7 @@ execute_control_command (struct command_line *cmd)
break;
}
+
case commands_control:
{
/* Breakpoint commands list, record the commands in the
@@ -567,6 +587,7 @@ execute_control_command (struct command_line *cmd)
ret = commands_from_control_command (new_line, cmd);
break;
}
+
case python_control:
{
eval_python_from_control_command (cmd);
@@ -1103,11 +1124,7 @@ recurse_read_control_structure (char * (*read_next_line_func) (void),
if (val == end_command)
{
- if (current_cmd->control_type == while_control
- || current_cmd->control_type == while_stepping_control
- || current_cmd->control_type == if_control
- || current_cmd->control_type == python_control
- || current_cmd->control_type == commands_control)
+ if (multi_line_command_p (current_cmd->control_type))
{
/* Success reading an entire canned sequence of commands. */
ret = simple_control;
@@ -1156,11 +1173,7 @@ recurse_read_control_structure (char * (*read_next_line_func) (void),
/* If the latest line is another control structure, then recurse
on it. */
- if (next->control_type == while_control
- || next->control_type == while_stepping_control
- || next->control_type == if_control
- || next->control_type == python_control
- || next->control_type == commands_control)
+ if (multi_line_command_p (next->control_type))
{
control_level++;
ret = recurse_read_control_structure (read_next_line_func, next,
@@ -1275,11 +1288,7 @@ read_command_lines_1 (char * (*read_next_line_func) (void), int parse_commands,
break;
}
- if (next->control_type == while_control
- || next->control_type == if_control
- || next->control_type == python_control
- || next->control_type == commands_control
- || next->control_type == while_stepping_control)
+ if (multi_line_command_p (next->control_type))
{
control_level++;
ret = recurse_read_control_structure (read_next_line_func, next,