diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7a90ea5f8c..ac5b318309 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2017-11-06 Pedro Alves + + * gnu-nat.c (gnu_terminal_init): Delete. + (gnu_target): Don't install gnu_terminal_init. + * inflow.c (child_terminal_init_with_pgrp): Delete, merged with ... + (child_terminal_init): ... this function. + 2017-11-06 Pedro Alves * common/common.m4 (GDB_AC_COMMON): No longer check termio.h nor diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index 7cb6e4a0dd..2ae20318f9 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -2279,12 +2279,6 @@ gnu_detach (struct target_ops *ops, const char *args, int from_tty) inf_child_maybe_unpush_target (ops); } -static void -gnu_terminal_init (struct target_ops *self) -{ - gdb_assert (gnu_current_inf); - child_terminal_init_with_pgrp (gnu_current_inf->pid); -} static void gnu_stop (struct target_ops *self, ptid_t ptid) @@ -2693,7 +2687,6 @@ gnu_target (void) t->to_wait = gnu_wait; t->to_xfer_partial = gnu_xfer_partial; t->to_find_memory_regions = gnu_find_memory_regions; - t->to_terminal_init = gnu_terminal_init; t->to_kill = gnu_kill_inferior; t->to_create_inferior = gnu_create_inferior; t->to_mourn_inferior = gnu_mourn_inferior; diff --git a/gdb/inflow.c b/gdb/inflow.c index d46d6938e2..2fba0fa2a7 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -165,7 +165,7 @@ gdb_has_a_terminal (void) before we actually run the inferior. */ void -child_terminal_init_with_pgrp (int pgrp) +child_terminal_init (struct target_ops *self) { struct inferior *inf = current_inferior (); struct terminal_info *tinfo = get_inflow_inferior_data (inf); @@ -173,8 +173,10 @@ child_terminal_init_with_pgrp (int pgrp) #ifdef HAVE_TERMIOS_H /* Store the process group even without a terminal as it is used not only to reset the tty foreground process group, but also to - interrupt the inferior. */ - tinfo->process_group = pgrp; + interrupt the inferior. A child we spawn should be a process + group leader (PGID==PID) at this point, though that may not be + true if we're attaching to an existing process. */ + tinfo->process_group = inf->pid; #endif if (gdb_has_a_terminal ()) @@ -204,20 +206,6 @@ gdb_save_tty_state (void) } } -void -child_terminal_init (struct target_ops *self) -{ -#ifdef HAVE_TERMIOS_H - /* This is for Lynx, and should be cleaned up by having Lynx be a - separate debugging target with a version of target_terminal::init - which passes in the process group to a generic routine which does - all the work (and the non-threaded child_terminal_init can just - pass in inferior_ptid to the same routine). */ - /* We assume INFERIOR_PID is also the child's process group. */ - child_terminal_init_with_pgrp (ptid_get_pid (inferior_ptid)); -#endif /* HAVE_TERMIOS_H */ -} - /* Put the inferior's terminal settings into effect. This is preparation for starting or resuming the inferior.