]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2005-06-03 Michael Snyder <msnyder@redhat.com>
authorMichael Snyder <msnyder@vmware.com>
Fri, 3 Jun 2005 14:39:44 +0000 (14:39 +0000)
committerMichael Snyder <msnyder@vmware.com>
Fri, 3 Jun 2005 14:39:44 +0000 (14:39 +0000)
* 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).

gdb/ChangeLog
gdb/cli/cli-script.c
gdb/defs.h

index 436925a75a2a37225f952dd60f11f00758513927..db70c67f0dc8d25bc6c8044b12d3d72e4b7ef8b2 100644 (file)
@@ -1,3 +1,12 @@
+2005-06-03  Michael Snyder  <msnyder@redhat.com>
+
+       * 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  <msnyder@redhat.com>
 
        Add support for writing tracepoint/checkpoint data to a file.
index a4da9c5c5861d849c3afac382fb51c353eb170ea..fafc3064d004bb74cb5306782df3649f47c9e21d 100644 (file)
@@ -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)
        {
index ac6e0ead5974aaf72c18df2aad8b8b15e3f6166f..6eaa9ada0fd3b6f5956703a1c70957bcf467cc58 100644 (file)
@@ -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
   };