This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug breakpoints/23368] gdb goes to into background when hitting exec catchpoint with follow-exec-mode new


https://sourceware.org/bugzilla/show_bug.cgi?id=23368

--- Comment #3 from Simon Marchi <simon.marchi at ericsson dot com> ---
Here's what I think is happening:

When the exec happen, follow_exec calls exit_inferior_silent to clean up the
first inferior (the execution will continue as inferior 2).  The inferior_exit
observer calls inflow_inferior_exit.  This observer sets the inferior's
terminal_state to is_ours:

  inf->terminal_state = target_terminal_state::is_ours;

At this point, inferior1's terminal_state is is_ours, while the "reality",
tracked by gdb_tty_state, is is_inferior.

Later, when we call target_terminal::ours to make sure we own the terminal, we
don't actually go to the target backend to change it, because the core thinks
that inferior doesn't own the terminal (inf->terminal_state in
target_terminal_is_ours_kind).  When something in readline tries to mess with
the terminal settings, it generates a SIGTTOU.

This patch makes it work for me, but I don't know if it's right.  It calls
target_terminal::ours() instead of just overwriting the terminal state value in
the inferior.


>From e9e867e11861e632b1517d06af9263f4499d4ba9 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@ericsson.com>
Date: Mon, 23 Jul 2018 15:55:34 -0400
Subject: [PATCH] patch

---
 gdb/inflow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/inflow.c b/gdb/inflow.c
index caff646..fb2e490 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -666,7 +666,7 @@ inflow_inferior_exit (struct inferior *inf)
 {
   struct terminal_info *info;

-  inf->terminal_state = target_terminal_state::is_ours;
+  target_terminal::ours ();

   info = (struct terminal_info *) inferior_data (inf, inflow_inferior_data);
   if (info != NULL)
-- 
2.7.4

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]