Blame SOURCES/gdb-rhbz2024875-pr27026.patch

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