Blame SOURCES/gdb-rhbz2024875-pr27026.patch

79b363
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
79b363
From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= <ahajkova@redhat.com>
79b363
Date: Tue, 11 Jan 2022 13:22:44 +0100
79b363
Subject: gdb-rhbz2024875-pr27026.patch
79b363
79b363
;;Backport upstream commit from Aaron Merey
79b363
;;b9db26b4c44 [PR gdb/27026] CTRL-C is ignored when debug info is downloaded
79b363
79b363
[PR gdb/27026] CTRL-C is ignored when debug info is downloaded
79b363
79b363
During debuginfod downloads, ctrl-c should result in the download
79b363
being cancelled and skipped.  However in some cases, ctrl-c fails to
79b363
get delivered to gdb during downloading.  This can result in downloads
79b363
being unskippable.
79b363
79b363
Fix this by ensuring that target_terminal::ours is in effect for the
79b363
duration of each download.
79b363
79b363
Co-authored-by: Tom de Vries <tdevries@suse.de>
79b363
https://sourceware.org/bugzilla/show_bug.cgi?id=27026#c3
79b363
79b363
diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
79b363
--- a/gdb/debuginfod-support.c
79b363
+++ b/gdb/debuginfod-support.c
79b363
@@ -23,6 +23,7 @@
79b363
 #include "gdbsupport/gdb_optional.h"
79b363
 #include "cli/cli-cmds.h"
79b363
 #include "cli/cli-style.h"
79b363
+#include "target.h"
79b363
 
79b363
 /* Set/show debuginfod commands.  */
79b363
 static cmd_list_element *set_debuginfod_prefix_list;
79b363
@@ -208,6 +209,13 @@ debuginfod_source_query (const unsigned char *build_id,
79b363
   user_data data ("source file", srcpath);
79b363
 
79b363
   debuginfod_set_user_data (c, &data);
79b363
+  gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
79b363
+  if (target_supports_terminal_ours ())
79b363
+    {
79b363
+      term_state.emplace ();
79b363
+      target_terminal::ours ();
79b363
+    }
79b363
+
79b363
   scoped_fd fd (debuginfod_find_source (c,
79b363
 					build_id,
79b363
 					build_id_len,
79b363
@@ -246,6 +254,13 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
79b363
   user_data data ("separate debug info for", filename);
79b363
 
79b363
   debuginfod_set_user_data (c, &data);
79b363
+  gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
79b363
+  if (target_supports_terminal_ours ())
79b363
+    {
79b363
+      term_state.emplace ();
79b363
+      target_terminal::ours ();
79b363
+    }
79b363
+
79b363
   scoped_fd fd (debuginfod_find_debuginfo (c, build_id, build_id_len,
79b363
 					   &dname));
79b363
   debuginfod_set_user_data (c, nullptr);