2005-11-25 Michael Snyder <msnyder@redhat.com>
+ * infrun.c (set_last_target_status): Remove, replace with following.
+ (nullify_last_target_wait_ptid): New function. Now we don't need
+ to save this bit of state in linux-nat.
+
+ * linux-nat.c (struct fork_info): Get rid of last_target_ptid,
+ last_target_waitstatus, and inferior status.
+ (fork_load_infrun_state): Forget about infrun status and target
+ wait ptid. Call nullify_last_target_wait_ptid instead.
+ (fork_save_infrun_state): Forget about infrun status and target
+ wait ptid.
+ (free_fork): Forget about infrun status.
+ (detach_fork_command): Output cleanup.
+
* linux-nat.c (child_follow_fork): Add verbose messages when
detaching from parent or child (to match HPUX tests in testsuite).
/* Reinstall ourselves, since we might have been removed in
target_detach (which does other necessary cleanup). */
- /* FIXME: As written, we may do a push_target WITHOUT doing
- a target_detach (if has_vforked). I'm going to momentarily
- assume that that means it's OK to do the same if we've
- forked but not detached. */
push_target (ops);
In fact, this may be overloaded with
kernel thread id, etc. */
int num; /* Convenient handle (GDB fork id) */
- struct inferior_status *status;
struct regcache *savedregs;
int clobber_regs; /* True if we should restore saved regs. */
-
- ptid_t last_target_ptid;
- struct target_waitstatus last_target_waitstatus;
};
/* Load infrun state for the fork PTID. */
static void
fork_load_infrun_state (struct fork_info *fp)
{
- extern void set_last_target_status (ptid_t, struct target_waitstatus);
+ extern void nullify_last_target_wait_ptid ();
- if (fp->status)
- {
- restore_inferior_status (fp->status);
- fp->status = NULL;
- }
if (fp->savedregs && fp->clobber_regs)
regcache_cpy (current_regcache, fp->savedregs);
- set_last_target_status (fp->ptid, fp->last_target_waitstatus);
+ nullify_last_target_wait_ptid ();
}
/* Save infrun state for the fork PTID. */
static void
fork_save_infrun_state (struct fork_info *fp, int clobber_regs)
{
-#if 0
- /* I claim that I no longer need any infrun status. */
- fp->status = save_inferior_status (0);
-#endif
if (fp->savedregs)
regcache_xfree (fp->savedregs);
fp->savedregs = regcache_dup (current_regcache);
- get_last_target_status (&fp->last_target_ptid,
- &fp->last_target_waitstatus);
fp->clobber_regs = clobber_regs;
}
/* FIXME: take care of any left-over step_resume breakpoints. */
if (fp)
{
- if (fp->status)
- xfree (fp->status);
if (fp->savedregs)
regcache_xfree (fp->savedregs);
xfree (fp);
error ("Please switch to another fork before detaching the current fork");
if (ptrace (PTRACE_DETACH, ptid, 0, 0))
- error ("Unable to detach pid %s", target_tid_to_str (ptid));
+ error ("Unable to detach %s", target_tid_to_str (ptid));
if (from_tty)
- printf_filtered ("Detached process %s\n",
- target_pid_or_tid_to_str (inferior_ptid));
+ printf_filtered ("Detached %s\n", target_pid_or_tid_to_str (ptid));
+
delete_fork (ptid);
}