Adjust fork/vfork/exec to pass ptids around.

* target.h (struct target_waitstatus): Store related_pid as a ptid.
	(inferior_has_forked, inferior_has_vforked, inferior_has_execd):
	Take a ptid_t.
	* breakpoint.h (struct breakpoint): Change forked_inferior_pid
	type to ptid.
	* breakpoint.c (print_it_typical, bpstat_check_location)
	(print_one_breakpoint_location, set_raw_breakpoint_without_location)
	(create_fork_vfork_event_catchpoint): Adjust.
	* infrun.c (fork_event): Change parent_pid and child_pid types to
	ptid.
	(follow_exec, inferior_has_forked, inferior_has_vforked)
	(inferior_has_execd): Take a ptid_t and don't trim it.
	* linux-thread-db.c (thread_db_wait): Don't trim the returned ptid.
	* linux-nat.c (linux_child_follow_fork): Adjust.
	* inf-ptrace.c (inf_ptrace_wait): Adjust.
	* inf-ttrace.c (inf_ttrace_wait): Adjust.
	* win32-nat.c (get_win32_debug_event): Don't set related_pid.
This commit is contained in:
Pedro Alves
2008-07-09 22:23:05 +00:00
parent 8ea051c51f
commit 3a3e9ee36f
10 changed files with 75 additions and 42 deletions

View File

@@ -839,6 +839,7 @@ inf_ttrace_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
lwpid_t lwpid = ptid_get_lwp (ptid);
ttstate_t tts;
struct thread_info *ti;
ptid_t related_ptid;
/* Until proven otherwise. */
ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
@@ -918,8 +919,11 @@ inf_ttrace_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
break;
case TTEVT_FORK:
related_ptid = ptid_build (tts.tts_u.tts_fork.tts_fpid,
tts.tts_u.tts_fork.tts_flwpid, 0);
ourstatus->kind = TARGET_WAITKIND_FORKED;
ourstatus->value.related_pid = tts.tts_u.tts_fork.tts_fpid;
ourstatus->value.related_pid = related_ptid;
/* Make sure the other end of the fork is stopped too. */
if (ttrace_wait (tts.tts_u.tts_fork.tts_fpid,
@@ -930,16 +934,21 @@ inf_ttrace_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
gdb_assert (tts.tts_event == TTEVT_FORK);
if (tts.tts_u.tts_fork.tts_isparent)
{
related_ptid = ptid_build (tts.tts_u.tts_fork.tts_fpid,
tts.tts_u.tts_fork.tts_flwpid, 0);
ptid = ptid_build (tts.tts_pid, tts.tts_lwpid, 0);
ourstatus->value.related_pid = tts.tts_u.tts_fork.tts_fpid;
ourstatus->value.related_pid = related_ptid;
}
break;
case TTEVT_VFORK:
gdb_assert (!tts.tts_u.tts_fork.tts_isparent);
related_ptid = ptid_build (tts.tts_u.tts_fork.tts_fpid,
tts.tts_u.tts_fork.tts_flwpid, 0);
ourstatus->kind = TARGET_WAITKIND_VFORKED;
ourstatus->value.related_pid = tts.tts_u.tts_fork.tts_fpid;
ourstatus->value.related_pid = related_ptid;
/* HACK: To avoid touching the parent during the vfork, switch
away from it. */