From e3594fd196c8d629129af9cdc9d00ba08b62a928 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 17 Dec 2013 21:30:49 -0700 Subject: [PATCH] Add target_ops argument to to_terminal_ours 2014-02-19 Tom Tromey * target.h (struct target_ops) : Add argument. (target_terminal_ours): Add argument. * target.c (debug_to_terminal_ours): Add argument. (update_current_target): Update. * remote.c (remote_terminal_ours): Add 'self' argument. (remote_close): Update. * linux-nat.c (linux_nat_terminal_ours): Add 'self' argument. * inflow.c (terminal_ours): Add 'self' argument. * inferior.h (terminal_ours): Add 'self' argument. * go32-nat.c (go32_terminal_ours): Add 'self' argument. --- gdb/ChangeLog | 13 +++++++++++++ gdb/go32-nat.c | 2 +- gdb/inferior.h | 2 +- gdb/inflow.c | 2 +- gdb/linux-nat.c | 6 +++--- gdb/remote.c | 6 +++--- gdb/target.c | 8 ++++---- gdb/target.h | 4 ++-- 8 files changed, 28 insertions(+), 15 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 175f9f43ab7..f7a5d307b5d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +2014-02-19 Tom Tromey + + * target.h (struct target_ops) : Add argument. + (target_terminal_ours): Add argument. + * target.c (debug_to_terminal_ours): Add argument. + (update_current_target): Update. + * remote.c (remote_terminal_ours): Add 'self' argument. + (remote_close): Update. + * linux-nat.c (linux_nat_terminal_ours): Add 'self' argument. + * inflow.c (terminal_ours): Add 'self' argument. + * inferior.h (terminal_ours): Add 'self' argument. + * go32-nat.c (go32_terminal_ours): Add 'self' argument. + 2014-02-19 Pedro Alves Tom Tromey diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index 8f911e2e613..4e0b474797d 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -903,7 +903,7 @@ go32_terminal_inferior (struct target_ops *self) } static void -go32_terminal_ours (void) +go32_terminal_ours (struct target_ops *self) { /* Switch to cooked mode on the gdb terminal and save the inferior terminal mode to be restored when it is resumed. */ diff --git a/gdb/inferior.h b/gdb/inferior.h index f2984032970..c577fb4b86d 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -127,7 +127,7 @@ extern void generic_mourn_inferior (void); extern void terminal_save_ours (void); -extern void terminal_ours (void); +extern void terminal_ours (struct target_ops *self); extern CORE_ADDR unsigned_pointer_to_address (struct gdbarch *gdbarch, struct type *type, diff --git a/gdb/inflow.c b/gdb/inflow.c index 8d9a7f38b9f..087cc604022 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -363,7 +363,7 @@ terminal_ours_for_output (struct target_ops *self) so they can be restored properly later. */ void -terminal_ours (void) +terminal_ours (struct target_ops *self) { terminal_ours_1 (0); } diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index cd2798ae776..24cb1b918d7 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -4606,19 +4606,19 @@ linux_nat_terminal_inferior (struct target_ops *self) /* target_terminal_ours implementation. */ static void -linux_nat_terminal_ours (void) +linux_nat_terminal_ours (struct target_ops *self) { if (!target_is_async_p ()) { /* Async mode is disabled. */ - terminal_ours (); + terminal_ours (self); return; } /* GDB should never give the terminal to the inferior if the inferior is running in the background (run&, continue&, etc.), but claiming it sure should. */ - terminal_ours (); + terminal_ours (self); if (async_terminal_is_ours) return; diff --git a/gdb/remote.c b/gdb/remote.c index 456cd09e67a..f6163a9dcb7 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -220,7 +220,7 @@ static int peek_stop_reply (ptid_t ptid); static void remote_async_inferior_event_handler (gdb_client_data); -static void remote_terminal_ours (void); +static void remote_terminal_ours (struct target_ops *self); static int remote_read_description_p (struct target_ops *target); @@ -3000,7 +3000,7 @@ remote_close (struct target_ops *self) /* Make sure we leave stdin registered in the event loop, and we don't leave the async SIGINT signal handler installed. */ - remote_terminal_ours (); + remote_terminal_ours (self); serial_close (rs->remote_desc); rs->remote_desc = NULL; @@ -5148,7 +5148,7 @@ remote_terminal_inferior (struct target_ops *self) } static void -remote_terminal_ours (void) +remote_terminal_ours (struct target_ops *self) { if (!target_async_permitted) /* Nothing to do. */ diff --git a/gdb/target.c b/gdb/target.c index 1f56a0a4918..ddb7c635028 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -140,7 +140,7 @@ static void debug_to_terminal_ours_for_output (struct target_ops *self); static void debug_to_terminal_save_ours (void); -static void debug_to_terminal_ours (void); +static void debug_to_terminal_ours (struct target_ops *self); static void debug_to_load (char *, int); @@ -778,7 +778,7 @@ update_current_target (void) (void (*) (struct target_ops *)) target_ignore); de_fault (to_terminal_ours, - (void (*) (void)) + (void (*) (struct target_ops *)) target_ignore); de_fault (to_terminal_save_ours, (void (*) (void)) @@ -4823,9 +4823,9 @@ debug_to_terminal_ours_for_output (struct target_ops *self) } static void -debug_to_terminal_ours (void) +debug_to_terminal_ours (struct target_ops *self) { - debug_target.to_terminal_ours (); + debug_target.to_terminal_ours (&debug_target); fprintf_unfiltered (gdb_stdlog, "target_terminal_ours ()\n"); } diff --git a/gdb/target.h b/gdb/target.h index ffe49190e44..e835029d0f7 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -490,7 +490,7 @@ struct target_ops void (*to_terminal_init) (struct target_ops *); void (*to_terminal_inferior) (struct target_ops *); void (*to_terminal_ours_for_output) (struct target_ops *); - void (*to_terminal_ours) (void); + void (*to_terminal_ours) (struct target_ops *); void (*to_terminal_save_ours) (void); void (*to_terminal_info) (const char *, int); void (*to_kill) (struct target_ops *); @@ -1245,7 +1245,7 @@ extern void target_terminal_inferior (void); so they can be restored properly later. */ #define target_terminal_ours() \ - (*current_target.to_terminal_ours) () + (*current_target.to_terminal_ours) (¤t_target) /* Save our terminal settings. This is called from TUI after entering or leaving the curses -- 2.30.2