Blame SOURCES/gdb-rhbz2024875-pr27026.patch

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