Move "watchdog" to remote.c
authorTom Tromey <tromey@adacore.com>
Wed, 1 May 2019 18:35:20 +0000 (12:35 -0600)
committerTom Tromey <tromey@adacore.com>
Wed, 8 May 2019 16:38:02 +0000 (10:38 -0600)
The "watchdog" global is only used in remote.c, so this patch moves it
there and makes it static.

gdb/ChangeLog
2019-05-08  Tom Tromey  <tromey@adacore.com>

* maint.c (_initialize_maint_cmds): Move initialization code to
remote.c.
(watchdog, show_watchdog): Move to remote.c.
* remote.c (watchdog, show_watchdog): Move from maint.c.  Make
"watchdog" static.
(_initialize_remote): Move initialization code from maint.c.
* defs.h (watchdog): Don't declare.

gdb/ChangeLog
gdb/defs.h
gdb/maint.c
gdb/remote.c

index 700afe7526b42a7d304e2bf524359d6e2c7ff1eb..836ed8acef04ba8e5c5cf842c1b3722209fc5972 100644 (file)
@@ -1,3 +1,13 @@
+2019-05-08  Tom Tromey  <tromey@adacore.com>
+
+       * maint.c (_initialize_maint_cmds): Move initialization code to
+       remote.c.
+       (watchdog, show_watchdog): Move to remote.c.
+       * remote.c (watchdog, show_watchdog): Move from maint.c.  Make
+       "watchdog" static.
+       (_initialize_remote): Move initialization code from maint.c.
+       * defs.h (watchdog): Don't declare.
+
 2019-05-08  Tom Tromey  <tromey@adacore.com>
 
        * tui/tui-interp.c: Include main.h.
index 5a1995b49918244d58be8817d2e2f7ae3d716a56..e95d0d434805444840edc54d19ebf8d07e193939 100644 (file)
@@ -578,10 +578,6 @@ extern void copy_integer_to_size (gdb_byte *dest, int dest_size,
                                  const gdb_byte *source, int source_size,
                                  bool is_signed, enum bfd_endian byte_order);
 
-/* From valops.c */
-
-extern int watchdog;
-
 /* Hooks for alternate command interfaces.  */
 
 struct target_waitstatus;
index 8fc660eb939453f3f7f1b3f0c04d413091e415dc..328d6026a341c95798d295f786812b279e7e3c98 100644 (file)
 
 static void maintenance_do_deprecate (const char *, int);
 
-/* Set this to the maximum number of seconds to wait instead of waiting forever
-   in target_wait().  If this timer times out, then it generates an error and
-   the command is aborted.  This replaces most of the need for timeouts in the
-   GDB test suite, and makes it possible to distinguish between a hung target
-   and one with slow communications.  */
-
-int watchdog = 0;
-static void
-show_watchdog (struct ui_file *file, int from_tty,
-              struct cmd_list_element *c, const char *value)
-{
-  fprintf_filtered (file, _("Watchdog timer is %s.\n"), value);
-}
-
 /* Access the maintenance subcommands.  */
 
 static void
@@ -1148,16 +1134,6 @@ If a filter is given, only the tests with that value in their name will ran."),
   add_cmd ("selftests", class_maintenance, maintenance_info_selftests,
         _("List the registered selftests."), &maintenanceinfolist);
 
-  add_setshow_zinteger_cmd ("watchdog", class_maintenance, &watchdog, _("\
-Set watchdog timer."), _("\
-Show watchdog timer."), _("\
-When non-zero, this timeout is used instead of waiting forever for a target\n\
-to finish a low-level step or continue operation.  If the specified amount\n\
-of time passes without a response from the target, an error occurs."),
-                           NULL,
-                           show_watchdog,
-                           &setlist, &showlist);
-
   add_setshow_boolean_cmd ("profile", class_maintenance,
                           &maintenance_profile_p, _("\
 Set internal profiling."), _("\
index 5e5fbbf8c34d09fe2de06eb6ff7b348a6d0aaf7b..0fb7404b0682a41d909a7419340a034dd71d8bcc 100644 (file)
@@ -9461,6 +9461,20 @@ remote_target::read_frame (gdb::char_vector *buf_p)
     }
 }
 
+/* Set this to the maximum number of seconds to wait instead of waiting forever
+   in target_wait().  If this timer times out, then it generates an error and
+   the command is aborted.  This replaces most of the need for timeouts in the
+   GDB test suite, and makes it possible to distinguish between a hung target
+   and one with slow communications.  */
+
+static int watchdog = 0;
+static void
+show_watchdog (struct ui_file *file, int from_tty,
+              struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file, _("Watchdog timer is %s.\n"), value);
+}
+
 /* Read a packet from the remote machine, with error checking, and
    store it in *BUF.  Resize *BUF if necessary to hold the result.  If
    FOREVER, wait forever rather than timing out; this is used (in
@@ -14752,6 +14766,16 @@ stepping is supported by the target.  The default is on."),
                           &setlist,
                           &showlist);
 
+  add_setshow_zinteger_cmd ("watchdog", class_maintenance, &watchdog, _("\
+Set watchdog timer."), _("\
+Show watchdog timer."), _("\
+When non-zero, this timeout is used instead of waiting forever for a target\n\
+to finish a low-level step or continue operation.  If the specified amount\n\
+of time passes without a response from the target, an error occurs."),
+                           NULL,
+                           show_watchdog,
+                           &setlist, &showlist);
+
   /* Eventually initialize fileio.  See fileio.c */
   initialize_remote_fileio (remote_set_cmdlist, remote_show_cmdlist);
 }
This page took 0.033028 seconds and 4 git commands to generate.