From patchwork Wed May 1 18:44:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 32479 Received: (qmail 49693 invoked by alias); 1 May 2019 18:44:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 49656 invoked by uid 89); 1 May 2019 18:44:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=forever, Eventually, hung, HContent-Transfer-Encoding:8bit X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 01 May 2019 18:44:06 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 37BF7117520; Wed, 1 May 2019 14:44:05 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id OgfXTXr79zjY; Wed, 1 May 2019 14:44:05 -0400 (EDT) Received: from murgatroyd.Home (97-122-168-123.hlrn.qwest.net [97.122.168.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id D59631173B3; Wed, 1 May 2019 14:44:04 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 3/4] Move "watchdog" to remote.c Date: Wed, 1 May 2019 12:44:01 -0600 Message-Id: <20190501184402.4030-4-tromey@adacore.com> In-Reply-To: <20190501184402.4030-1-tromey@adacore.com> References: <20190501184402.4030-1-tromey@adacore.com> MIME-Version: 1.0 The "watchdog" global is only used in remote.c, so this patch moves it there and makes it static. 2019-05-01 Tom Tromey * 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 | 10 ++++++++++ gdb/defs.h | 4 ---- gdb/maint.c | 24 ------------------------ gdb/remote.c | 24 ++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 28 deletions(-) diff --git a/gdb/defs.h b/gdb/defs.h index 5a1995b4991..e95d0d43480 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -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; diff --git a/gdb/maint.c b/gdb/maint.c index 8fc660eb939..328d6026a34 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -46,20 +46,6 @@ 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."), _("\ diff --git a/gdb/remote.c b/gdb/remote.c index 5e5fbbf8c34..0fb7404b068 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); }