From: Michael Snyder Date: Fri, 3 Jun 2005 14:39:44 +0000 (+0000) Subject: 2005-06-03 Michael Snyder X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6a815b5bcb72caf701eddb0e78ba76c49c0d3e80;p=thirdparty%2Fbinutils-gdb.git 2005-06-03 Michael Snyder * defs.h (noisy_command, quiet_command): New command types to be interpreted by cli-script.c. Turn on and off 'from_tty' output. * cli/cli-script.c (noisy_command, quiet_command): Interpret new pseudo-commands for user-defined scripts (which otherwise will frequently produce no output). --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 436925a75a2..db70c67f0dc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2005-06-03 Michael Snyder + + * defs.h (noisy_command, quiet_command): New command types + to be interpreted by cli-script.c. Turn on and off 'from_tty' + output. + * cli/cli-script.c (noisy_command, quiet_command): Interpret + new pseudo-commands for user-defined scripts (which otherwise + will frequently produce no output). + 2005-05-30 Michael Snyder Add support for writing tracepoint/checkpoint data to a file. diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index a4da9c5c586..fafc3064d00 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -245,6 +245,7 @@ do_restore_user_call_depth (void * call_depth) (*depth) = 0; } +static int from_tty; void execute_user_command (struct cmd_list_element *c, char *args) @@ -271,6 +272,7 @@ execute_user_command (struct cmd_list_element *c, char *args) user-defined function. */ old_chain = make_cleanup (do_restore_instream_cleanup, instream); instream = (FILE *) 0; + from_tty = 0; while (cmdlines) { ret = execute_control_command (cmdlines); @@ -304,13 +306,23 @@ execute_control_command (struct command_line *cmd) switch (cmd->control_type) { + case noisy_control: + from_tty = 1; + ret = simple_control; + break; + + case quiet_control: + from_tty = 0; + ret = simple_control; + break; + case simple_control: /* A simple command, execute it and return. */ new_line = insert_args (cmd->line); if (!new_line) break; make_cleanup (free_current_contents, &new_line); - execute_command (new_line, 0); + execute_command (new_line, from_tty); ret = cmd->control_type; break; @@ -739,6 +751,29 @@ read_next_line (struct command_line **command) first_arg++; *command = build_command_line (if_control, first_arg); } + /* Is this a request for noisy output (a la "from_tty")? */ + else if (p1 - p == 5 && !strncmp (p, "noisy", 5)) + { + *command = (struct command_line *) + xmalloc (sizeof (struct command_line)); + (*command)->next = NULL; + (*command)->line = NULL; + (*command)->control_type = noisy_control; + (*command)->body_count = 0; + (*command)->body_list = NULL; + } + /* Is this a request to stop noisy output (a la "from_tty")? */ + else if ((p1 - p == 5 && !strncmp (p, "quiet", 5)) || + (p1 - p == 6 && !strncmp (p, "silent", 6))) + { + *command = (struct command_line *) + xmalloc (sizeof (struct command_line)); + (*command)->next = NULL; + (*command)->line = NULL; + (*command)->control_type = quiet_control; + (*command)->body_count = 0; + (*command)->body_list = NULL; + } else if (p1 - p == 10 && !strncmp (p, "loop_break", 10)) { *command = (struct command_line *) @@ -810,6 +845,16 @@ recurse_read_control_structure (struct command_line *current_cmd) /* Just skip blanks and comments. */ if (val == nop_command) continue; + else if (val == noisy_command) + { + ret = noisy_control; + break; + } + else if (val == quiet_command) + { + ret = quiet_control; + break; + } if (val == end_command) { @@ -917,6 +962,16 @@ read_command_lines (char *prompt_arg, int from_tty) /* Ignore blank lines or comments. */ if (val == nop_command) continue; + else if (val == noisy_command) + { + ret = noisy_control; + break; + } + else if (val == quiet_command) + { + ret = quiet_control; + break; + } if (val == end_command) { diff --git a/gdb/defs.h b/gdb/defs.h index ac6e0ead597..6eaa9ada0fd 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -652,7 +652,9 @@ enum misc_command_type ok_command, end_command, else_command, - nop_command + nop_command, + quiet_command, + noisy_command }; enum command_control_type @@ -662,6 +664,8 @@ enum command_control_type continue_control, while_control, if_control, + noisy_control, + quiet_control, invalid_control };