summaryrefslogtreecommitdiff
path: root/gdb/gnu-nat.c
diff options
context:
space:
mode:
authorPedro Alves <pedro@codesourcery.com>2008-09-22 15:21:30 +0000
committerPedro Alves <pedro@codesourcery.com>2008-09-22 15:21:30 +0000
commit7f42e323cda2dfc745e8d8c20083c0cc41d59226 (patch)
tree5b0c00e5ed5254ae1ee04cd7433cd39a1bd0b8fb /gdb/gnu-nat.c
parent568e9e39904b5b1efd61d5252a8a2ead8aa15f35 (diff)
downloadgdb-7f42e323cda2dfc745e8d8c20083c0cc41d59226.tar.gz
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.
Diffstat (limited to 'gdb/gnu-nat.c')
-rw-r--r--gdb/gnu-nat.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 3753523f968..f214abbedc8 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2093,7 +2093,6 @@ gnu_create_inferior (char *exec_file, char *allargs, char **env,
inf_attach (inf, pid);
- attach_flag = 0;
push_target (&gnu_ops);
inf->pending_execs = 2;
@@ -2145,6 +2144,7 @@ gnu_attach (char *args, int from_tty)
int pid;
char *exec_file;
struct inf *inf = cur_inf ();
+ struct inferior *inferior;
if (!args)
error_no_arg (_("process-id to attach"));
@@ -2173,14 +2173,13 @@ gnu_attach (char *args, int from_tty)
push_target (&gnu_ops);
- add_inferior (pid);
+ inferior = add_inferior (pid);
+ inferior->attach_flag = 1;
inf_update_procs (inf);
inferior_ptid = ptid_build (pid, 0, inf_pick_first_thread ());
- attach_flag = 1;
-
/* We have to initialize the terminal settings now, since the code
below might try to restore them. */
target_terminal_init ();