diff options
author | Stephane Carrez <stcarrez@nerim.fr> | 2002-08-26 19:18:33 +0000 |
---|---|---|
committer | Stephane Carrez <stcarrez@nerim.fr> | 2002-08-26 19:18:33 +0000 |
commit | a790ad353e281fa104029acfa34c9cf866ad4873 (patch) | |
tree | 07294fdc78f68cd55fe049090342ca4304b99388 /gdb | |
parent | 3d7f4f4914a2798426e66bcdb7e00094fdd48242 (diff) | |
download | gdb-a790ad353e281fa104029acfa34c9cf866ad4873.zip gdb-a790ad353e281fa104029acfa34c9cf866ad4873.tar.gz gdb-a790ad353e281fa104029acfa34c9cf866ad4873.tar.bz2 |
Fix PR gdb/393:
* inflow.c (terminal_save_ours): New function to save terminal
settings.
* inferior.h (terminal_save_ours): Declare.
* target.c (debug_to_terminal_save_ours): New function.
(cleanup_target): Defaults to_terminal_save_ours.
(update_current_target): Inherit to_terminal_save_ours.
(setup_target_debug): Set to_terminal_save_ours.
* target.h (target_terminal_save_ours): New to save terminal settings.
(target_ops): New member to_terminal_save_ours.
* gnu-nat.c (init_gnu_ops): Set to_terminal_save_ours.
* hpux-thread.c (init_hpux_thread_ops): Likewise.
* inftarg.c (init_child_ops): Likewise.
* m3-nat.c (init_m3_ops): Likewise.
* procfs.c (init_procfs_ops): Likewise.
* wince.c (init_child_ops): Likewise.
* win32-nat.c (init_child_ops): Likewise.
* sol-thread.c (init_sol_thread_ops): Likewise.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 21 | ||||
-rw-r--r-- | gdb/gnu-nat.c | 1 | ||||
-rw-r--r-- | gdb/hpux-thread.c | 1 | ||||
-rw-r--r-- | gdb/inferior.h | 2 | ||||
-rw-r--r-- | gdb/inflow.c | 17 | ||||
-rw-r--r-- | gdb/inftarg.c | 1 | ||||
-rw-r--r-- | gdb/m3-nat.c | 1 | ||||
-rw-r--r-- | gdb/procfs.c | 1 | ||||
-rw-r--r-- | gdb/sol-thread.c | 1 | ||||
-rw-r--r-- | gdb/target.c | 15 | ||||
-rw-r--r-- | gdb/target.h | 9 | ||||
-rw-r--r-- | gdb/win32-nat.c | 1 | ||||
-rw-r--r-- | gdb/wince.c | 1 | ||||
-rw-r--r-- | gdb/windows-nat.c | 1 |
14 files changed, 73 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 59b2abd..550b6bb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,24 @@ +2002-08-26 Stephane Carrez <stcarrez@nerim.fr> + + Fix PR gdb/393: + * inflow.c (terminal_save_ours): New function to save terminal + settings. + * inferior.h (terminal_save_ours): Declare. + * target.c (debug_to_terminal_save_ours): New function. + (cleanup_target): Defaults to_terminal_save_ours. + (update_current_target): Inherit to_terminal_save_ours. + (setup_target_debug): Set to_terminal_save_ours. + * target.h (target_terminal_save_ours): New to save terminal settings. + (target_ops): New member to_terminal_save_ours. + * gnu-nat.c (init_gnu_ops): Set to_terminal_save_ours. + * hpux-thread.c (init_hpux_thread_ops): Likewise. + * inftarg.c (init_child_ops): Likewise. + * m3-nat.c (init_m3_ops): Likewise. + * procfs.c (init_procfs_ops): Likewise. + * wince.c (init_child_ops): Likewise. + * win32-nat.c (init_child_ops): Likewise. + * sol-thread.c (init_sol_thread_ops): Likewise. + 2002-08-26 Mark Kettenis <kettenis@gnu.org> * i386-tdep.c (i386_store_return_value): Undeprecate. Convert to diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index a4b8020..59aad5d 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -2612,6 +2612,7 @@ init_gnu_ops (void) gnu_ops.to_terminal_init = gnu_terminal_init_inferior; gnu_ops.to_terminal_inferior = terminal_inferior; gnu_ops.to_terminal_ours_for_output = terminal_ours_for_output; + gnu_ops.to_terminal_save_ours = terminal_save_ours; gnu_ops.to_terminal_ours = terminal_ours; gnu_ops.to_terminal_info = child_terminal_info; gnu_ops.to_kill = gnu_kill_inferior; /* to_kill */ diff --git a/gdb/hpux-thread.c b/gdb/hpux-thread.c index eec18ff..981bb9d 100644 --- a/gdb/hpux-thread.c +++ b/gdb/hpux-thread.c @@ -554,6 +554,7 @@ init_hpux_thread_ops (void) hpux_thread_ops.to_terminal_init = terminal_init_inferior; hpux_thread_ops.to_terminal_inferior = terminal_inferior; hpux_thread_ops.to_terminal_ours_for_output = terminal_ours_for_output; + hpux_thread_ops.to_terminal_save_ours = terminal_save_ours; hpux_thread_ops.to_terminal_ours = terminal_ours; hpux_thread_ops.to_terminal_info = child_terminal_info; hpux_thread_ops.to_kill = hpux_thread_kill_inferior; diff --git a/gdb/inferior.h b/gdb/inferior.h index e875e9c..8035ccd 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -152,6 +152,8 @@ extern void kill_inferior (void); extern void generic_mourn_inferior (void); +extern void terminal_save_ours (void); + extern void terminal_ours (void); extern int run_stack_dummy (CORE_ADDR , struct regcache *); diff --git a/gdb/inflow.c b/gdb/inflow.c index 526acdf..b37fc54 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -200,6 +200,23 @@ terminal_init_inferior_with_pgrp (int pgrp) } } +/* Save the terminal settings again. This is necessary for the TUI + when it switches to TUI or non-TUI mode; curses changes the terminal + and gdb must be able to restore it correctly. */ + +void +terminal_save_ours () +{ + 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). */ + if (our_ttystate) + xfree (our_ttystate); + our_ttystate = serial_get_tty_state (stdin_serial); + } +} + void terminal_init_inferior (void) { diff --git a/gdb/inftarg.c b/gdb/inftarg.c index 9035310..e496811 100644 --- a/gdb/inftarg.c +++ b/gdb/inftarg.c @@ -774,6 +774,7 @@ init_child_ops (void) child_ops.to_terminal_init = terminal_init_inferior; child_ops.to_terminal_inferior = terminal_inferior; child_ops.to_terminal_ours_for_output = terminal_ours_for_output; + child_ops.to_terminal_save_ours = terminal_save_ours; child_ops.to_terminal_ours = terminal_ours; child_ops.to_terminal_info = child_terminal_info; child_ops.to_kill = kill_inferior; diff --git a/gdb/m3-nat.c b/gdb/m3-nat.c index c29101b..28e62a8 100644 --- a/gdb/m3-nat.c +++ b/gdb/m3-nat.c @@ -4474,6 +4474,7 @@ init_m3_ops (void) m3_ops.to_terminal_init = terminal_init_inferior; m3_ops.to_terminal_inferior = terminal_inferior; m3_ops.to_terminal_ours_for_output = terminal_ours_for_output; + m3_ops.to_terminal_save_ours = terminal_save_ours; m3_ops.to_terminal_ours = terminal_ours; m3_ops.to_terminal_info = child_terminal_info; m3_ops.to_kill = m3_kill_inferior; diff --git a/gdb/procfs.c b/gdb/procfs.c index 79f5575..ff8a7d3 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -170,6 +170,7 @@ init_procfs_ops (void) procfs_ops.to_terminal_inferior = terminal_inferior; procfs_ops.to_terminal_ours_for_output = terminal_ours_for_output; procfs_ops.to_terminal_ours = terminal_ours; + procfs_ops.to_terminal_save_ours = terminal_save_ours; procfs_ops.to_terminal_info = child_terminal_info; procfs_ops.to_find_new_threads = procfs_find_new_threads; diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 50caed3..35cb578 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -1556,6 +1556,7 @@ init_sol_thread_ops (void) sol_thread_ops.to_terminal_inferior = terminal_inferior; sol_thread_ops.to_terminal_ours_for_output = terminal_ours_for_output; sol_thread_ops.to_terminal_ours = terminal_ours; + sol_thread_ops.to_terminal_save_ours = terminal_save_ours; sol_thread_ops.to_terminal_info = child_terminal_info; sol_thread_ops.to_kill = sol_thread_kill_inferior; sol_thread_ops.to_load = 0; diff --git a/gdb/target.c b/gdb/target.c index ec1979b..75d022f 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -138,6 +138,8 @@ static void debug_to_terminal_inferior (void); static void debug_to_terminal_ours_for_output (void); +static void debug_to_terminal_save_ours (void); + static void debug_to_terminal_ours (void); static void debug_to_terminal_info (char *, int); @@ -445,6 +447,9 @@ cleanup_target (struct target_ops *t) de_fault (to_terminal_ours, (void (*) (void)) target_ignore); + de_fault (to_terminal_save_ours, + (void (*) (void)) + target_ignore); de_fault (to_terminal_info, default_terminal_info); de_fault (to_kill, @@ -608,6 +613,7 @@ update_current_target (void) INHERIT (to_terminal_inferior, t); INHERIT (to_terminal_ours_for_output, t); INHERIT (to_terminal_ours, t); + INHERIT (to_terminal_save_ours, t); INHERIT (to_terminal_info, t); INHERIT (to_kill, t); INHERIT (to_load, t); @@ -1980,6 +1986,14 @@ debug_to_terminal_ours (void) } static void +debug_to_terminal_save_ours (void) +{ + debug_target.to_terminal_save_ours (); + + fprintf_unfiltered (gdb_stdlog, "target_terminal_save_ours ()\n"); +} + +static void debug_to_terminal_info (char *arg, int from_tty) { debug_target.to_terminal_info (arg, from_tty); @@ -2405,6 +2419,7 @@ setup_target_debug (void) current_target.to_terminal_inferior = debug_to_terminal_inferior; current_target.to_terminal_ours_for_output = debug_to_terminal_ours_for_output; current_target.to_terminal_ours = debug_to_terminal_ours; + current_target.to_terminal_save_ours = debug_to_terminal_save_ours; current_target.to_terminal_info = debug_to_terminal_info; current_target.to_kill = debug_to_kill; current_target.to_load = debug_to_load; diff --git a/gdb/target.h b/gdb/target.h index c165801..18b95b0 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -264,6 +264,7 @@ struct target_ops void (*to_terminal_inferior) (void); void (*to_terminal_ours_for_output) (void); void (*to_terminal_ours) (void); + void (*to_terminal_save_ours) (void); void (*to_terminal_info) (char *, int); void (*to_kill) (void); void (*to_load) (char *, int); @@ -626,6 +627,14 @@ extern void print_section_info (struct target_ops *, bfd *); #define target_terminal_ours() \ (*current_target.to_terminal_ours) () +/* Save our terminal settings. + This is called from TUI after entering or leaving the curses + mode. Since curses modifies our terminal this call is here + to take this change into account. */ + +#define target_terminal_save_ours() \ + (*current_target.to_terminal_save_ours) () + /* Print useful information about our terminal status, if such a thing exists. */ diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c index e0377c5..781a841 100644 --- a/gdb/win32-nat.c +++ b/gdb/win32-nat.c @@ -1791,6 +1791,7 @@ init_child_ops (void) child_ops.to_terminal_inferior = terminal_inferior; child_ops.to_terminal_ours_for_output = terminal_ours_for_output; child_ops.to_terminal_ours = terminal_ours; + child_ops.to_terminal_save_ours = terminal_save_ours; child_ops.to_terminal_info = child_terminal_info; child_ops.to_kill = child_kill_inferior; child_ops.to_load = 0; diff --git a/gdb/wince.c b/gdb/wince.c index a640bea..92c1158 100644 --- a/gdb/wince.c +++ b/gdb/wince.c @@ -1910,6 +1910,7 @@ init_child_ops (void) child_ops.to_terminal_inferior = terminal_inferior; child_ops.to_terminal_ours_for_output = terminal_ours_for_output; child_ops.to_terminal_ours = terminal_ours; + child_ops.to_terminal_save_ours = terminal_save_ours; child_ops.to_terminal_info = child_terminal_info; child_ops.to_kill = child_kill_inferior; child_ops.to_load = child_load; diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index e0377c5..781a841 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -1791,6 +1791,7 @@ init_child_ops (void) child_ops.to_terminal_inferior = terminal_inferior; child_ops.to_terminal_ours_for_output = terminal_ours_for_output; child_ops.to_terminal_ours = terminal_ours; + child_ops.to_terminal_save_ours = terminal_save_ours; child_ops.to_terminal_info = child_terminal_info; child_ops.to_kill = child_kill_inferior; child_ops.to_load = 0; |