aboutsummaryrefslogtreecommitdiff
path: root/gdb/inflow.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2011-03-04 19:23:42 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2011-03-04 19:23:42 +0000
commit1e182ce8c375de8f86fe00198b07d0331e4c4e0d (patch)
tree0e7ec4987f47fe39ec610faff8caef45208eec64 /gdb/inflow.c
parent2abae99411dbbced25ad99232ab329ad59578294 (diff)
downloadgdb-1e182ce8c375de8f86fe00198b07d0331e4c4e0d.zip
gdb-1e182ce8c375de8f86fe00198b07d0331e4c4e0d.tar.gz
gdb-1e182ce8c375de8f86fe00198b07d0331e4c4e0d.tar.bz2
* 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.
Diffstat (limited to 'gdb/inflow.c')
-rw-r--r--gdb/inflow.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/gdb/inflow.c b/gdb/inflow.c
index 9975904..7876347 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -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