From 181e7f9393edb01de72d25e208a6ef4f069fb36f Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 22 Sep 2008 15:21:30 +0000 Subject: Remove the attach_flag global, and make it per-inferior. * inferior.h (attach_flag): Delete. (inferior_process): Declare. * solib.c (update_solib_list): Adjust. * gnu-nat.c (gnu_create_inferior, gnu_attach): Adjust. * inf-ptrace.c (inf_ptrace_detach): Adjust. (inf_ptrace_files_info): Get it from the current inferior. * inf-ttrace.c (inf_ttrace_attach): Adjust. (inf_ttrace_files_info): Get it from the current inferior. * inflow.c (terminal_inferior, terminal_ours_1, set_sigint_trap) (clear_sigint_trap): Get it from the current process. * remote.c (extended_remote_attach_1) (extended_remote_create_inferior_1): Adjust. * top.c (quit_confirm, quit_target): Get it from the current inferior. * procfs.c (do_detach): Adjust. (procfs_wait): Get it from the event inferior. (procfs_files_info): Get it from the current inferior. * nto-procfs.c (procfs_files_info): Likewise. (procfs_attach): Adjust. Set the attach_flag here. (do_attach): Don't set it here. (procfs_detach): Don't clear it. (procfs_mourn_inferior): Don't clear it. * solib-osf.c (osf_solib_create_inferior_hook): Adjust. * target.c (attach_flag): Delete. (generic_mourn_inferior): Don't clear it. * win32-nat.c (get_win32_debug_event): Get it from the event process. (do_initial_win32_stuff): Add attaching argument. Set attach_flag in the inferior accordingly. (win32_attach): Don't set the attach_flag here. Pass 1 to do_intial_win32_stuff. (win32_files_info): Get it from the current inferior. (win32_create_inferior): Dont clear attach_flag here. Pass 0 to do_intial_win32_stuff. --- gdb/inflow.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'gdb/inflow.c') diff --git a/gdb/inflow.c b/gdb/inflow.c index 6a77531..2ba2a34 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -277,15 +277,16 @@ terminal_inferior (void) if (job_control) { + struct inferior *inf = current_inferior (); #ifdef HAVE_TERMIOS result = tcsetpgrp (0, inferior_process_group); - if (!attach_flag) + if (!inf->attach_flag) OOPSY ("tcsetpgrp"); #endif #ifdef HAVE_SGTTY result = ioctl (0, TIOCSPGRP, &inferior_process_group); - if (!attach_flag) + if (!inf->attach_flag) OOPSY ("TIOCSPGRP"); #endif } @@ -334,6 +335,8 @@ terminal_ours_1 (int output_only) if (!terminal_is_ours) { + struct inferior *inf = current_inferior (); + #ifdef SIGTTOU /* Ignore this signal since it will happen when we try to set the pgrp. */ @@ -353,7 +356,7 @@ terminal_ours_1 (int output_only) inferior_ttystate = serial_get_tty_state (stdin_serial); #ifdef PROCESS_GROUP_TYPE - if (!attach_flag) + if (!inf->attach_flag) /* If setpgrp failed in terminal_inferior, this would give us our process group instead of the inferior's. See terminal_inferior for details. */ @@ -626,7 +629,8 @@ static void (*osig) (); void set_sigint_trap (void) { - if (attach_flag || inferior_thisrun_terminal) + struct inferior *inf = current_inferior (); + if (inf->attach_flag || inferior_thisrun_terminal) { osig = (void (*)()) signal (SIGINT, pass_signal); } @@ -635,7 +639,8 @@ set_sigint_trap (void) void clear_sigint_trap (void) { - if (attach_flag || inferior_thisrun_terminal) + struct inferior *inf = current_inferior (); + if (inf->attach_flag || inferior_thisrun_terminal) { signal (SIGINT, osig); } -- cgit v1.1