Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Aaron Merey via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Cc: Tom de Vries <vries@gcc.gnu.org>
Subject: [PATCH] [PR gdb/27026] CTRL-C is ignored when debug info is downloaded
Date: Tue, 23 Nov 2021 20:43:14 -0500	[thread overview]
Message-ID: <20211124014314.217675-1-amerey@redhat.com> (raw)

During debuginfod downloads, ctrl-c should result in the download
being cancelled and skipped.  However in some cases, ctrl-c fails to
get delivered to gdb during downloading.  This can result in downloads
being unskippable.

Fix this by ensuring that target_terminal::ours is in effect for the
duration of each download.

Co-authored-by: Tom de Vries <vries@gcc.gnu.org>
https://sourceware.org/bugzilla/show_bug.cgi?id=27026#c3
---
 gdb/debuginfod-support.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
index 2e1837da949..1f160e29714 100644
--- a/gdb/debuginfod-support.c
+++ b/gdb/debuginfod-support.c
@@ -23,6 +23,7 @@
 #include "gdbsupport/gdb_optional.h"
 #include "cli/cli-cmds.h"
 #include "cli/cli-style.h"
+#include "target.h"
 
 /* Set/show debuginfod commands.  */
 static cmd_list_element *set_debuginfod_prefix_list;
@@ -204,6 +205,13 @@ debuginfod_source_query (const unsigned char *build_id,
   user_data data ("source file", srcpath);
 
   debuginfod_set_user_data (c, &data);
+  gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
+  if (target_supports_terminal_ours ())
+    {
+      term_state.emplace ();
+      target_terminal::ours ();
+    }
+
   scoped_fd fd (debuginfod_find_source (c,
 					build_id,
 					build_id_len,
@@ -242,6 +250,13 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
   user_data data ("separate debug info for", filename);
 
   debuginfod_set_user_data (c, &data);
+  gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
+  if (target_supports_terminal_ours ())
+    {
+      term_state.emplace ();
+      target_terminal::ours ();
+    }
+
   scoped_fd fd (debuginfod_find_debuginfo (c, build_id, build_id_len,
 					   &dname));
   debuginfod_set_user_data (c, nullptr);
-- 
2.33.1


             reply	other threads:[~2021-11-24  1:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24  1:43 Aaron Merey via Gdb-patches [this message]
2021-11-24  7:34 ` Tom de Vries via Gdb-patches
2021-11-24 20:55   ` Aaron Merey via Gdb-patches
2021-11-29 19:23 ` Kevin Buettner via Gdb-patches
2021-11-29 20:07   ` Aaron Merey via Gdb-patches
2021-12-01 16:27 ` Tom Tromey
2021-12-14 22:32   ` Aaron Merey via Gdb-patches

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=20211124014314.217675-1-amerey@redhat.com \
    --to=gdb-patches@sourceware.org \
    --cc=amerey@redhat.com \
    --cc=vries@gcc.gnu.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