Blame SOURCES/gdb-rhbz2024875-pr27026.patch

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