aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2019-05-01 12:35:20 -0600
committerTom Tromey <tromey@adacore.com>2019-05-08 10:38:02 -0600
commited2b7c1703246eef1ce6b393ced99fe267cbeb7b (patch)
treec45d0fb40fb4972dfba9ed4654bcab410db29810 /gdb/remote.c
parentb0be6c912f9e901a87740c72f18be1e54ad5267d (diff)
downloadgdb-ed2b7c1703246eef1ce6b393ced99fe267cbeb7b.zip
gdb-ed2b7c1703246eef1ce6b393ced99fe267cbeb7b.tar.gz
gdb-ed2b7c1703246eef1ce6b393ced99fe267cbeb7b.tar.bz2
Move "watchdog" to remote.c
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.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r--gdb/remote.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gdb/remote.c b/gdb/remote.c
index 5e5fbbf..0fb7404 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -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);
}