PR python/12216:
authorTom Tromey <tromey@redhat.com>
Mon, 31 Jan 2011 16:52:35 +0000 (16:52 +0000)
committerTom Tromey <tromey@redhat.com>
Mon, 31 Jan 2011 16:52:35 +0000 (16:52 +0000)
* python/python.c (execute_gdb_command): Call
prevent_dont_repeat.
* top.c (suppress_dont_repeat): New global.
(dont_repeat): Use it.
(prevent_dont_repeat): New function.
* command.h (prevent_dont_repeat): Declare.

gdb/ChangeLog
gdb/command.h
gdb/python/python.c
gdb/top.c

index 5e749fa549f6df81a03b3cf56a29f1b9b641fb5b..7b4aae2f3cdf7c3eab5b4d37b9b19efbaab0cd2d 100644 (file)
@@ -1,3 +1,13 @@
+2011-01-31  Tom Tromey  <tromey@redhat.com>
+
+       PR python/12216:
+       * python/python.c (execute_gdb_command): Call
+       prevent_dont_repeat.
+       * top.c (suppress_dont_repeat): New global.
+       (dont_repeat): Use it.
+       (prevent_dont_repeat): New function.
+       * command.h (prevent_dont_repeat): Declare.
+
 2011-01-31  Tom Tromey  <tromey@redhat.com>
 
        * infcmd.c (finish_backward): Use breakpoint_set_silent.
index f53cc80af62393f0ce18c4e59c1730a9cab569e6..d2f5ca501f75b8cd156b1a177da6cfb777a40673 100644 (file)
@@ -355,6 +355,8 @@ extern void error_no_arg (char *) ATTRIBUTE_NORETURN;
 
 extern void dont_repeat (void);
 
+extern struct cleanup *prevent_dont_repeat (void);
+
 /* Used to mark commands that don't do anything.  If we just leave the
    function field NULL, the command is interpreted as a help topic, or
    as a class of commands.  */
index 134e730064c683ae8d6052b0e927e426e6ae66ed..b2ee8f9bb218f5ee42aac950a1a4287f25d53b34 100644 (file)
@@ -375,6 +375,7 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
       char *copy = xstrdup (arg);
       struct cleanup *cleanup = make_cleanup (xfree, copy);
 
+      prevent_dont_repeat ();
       if (to_string)
        result = execute_command_to_string (copy, from_tty);
       else
index d14f308942d1997af3f34500b8d023a93703c41c..df2b1633209e283df9e216d366ffa690c77cc5d9 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -546,12 +546,17 @@ command_loop (void)
     }
 }
 \f
+/* When nonzero, cause dont_repeat to do nothing.  This should only be
+   set via prevent_dont_repeat.  */
+
+static int suppress_dont_repeat = 0;
+
 /* Commands call this if they do not want to be repeated by null lines.  */
 
 void
 dont_repeat (void)
 {
-  if (server_command)
+  if (suppress_dont_repeat || server_command)
     return;
 
   /* If we aren't reading from standard input, we are saving the last
@@ -560,6 +565,19 @@ dont_repeat (void)
   if (instream == stdin)
     *line = 0;
 }
+
+/* Prevent dont_repeat from working, and return a cleanup that
+   restores the previous state.  */
+
+struct cleanup *
+prevent_dont_repeat (void)
+{
+  struct cleanup *result = make_cleanup_restore_integer (&suppress_dont_repeat);
+
+  suppress_dont_repeat = 1;
+  return result;
+}
+
 \f
 /* Read a line from the stream "instream" without command line editing.
 
This page took 0.03367 seconds and 4 git commands to generate.