Blame SOURCES/gdb-rhbz2024875-pr27026.patch

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