From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 44EF43858D39; Wed, 31 Aug 2022 17:00:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 44EF43858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1661965202; bh=n0UAzmTz8Kh5fMqz/qN99lUEnPA45+1gFSvFAyraykU=; h=From:To:Subject:Date:From; b=nh9nzM/+pRubRq1QqHjSig+vEuwEjvvuyXNI4U8Hdag43aop1ot/oglxqjudKNRxc tZtXbNjg6sC7VrDFZ7w6PuGTerGanNLNMjfUv3CFvqA1DRThJn5u+Xn5se/kbHIDdL QgjWAuZ4nzJz7k9jPf0ZWknEmCWBxjGNcQzhA+RU= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Let ui::input_fd be -1 X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 4749b84b51bcaa59acfb8bda5d9e134432528cf9 X-Git-Newrev: 51cacdb50fd2ac2240172a63140e56c0adb41742 Message-Id: <20220831170002.44EF43858D39@sourceware.org> Date: Wed, 31 Aug 2022 17:00:02 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D51cacdb50fd2= ac2240172a63140e56c0adb41742 commit 51cacdb50fd2ac2240172a63140e56c0adb41742 Author: Tom Tromey Date: Tue Aug 30 11:30:13 2022 -0600 Let ui::input_fd be -1 =20 This changes gdb so that, if ui::input_fd is set to -1, then it will not be registered with the event loop. This is useful for the DAP support code I wrote, but as it turns out to also be useful to Insight, it seems best to check it in separately. Diff: --- gdb/event-top.c | 8 +++++--- gdb/top.h | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/gdb/event-top.c b/gdb/event-top.c index 02b3786320f..4547d614522 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -533,8 +533,9 @@ stdin_event_handler (int error, gdb_client_data client_= data) void ui::register_file_handler () { - add_file_handler (input_fd, stdin_event_handler, this, - string_printf ("ui-%d", num), true); + if (input_fd !=3D -1) + add_file_handler (input_fd, stdin_event_handler, this, + string_printf ("ui-%d", num), true); } =20 /* See top.h. */ @@ -542,7 +543,8 @@ ui::register_file_handler () void ui::unregister_file_handler () { - delete_file_handler (input_fd); + if (input_fd !=3D -1) + delete_file_handler (input_fd); } =20 /* Re-enable stdin after the end of an execution command in diff --git a/gdb/top.h b/gdb/top.h index 5c1db84b2ce..9ea07262c39 100644 --- a/gdb/top.h +++ b/gdb/top.h @@ -118,7 +118,8 @@ struct ui FILE *errstream; =20 /* The file descriptor for the input stream, so that we can register - it with the event loop. */ + it with the event loop. This can be set to -1 to prevent this + registration. */ int input_fd; =20 /* Whether ISATTY returns true on input_fd. Cached here because