* inflow.c (terminal_init_inferior_with_pgrp): Copy ttystate.

(terminal_save_ours): Remove misleading comment.
	(inflow_inferior_data_cleanup): Free ttystate.
	(inflow_inferior_exit): Likewise.
	(copy_terminal_info): Copy ttystate.

	* serial.c (serial_copy_tty_state): New function.
	* serial.h (serial_copy_tty_state): Add prototype.
	(struct serial_ops): Add copy_tty_state callback.
	* ser-base.c (ser_base_copy_tty_state): New function.
	* ser-base.h (ser_base_copy_tty_state): Add prototype.
	* ser-go32.c (dos_copy_tty_state): New function.
	(dos_ops): Install copy_tty_state callback.
	* ser-mingw.c (_initialize_ser_windows): Likewise.
	* ser-pipe.c (_initialize_ser_pipe): Likewise.
	* ser-unix.c (hardwire_copy_tty_state): New function.
	(_initialize_ser_hardwire): Install it.
This commit is contained in:
Ulrich Weigand
2011-03-04 19:23:42 +00:00
parent 2abae99411
commit 1e182ce8c3
11 changed files with 85 additions and 5 deletions

View File

@@ -224,10 +224,9 @@ terminal_init_inferior_with_pgrp (int pgrp)
struct inferior *inf = current_inferior ();
struct terminal_info *tinfo = get_inflow_inferior_data (inf);
/* We could just as well copy our_ttystate (if we felt like
adding a new function serial_copy_tty_state()). */
xfree (tinfo->ttystate);
tinfo->ttystate = serial_get_tty_state (stdin_serial);
tinfo->ttystate = serial_copy_tty_state (stdin_serial,
our_terminal_info.ttystate);
#ifdef PROCESS_GROUP_TYPE
tinfo->process_group = pgrp;
@@ -249,8 +248,6 @@ terminal_save_ours (void)
{
if (gdb_has_a_terminal ())
{
/* We could just as well copy our_ttystate (if we felt like adding
a new function serial_copy_tty_state). */
xfree (our_terminal_info.ttystate);
our_terminal_info.ttystate = serial_get_tty_state (stdin_serial);
}
@@ -495,6 +492,7 @@ inflow_inferior_data_cleanup (struct inferior *inf, void *arg)
if (info != NULL)
{
xfree (info->run_terminal);
xfree (info->ttystate);
xfree (info);
}
}
@@ -532,6 +530,7 @@ inflow_inferior_exit (struct inferior *inf)
if (info != NULL)
{
xfree (info->run_terminal);
xfree (info->ttystate);
xfree (info);
set_inferior_data (inf, inflow_inferior_data, NULL);
}
@@ -544,10 +543,19 @@ copy_terminal_info (struct inferior *to, struct inferior *from)
tinfo_to = get_inflow_inferior_data (to);
tinfo_from = get_inflow_inferior_data (from);
xfree (tinfo_to->run_terminal);
xfree (tinfo_to->ttystate);
*tinfo_to = *tinfo_from;
if (tinfo_from->run_terminal)
tinfo_to->run_terminal
= xstrdup (tinfo_from->run_terminal);
if (tinfo_from->ttystate)
tinfo_to->ttystate
= serial_copy_tty_state (stdin_serial, tinfo_from->ttystate);
}
void