summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@specifix.com>2005-11-26 04:27:17 +0000
committerMichael Snyder <msnyder@specifix.com>2005-11-26 04:27:17 +0000
commit3196f2e1a6cac07a202f9e931d0ca1176ad4217b (patch)
tree6a533e498e0d3cbeb2056e9759eee40c83e816ae
parentb9d64d14283c417a1380f619e1a79484d3d5d3c8 (diff)
downloadgdb-3196f2e1a6cac07a202f9e931d0ca1176ad4217b.tar.gz
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).
-rw-r--r--gdb/ChangeLog13
-rw-r--r--gdb/infrun.c5
-rw-r--r--gdb/linux-nat.c31
3 files changed, 20 insertions, 29 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 70689618caf..32e5f5a103f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,18 @@
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).
diff --git a/gdb/infrun.c b/gdb/infrun.c
index cd8bf1d5036..94cd0c7dc57 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1103,10 +1103,9 @@ get_last_target_status (ptid_t *ptidp, struct target_waitstatus *status)
}
void
-set_last_target_status (ptid_t ptid, struct target_waitstatus status)
+nullify_last_target_wait_ptid (void)
{
- target_last_wait_ptid = ptid;
- target_last_waitstatus = status;
+ target_last_wait_ptid = minus_one_ptid;
}
/* Switch thread contexts, maintaining "infrun state". */
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index c79e6934bb7..bc33f2de635 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -510,10 +510,6 @@ child_follow_fork (struct target_ops *ops, int follow_child)
/* 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);
@@ -3367,12 +3363,8 @@ struct fork_info
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. */
@@ -3380,17 +3372,12 @@ struct fork_info
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. */
@@ -3398,16 +3385,10 @@ fork_load_infrun_state (struct fork_info *fp)
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;
}
@@ -3433,8 +3414,6 @@ free_fork (struct fork_info *fp)
/* 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);
@@ -3600,11 +3579,11 @@ detach_fork_command (char *args, int from_tty)
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);
}