[PATCH v4 26/44] gdb: partially fix C-c not working

Markus Metzger <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
When resuming an inferior without threads, e.g. an Intel GPU device
inferior, and then interrupting with C-c, the stop request is not
delivered.  This appears as a hang.

Pedro Alves has a patch series to actually fix this issue.  This is a
partial workaround to address one instance of this that I encountered.
---
 gdb/target.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/gdb/target.c b/gdb/target.c
index 5d937f3ae85..a41735ef888 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -3830,6 +3830,18 @@ target_pass_ctrlc (void)
 	    }
 	}
     }
+
+  /* Inferior may not (currently) have threads.  If we didn't find a
+     target with running threads, pass it to the current inferior's
+     target.  */
+  inferior *inf = current_inferior ();
+  if (inf != nullptr)
+    {
+      inf->top_target ()->pass_ctrlc ();
+      return;
+    }
+
+  warning (_("Dropping interrupt request."));
 }
 
 /* See target.h.  */
-- 
2.43.0

________________________________________
Intel Deutschland GmbH 

Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany 

Tel: +49 (89) 99143-0 

www.intel.de 

Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman

Chairperson of the Supervisory Board: Sonja Pierer

Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.