Blame SOURCES/gdb-rhbz2024875-pr27026.patch

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