public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/29032] [gdb][test-case failure, taskset] FAIL: gdb.base/eof-exit.exp: with non-dump terminal: close GDB with eof (timeout)
Date: Thu, 07 Apr 2022 10:32:31 +0000	[thread overview]
Message-ID: <bug-29032-4717-B8xTTkzIPs@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29032-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=29032

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
OK, let's try again:
...
diff --git a/gdb/event-top.c b/gdb/event-top.c
index b628f0397cb..8ff4846b405 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -43,6 +43,7 @@
 #include "async-event.h"
 #include "bt-utils.h"
 #include "pager.h"
+#include "termios.h"

 /* readline include files.  */
 #include "readline/readline.h"
@@ -1312,6 +1313,12 @@ gdb_setup_readline (int editing)
      one instance of readline.  */
   if (ISATTY (ui->instream) && editing && ui == main_ui)
     {
+      struct termios termios;
+      tcgetattr (fileno (ui->instream), &termios);
+      termios.c_lflag &= ~(ICANON);
+      tcsetattr (fileno (ui->instream), TCSANOW, &termios);
+      //fprintf (stderr, "Clearing ICANON on fileno %d\n", fileno
(ui->instream));
m                                                                               
+                                                                               
       /* Tell gdb that we will be using the readline library.  This
         could be overwritten by a command in .gdbinit like 'set
         editing on' or 'off'.  */
diff --git a/gdb/top.c b/gdb/top.c
index e776ac2d70e..f796d12a14e 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -57,6 +57,7 @@
 #include "gdbsupport/pathstuff.h"
 #include "cli/cli-style.h"
 #include "pager.h"
+#include "termios.h"

 /* readline include files.  */
 #include "readline/readline.h"
@@ -1774,6 +1775,15 @@ undo_terminal_modifications_before_exit (void)
 #endif
   gdb_disable_readline ();

+  if (ISATTY (current_ui->instream))
+    {
+      struct termios termios;
+      tcgetattr (fileno (current_ui->instream), &termios);
+      termios.c_lflag |= (ICANON);
+      tcsetattr (fileno (current_ui->instream), TCSANOW, &termios);
+      //fprintf (stderr, "Restoring ICANON on fileno %d\n", fileno
(current_ui->ins
tream));
+    }
+
   current_ui = saved_top_level;
 }

...

This at least passes:
- gdb.base/eof-exit.exp
- gdb.ada/mi_catch_assert.exp
- gdb.base/batch-preserve-term-settings.exp

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2022-04-07 10:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06 11:36 [Bug gdb/29032] New: " vries at gcc dot gnu.org
2022-04-06 11:36 ` [Bug gdb/29032] " vries at gcc dot gnu.org
2022-04-06 11:41 ` vries at gcc dot gnu.org
2022-04-07  8:02 ` vries at gcc dot gnu.org
2022-04-07  9:10 ` vries at gcc dot gnu.org
2022-04-07 10:00 ` vries at gcc dot gnu.org
2022-04-07 10:08 ` vries at gcc dot gnu.org
2022-04-07 10:32 ` vries at gcc dot gnu.org [this message]
2022-04-07 11:56 ` vries at gcc dot gnu.org
2022-04-07 12:44 ` aburgess at redhat dot com
2022-04-07 13:18 ` vries at gcc dot gnu.org
2022-04-07 14:44 ` vries at gcc dot gnu.org
2022-04-08 13:17 ` vries at gcc dot gnu.org
2022-04-08 15:37 ` vries at gcc dot gnu.org
2022-05-09 14:01 ` cvs-commit at gcc dot gnu.org
2022-05-25  8:20 ` [Bug gdb/29032] [gdb] ^D while not at prompt doesn't trigger quit vries at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29032-4717-B8xTTkzIPs@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).