summaryrefslogtreecommitdiff
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
commit567449a00c676854c62ce5a729ba1437238c8357 (patch)
treebd6cd53674bc9a2bf32964242fc150483e1ab6fe /gdb/inflow.c
parentf033fcb9b2e57511919fc0987fb3b7dd2662610e (diff)
downloadgdb-567449a00c676854c62ce5a729ba1437238c8357.tar.gz
* 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 99759049746..7876347daab 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