aboutsummaryrefslogtreecommitdiff
path: root/gdb/inf-ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/inf-ptrace.c')
-rw-r--r--gdb/inf-ptrace.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index 797a70a..57af79a 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -212,6 +212,7 @@ inf_ptrace_attach (char *args, int from_tty)
char *exec_file;
pid_t pid;
char *dummy;
+ struct inferior *inf;
if (!args)
error_no_arg (_("process-id to attach"));
@@ -244,14 +245,14 @@ inf_ptrace_attach (char *args, int from_tty)
ptrace (PT_ATTACH, pid, (PTRACE_TYPE_ARG3)0, 0);
if (errno != 0)
perror_with_name (("ptrace"));
- attach_flag = 1;
#else
error (_("This system does not support attaching to a process"));
#endif
inferior_ptid = pid_to_ptid (pid);
- add_inferior (pid);
+ inf = add_inferior (pid);
+ inf->attach_flag = 1;
/* Always add a main thread. If some target extends the ptrace
target, it should decorate the ptid later with more info. */
@@ -307,7 +308,6 @@ inf_ptrace_detach (char *args, int from_tty)
ptrace (PT_DETACH, pid, (PTRACE_TYPE_ARG3)1, sig);
if (errno != 0)
perror_with_name (("ptrace"));
- attach_flag = 0;
#else
error (_("This system does not support detaching from a process"));
#endif
@@ -611,8 +611,10 @@ inf_ptrace_thread_alive (ptid_t ptid)
static void
inf_ptrace_files_info (struct target_ops *ignore)
{
+ struct inferior *inf = current_inferior ();
+
printf_filtered (_("\tUsing the running image of %s %s.\n"),
- attach_flag ? "attached" : "child",
+ inf->attach_flag ? "attached" : "child",
target_pid_to_str (inferior_ptid));
}