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.
This commit is contained in:
parent
d6b48e9c8b
commit
181e7f9393
15 changed files with 133 additions and 75 deletions
15
gdb/procfs.c
15
gdb/procfs.c
|
@ -3663,6 +3663,7 @@ static ptid_t
|
|||
do_attach (ptid_t ptid)
|
||||
{
|
||||
procinfo *pi;
|
||||
struct inferior *inf;
|
||||
int fail;
|
||||
int lwpid;
|
||||
|
||||
|
@ -3712,9 +3713,9 @@ do_attach (ptid_t ptid)
|
|||
if ((fail = procfs_debug_inferior (pi)) != 0)
|
||||
dead_procinfo (pi, "do_attach: failed in procfs_debug_inferior", NOKILL);
|
||||
|
||||
add_inferior (pi->pid);
|
||||
inf = add_inferior (pi->pid);
|
||||
/* Let GDB know that the inferior was attached. */
|
||||
attach_flag = 1;
|
||||
inf->attach_flag = 1;
|
||||
|
||||
/* Create a procinfo for the current lwp. */
|
||||
lwpid = proc_get_current_thread (pi);
|
||||
|
@ -3768,7 +3769,6 @@ do_detach (int signo)
|
|||
proc_warn (pi, "do_detach, set_rlc", __LINE__);
|
||||
}
|
||||
|
||||
attach_flag = 0;
|
||||
destroy_procinfo (pi);
|
||||
}
|
||||
|
||||
|
@ -4074,6 +4074,8 @@ wait_again:
|
|||
}
|
||||
else if (syscall_is_exit (pi, what))
|
||||
{
|
||||
struct inferior *inf;
|
||||
|
||||
/* Handle SYS_exit call only */
|
||||
/* Stopped at entry to SYS_exit.
|
||||
Make it runnable, resume it, then use
|
||||
|
@ -4087,7 +4089,9 @@ wait_again:
|
|||
TARGET_WAITKIND_SPURIOUS. */
|
||||
if (!proc_run_process (pi, 0, 0))
|
||||
proc_error (pi, "target_wait, run_process", __LINE__);
|
||||
if (attach_flag)
|
||||
|
||||
inf = find_inferior_pid (pi->pid);
|
||||
if (inf->attach_flag)
|
||||
{
|
||||
/* Don't call wait: simulate waiting for exit,
|
||||
return a "success" exit code. Bogus: what if
|
||||
|
@ -4686,8 +4690,9 @@ procfs_notice_signals (ptid_t ptid)
|
|||
static void
|
||||
procfs_files_info (struct target_ops *ignore)
|
||||
{
|
||||
struct inferior *inf = current_inferior ();
|
||||
printf_filtered (_("\tUsing the running image of %s %s via /proc.\n"),
|
||||
attach_flag? "attached": "child",
|
||||
inf->attach_flag? "attached": "child",
|
||||
target_pid_to_str (inferior_ptid));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue