mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-21 01:12:32 +08:00
* breakpoint.c (bpstat_stop_status): Call inferior_has_forked,
inferior_has_vforked, and inferior_has_execd instead of target_has_forked, target_has_vforked, and target_has_execd. * config/pa/nm-hppah.h (CHILD_HAS_FORKED, CHILD_HAS_VFORKED) (CHILD_HAS_EXECD, CHILD_HAS_SYSCALL_EVENT): Don't define. (CHILD_WAIT): Define. (child_wait): Add prototype. * hppah-nat.c (hpux_has_forked): Rename from child_has_forked. Add prototype. (hpux_has_vforked): Likewise, from child_has_vforked. (hpux_has_execd): Likewise, from child_has_execd. (hpux_has_syscall_event): Likewise, from child_has_syscall_event. (not_same_real_pid, child_wait): New, copied from inftarg.c. Call hpux_has_forked, hpux_has_vforked, hpux_has_execd, and hpux_has_syscall_event instead of the target hooks. * infrun.c (inferior_has_forked, inferior_has_vforked) (inferior_has_execd): New functions. * inftarg.c (not_same_real_pid): Remove. (child_wait): Remove references to not_same_real_pid, target_has_forked, target_has_vforked, target_has_execd, and target_has_syscall_event. (child_has_forked, child_has_vforked, child_has_execd) (child_has_syscall_event): Remove. (init_child_ops): Remove references to child_has_forked, child_has_vforked, child_has_execd, and child_has_syscall_event. * infttrace.c (hpux_has_forked): Rename from child_has_forked. (hpux_has_vforked): Likewise, from child_has_vforked. (hpux_has_execd): Likewise, from child_has_execd. (hpux_has_syscall_event): Likewise, from child_has_syscall_event. * target.c (cleanup_target): Remove references to to_has_forked, to_has_vforked, to_has_execd, and to_has_syscall_event. (update_current_target): Likewise. (setup_target_debug): Likewise. (debug_to_has_forked): Remove. (debug_to_has_vforked): Remove. (debug_to_has_execd): Remove. (debug_to_has_syscall_event): Remove. * target.h (struct target_ops): Remove to_has_forked. to_has_vforked, to_has_execd, and to_has_syscall_event. (child_has_forked, child_has_vforked, child_has_execd) (child_has_syscall_event): Remove prototypes. (inferior_has_forked, inferior_has_vforked, inferior_has_execd): Add prototypes. (target_has_forked, target_has_vforked, target_has_execd) (target_has_syscall_event): Remove macros.
This commit is contained in:
parent
4088142aae
commit
47932f85ce
@ -1,3 +1,52 @@
|
||||
2002-11-16 Daniel Jacobowitz <drow@mvista.com>
|
||||
|
||||
* breakpoint.c (bpstat_stop_status): Call inferior_has_forked,
|
||||
inferior_has_vforked, and inferior_has_execd instead of
|
||||
target_has_forked, target_has_vforked, and target_has_execd.
|
||||
* config/pa/nm-hppah.h (CHILD_HAS_FORKED, CHILD_HAS_VFORKED)
|
||||
(CHILD_HAS_EXECD, CHILD_HAS_SYSCALL_EVENT): Don't define.
|
||||
(CHILD_WAIT): Define.
|
||||
(child_wait): Add prototype.
|
||||
* hppah-nat.c (hpux_has_forked): Rename from child_has_forked.
|
||||
Add prototype.
|
||||
(hpux_has_vforked): Likewise, from child_has_vforked.
|
||||
(hpux_has_execd): Likewise, from child_has_execd.
|
||||
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
|
||||
(not_same_real_pid, child_wait): New, copied from inftarg.c.
|
||||
Call hpux_has_forked, hpux_has_vforked, hpux_has_execd,
|
||||
and hpux_has_syscall_event instead of the target hooks.
|
||||
* infrun.c (inferior_has_forked, inferior_has_vforked)
|
||||
(inferior_has_execd): New functions.
|
||||
* inftarg.c (not_same_real_pid): Remove.
|
||||
(child_wait): Remove references to not_same_real_pid,
|
||||
target_has_forked, target_has_vforked, target_has_execd,
|
||||
and target_has_syscall_event.
|
||||
(child_has_forked, child_has_vforked, child_has_execd)
|
||||
(child_has_syscall_event): Remove.
|
||||
(init_child_ops): Remove references to child_has_forked,
|
||||
child_has_vforked, child_has_execd, and child_has_syscall_event.
|
||||
* infttrace.c (hpux_has_forked): Rename from child_has_forked.
|
||||
(hpux_has_vforked): Likewise, from child_has_vforked.
|
||||
(hpux_has_execd): Likewise, from child_has_execd.
|
||||
(hpux_has_syscall_event): Likewise, from child_has_syscall_event.
|
||||
* target.c (cleanup_target): Remove references to
|
||||
to_has_forked, to_has_vforked, to_has_execd, and
|
||||
to_has_syscall_event.
|
||||
(update_current_target): Likewise.
|
||||
(setup_target_debug): Likewise.
|
||||
(debug_to_has_forked): Remove.
|
||||
(debug_to_has_vforked): Remove.
|
||||
(debug_to_has_execd): Remove.
|
||||
(debug_to_has_syscall_event): Remove.
|
||||
* target.h (struct target_ops): Remove to_has_forked.
|
||||
to_has_vforked, to_has_execd, and to_has_syscall_event.
|
||||
(child_has_forked, child_has_vforked, child_has_execd)
|
||||
(child_has_syscall_event): Remove prototypes.
|
||||
(inferior_has_forked, inferior_has_vforked, inferior_has_execd): Add
|
||||
prototypes.
|
||||
(target_has_forked, target_has_vforked, target_has_execd)
|
||||
(target_has_syscall_event): Remove macros.
|
||||
|
||||
2002-11-16 Daniel Jacobowitz <drow@mvista.com>
|
||||
|
||||
* hppah-nat.c (child_can_follow_vfork_prior_to_exec): Remove.
|
||||
|
@ -2570,17 +2570,17 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint)
|
||||
continue;
|
||||
|
||||
if ((b->type == bp_catch_fork)
|
||||
&& !target_has_forked (PIDGET (inferior_ptid),
|
||||
&b->forked_inferior_pid))
|
||||
&& !inferior_has_forked (PIDGET (inferior_ptid),
|
||||
&b->forked_inferior_pid))
|
||||
continue;
|
||||
|
||||
if ((b->type == bp_catch_vfork)
|
||||
&& !target_has_vforked (PIDGET (inferior_ptid),
|
||||
&b->forked_inferior_pid))
|
||||
&& !inferior_has_vforked (PIDGET (inferior_ptid),
|
||||
&b->forked_inferior_pid))
|
||||
continue;
|
||||
|
||||
if ((b->type == bp_catch_exec)
|
||||
&& !target_has_execd (PIDGET (inferior_ptid), &b->exec_pathname))
|
||||
&& !inferior_has_execd (PIDGET (inferior_ptid), &b->exec_pathname))
|
||||
continue;
|
||||
|
||||
if (ep_is_exception_catchpoint (b) &&
|
||||
|
@ -81,16 +81,14 @@ extern int hppa_prepare_to_proceed (void);
|
||||
#define CHILD_REMOVE_FORK_CATCHPOINT
|
||||
#define CHILD_INSERT_VFORK_CATCHPOINT
|
||||
#define CHILD_REMOVE_VFORK_CATCHPOINT
|
||||
#define CHILD_HAS_FORKED
|
||||
#define CHILD_HAS_VFORKED
|
||||
#define CHILD_INSERT_EXEC_CATCHPOINT
|
||||
#define CHILD_REMOVE_EXEC_CATCHPOINT
|
||||
#define CHILD_HAS_EXECD
|
||||
#define CHILD_REPORTED_EXEC_EVENTS_PER_EXEC_CALL
|
||||
#define CHILD_HAS_SYSCALL_EVENT
|
||||
#define CHILD_POST_ATTACH
|
||||
#define CHILD_THREAD_ALIVE
|
||||
#define CHILD_PID_TO_STR
|
||||
#define CHILD_WAIT
|
||||
extern ptid_t child_wait (ptid_t, struct target_waitstatus *);
|
||||
|
||||
#define REQUIRE_ATTACH(pid) hppa_require_attach(pid)
|
||||
extern int hppa_require_attach (int);
|
||||
|
138
gdb/hppah-nat.c
138
gdb/hppah-nat.c
@ -35,6 +35,12 @@
|
||||
|
||||
extern CORE_ADDR text_end;
|
||||
|
||||
extern int hpux_has_forked (int pid, int *childpid);
|
||||
extern int hpux_has_vforked (int pid, int *childpid);
|
||||
extern int hpux_has_execd (int pid, char **execd_pathname);
|
||||
extern int hpux_has_syscall_event (int pid, enum target_waitkind *kind,
|
||||
int *syscall_id);
|
||||
|
||||
static void fetch_register (int);
|
||||
|
||||
void
|
||||
@ -469,6 +475,130 @@ hppa_tid_to_str (ptid_t ptid)
|
||||
return buf;
|
||||
}
|
||||
|
||||
/*## */
|
||||
/* Enable HACK for ttrace work. In
|
||||
* infttrace.c/require_notification_of_events,
|
||||
* this is set to 0 so that the loop in child_wait
|
||||
* won't loop.
|
||||
*/
|
||||
int not_same_real_pid = 1;
|
||||
/*## */
|
||||
|
||||
|
||||
/* Wait for child to do something. Return pid of child, or -1 in case
|
||||
of error; store status through argument pointer OURSTATUS. */
|
||||
|
||||
ptid_t
|
||||
child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
|
||||
{
|
||||
int save_errno;
|
||||
int status;
|
||||
char *execd_pathname = NULL;
|
||||
int exit_status;
|
||||
int related_pid;
|
||||
int syscall_id;
|
||||
enum target_waitkind kind;
|
||||
int pid;
|
||||
|
||||
do
|
||||
{
|
||||
set_sigint_trap (); /* Causes SIGINT to be passed on to the
|
||||
attached process. */
|
||||
set_sigio_trap ();
|
||||
|
||||
pid = ptrace_wait (inferior_ptid, &status);
|
||||
|
||||
save_errno = errno;
|
||||
|
||||
clear_sigio_trap ();
|
||||
|
||||
clear_sigint_trap ();
|
||||
|
||||
if (pid == -1)
|
||||
{
|
||||
if (save_errno == EINTR)
|
||||
continue;
|
||||
|
||||
fprintf_unfiltered (gdb_stderr, "Child process unexpectedly missing: %s.\n",
|
||||
safe_strerror (save_errno));
|
||||
|
||||
/* Claim it exited with unknown signal. */
|
||||
ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
|
||||
ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
|
||||
return pid_to_ptid (-1);
|
||||
}
|
||||
|
||||
/* Did it exit?
|
||||
*/
|
||||
if (target_has_exited (pid, status, &exit_status))
|
||||
{
|
||||
/* ??rehrauer: For now, ignore this. */
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!target_thread_alive (pid_to_ptid (pid)))
|
||||
{
|
||||
ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
|
||||
return pid_to_ptid (pid);
|
||||
}
|
||||
|
||||
if (hpux_has_forked (pid, &related_pid)
|
||||
&& ((pid == PIDGET (inferior_ptid))
|
||||
|| (related_pid == PIDGET (inferior_ptid))))
|
||||
{
|
||||
ourstatus->kind = TARGET_WAITKIND_FORKED;
|
||||
ourstatus->value.related_pid = related_pid;
|
||||
return pid_to_ptid (pid);
|
||||
}
|
||||
|
||||
if (hpux_has_vforked (pid, &related_pid)
|
||||
&& ((pid == PIDGET (inferior_ptid))
|
||||
|| (related_pid == PIDGET (inferior_ptid))))
|
||||
{
|
||||
ourstatus->kind = TARGET_WAITKIND_VFORKED;
|
||||
ourstatus->value.related_pid = related_pid;
|
||||
return pid_to_ptid (pid);
|
||||
}
|
||||
|
||||
if (hpux_has_execd (pid, &execd_pathname))
|
||||
{
|
||||
/* Are we ignoring initial exec events? (This is likely because
|
||||
we're in the process of starting up the inferior, and another
|
||||
(older) mechanism handles those.) If so, we'll report this
|
||||
as a regular stop, not an exec.
|
||||
*/
|
||||
if (inferior_ignoring_startup_exec_events)
|
||||
{
|
||||
inferior_ignoring_startup_exec_events--;
|
||||
}
|
||||
else
|
||||
{
|
||||
ourstatus->kind = TARGET_WAITKIND_EXECD;
|
||||
ourstatus->value.execd_pathname = execd_pathname;
|
||||
return pid_to_ptid (pid);
|
||||
}
|
||||
}
|
||||
|
||||
/* All we must do with these is communicate their occurrence
|
||||
to wait_for_inferior...
|
||||
*/
|
||||
if (hpux_has_syscall_event (pid, &kind, &syscall_id))
|
||||
{
|
||||
ourstatus->kind = kind;
|
||||
ourstatus->value.syscall_id = syscall_id;
|
||||
return pid_to_ptid (pid);
|
||||
}
|
||||
|
||||
/*## } while (pid != PIDGET (inferior_ptid)); ## *//* Some other child died or stopped */
|
||||
/* hack for thread testing */
|
||||
}
|
||||
while ((pid != PIDGET (inferior_ptid)) && not_same_real_pid);
|
||||
/*## */
|
||||
|
||||
store_waitstatus (ourstatus, status);
|
||||
return pid_to_ptid (pid);
|
||||
}
|
||||
|
||||
#if !defined (GDB_NATIVE_HPUX_11)
|
||||
|
||||
/* The following code is a substitute for the infttrace.c versions used
|
||||
@ -890,7 +1020,7 @@ child_remove_vfork_catchpoint (int pid)
|
||||
}
|
||||
|
||||
int
|
||||
child_has_forked (int pid, int *childpid)
|
||||
hpux_has_forked (int pid, int *childpid)
|
||||
{
|
||||
/* This request is only available on HPUX 10.0 and later. */
|
||||
#if !defined(PT_GET_PROCESS_STATE)
|
||||
@ -921,7 +1051,7 @@ child_has_forked (int pid, int *childpid)
|
||||
}
|
||||
|
||||
int
|
||||
child_has_vforked (int pid, int *childpid)
|
||||
hpux_has_vforked (int pid, int *childpid)
|
||||
{
|
||||
/* This request is only available on HPUX 10.0 and later. */
|
||||
#if !defined(PT_GET_PROCESS_STATE)
|
||||
@ -983,7 +1113,7 @@ child_remove_exec_catchpoint (int pid)
|
||||
}
|
||||
|
||||
int
|
||||
child_has_execd (int pid, char **execd_pathname)
|
||||
hpux_has_execd (int pid, char **execd_pathname)
|
||||
{
|
||||
/* This request is only available on HPUX 10.0 and later. */
|
||||
#if !defined(PT_GET_PROCESS_STATE)
|
||||
@ -1022,7 +1152,7 @@ child_reported_exec_events_per_exec_call (void)
|
||||
}
|
||||
|
||||
int
|
||||
child_has_syscall_event (int pid, enum target_waitkind *kind, int *syscall_id)
|
||||
hpux_has_syscall_event (int pid, enum target_waitkind *kind, int *syscall_id)
|
||||
{
|
||||
/* This request is only available on HPUX 10.30 and later, via
|
||||
the ttrace interface. */
|
||||
|
54
gdb/infrun.c
54
gdb/infrun.c
@ -3983,6 +3983,60 @@ discard_inferior_status (struct inferior_status *inf_status)
|
||||
xfree (inf_status);
|
||||
}
|
||||
|
||||
int
|
||||
inferior_has_forked (int pid, int *child_pid)
|
||||
{
|
||||
struct target_waitstatus last;
|
||||
ptid_t last_ptid;
|
||||
|
||||
get_last_target_status (&last_ptid, &last);
|
||||
|
||||
if (last.kind != TARGET_WAITKIND_FORKED)
|
||||
return 0;
|
||||
|
||||
if (ptid_get_pid (last_ptid) != pid)
|
||||
return 0;
|
||||
|
||||
*child_pid = last.value.related_pid;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
inferior_has_vforked (int pid, int *child_pid)
|
||||
{
|
||||
struct target_waitstatus last;
|
||||
ptid_t last_ptid;
|
||||
|
||||
get_last_target_status (&last_ptid, &last);
|
||||
|
||||
if (last.kind != TARGET_WAITKIND_VFORKED)
|
||||
return 0;
|
||||
|
||||
if (ptid_get_pid (last_ptid) != pid)
|
||||
return 0;
|
||||
|
||||
*child_pid = last.value.related_pid;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
inferior_has_execd (int pid, char **execd_pathname)
|
||||
{
|
||||
struct target_waitstatus last;
|
||||
ptid_t last_ptid;
|
||||
|
||||
get_last_target_status (&last_ptid, &last);
|
||||
|
||||
if (last.kind != TARGET_WAITKIND_EXECD)
|
||||
return 0;
|
||||
|
||||
if (ptid_get_pid (last_ptid) != pid)
|
||||
return 0;
|
||||
|
||||
*execd_pathname = xstrdup (last.value.execd_pathname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Oft used ptids */
|
||||
ptid_t null_ptid;
|
||||
ptid_t minus_one_ptid;
|
||||
|
112
gdb/inftarg.c
112
gdb/inftarg.c
@ -104,16 +104,6 @@ int child_suppress_run = 0; /* Non-zero if inftarg should pretend not to
|
||||
|
||||
#ifndef CHILD_WAIT
|
||||
|
||||
/*## */
|
||||
/* Enable HACK for ttrace work. In
|
||||
* infttrace.c/require_notification_of_events,
|
||||
* this is set to 0 so that the loop in child_wait
|
||||
* won't loop.
|
||||
*/
|
||||
int not_same_real_pid = 1;
|
||||
/*## */
|
||||
|
||||
|
||||
/* Wait for child to do something. Return pid of child, or -1 in case
|
||||
of error; store status through argument pointer OURSTATUS. */
|
||||
|
||||
@ -170,59 +160,7 @@ child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
|
||||
ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
|
||||
return pid_to_ptid (pid);
|
||||
}
|
||||
|
||||
if (target_has_forked (pid, &related_pid)
|
||||
&& ((pid == PIDGET (inferior_ptid))
|
||||
|| (related_pid == PIDGET (inferior_ptid))))
|
||||
{
|
||||
ourstatus->kind = TARGET_WAITKIND_FORKED;
|
||||
ourstatus->value.related_pid = related_pid;
|
||||
return pid_to_ptid (pid);
|
||||
}
|
||||
|
||||
if (target_has_vforked (pid, &related_pid)
|
||||
&& ((pid == PIDGET (inferior_ptid))
|
||||
|| (related_pid == PIDGET (inferior_ptid))))
|
||||
{
|
||||
ourstatus->kind = TARGET_WAITKIND_VFORKED;
|
||||
ourstatus->value.related_pid = related_pid;
|
||||
return pid_to_ptid (pid);
|
||||
}
|
||||
|
||||
if (target_has_execd (pid, &execd_pathname))
|
||||
{
|
||||
/* Are we ignoring initial exec events? (This is likely because
|
||||
we're in the process of starting up the inferior, and another
|
||||
(older) mechanism handles those.) If so, we'll report this
|
||||
as a regular stop, not an exec.
|
||||
*/
|
||||
if (inferior_ignoring_startup_exec_events)
|
||||
{
|
||||
inferior_ignoring_startup_exec_events--;
|
||||
}
|
||||
else
|
||||
{
|
||||
ourstatus->kind = TARGET_WAITKIND_EXECD;
|
||||
ourstatus->value.execd_pathname = execd_pathname;
|
||||
return pid_to_ptid (pid);
|
||||
}
|
||||
}
|
||||
|
||||
/* All we must do with these is communicate their occurrence
|
||||
to wait_for_inferior...
|
||||
*/
|
||||
if (target_has_syscall_event (pid, &kind, &syscall_id))
|
||||
{
|
||||
ourstatus->kind = kind;
|
||||
ourstatus->value.syscall_id = syscall_id;
|
||||
return pid_to_ptid (pid);
|
||||
}
|
||||
|
||||
/*## } while (pid != PIDGET (inferior_ptid)); ## *//* Some other child died or stopped */
|
||||
/* hack for thread testing */
|
||||
}
|
||||
while ((pid != PIDGET (inferior_ptid)) && not_same_real_pid);
|
||||
/*## */
|
||||
} while (pid != PIDGET (inferior_ptid)); /* Some other child died or stopped */
|
||||
|
||||
store_waitstatus (ourstatus, status);
|
||||
return pid_to_ptid (pid);
|
||||
@ -552,27 +490,6 @@ child_remove_vfork_catchpoint (int pid)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CHILD_HAS_FORKED)
|
||||
int
|
||||
child_has_forked (int pid, int *child_pid)
|
||||
{
|
||||
/* This version of Unix doesn't support notification of fork events. */
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(CHILD_HAS_VFORKED)
|
||||
int
|
||||
child_has_vforked (int pid, int *child_pid)
|
||||
{
|
||||
/* This version of Unix doesn't support notification of vfork events.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(CHILD_POST_FOLLOW_VFORK)
|
||||
void
|
||||
child_post_follow_vfork (int parent_pid, int followed_parent, int child_pid,
|
||||
@ -602,17 +519,6 @@ child_remove_exec_catchpoint (int pid)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CHILD_HAS_EXECD)
|
||||
int
|
||||
child_has_execd (int pid, char **execd_pathname)
|
||||
{
|
||||
/* This version of Unix doesn't support notification of exec events.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(CHILD_REPORTED_EXEC_EVENTS_PER_EXEC_CALL)
|
||||
int
|
||||
child_reported_exec_events_per_exec_call (void)
|
||||
@ -623,18 +529,6 @@ child_reported_exec_events_per_exec_call (void)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(CHILD_HAS_SYSCALL_EVENT)
|
||||
int
|
||||
child_has_syscall_event (int pid, enum target_waitkind *kind, int *syscall_id)
|
||||
{
|
||||
/* This version of Unix doesn't support notification of syscall events.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(CHILD_HAS_EXITED)
|
||||
int
|
||||
child_has_exited (int pid, int wait_status, int *exit_status)
|
||||
@ -774,14 +668,10 @@ init_child_ops (void)
|
||||
child_ops.to_remove_fork_catchpoint = child_remove_fork_catchpoint;
|
||||
child_ops.to_insert_vfork_catchpoint = child_insert_vfork_catchpoint;
|
||||
child_ops.to_remove_vfork_catchpoint = child_remove_vfork_catchpoint;
|
||||
child_ops.to_has_forked = child_has_forked;
|
||||
child_ops.to_has_vforked = child_has_vforked;
|
||||
child_ops.to_post_follow_vfork = child_post_follow_vfork;
|
||||
child_ops.to_insert_exec_catchpoint = child_insert_exec_catchpoint;
|
||||
child_ops.to_remove_exec_catchpoint = child_remove_exec_catchpoint;
|
||||
child_ops.to_has_execd = child_has_execd;
|
||||
child_ops.to_reported_exec_events_per_exec_call = child_reported_exec_events_per_exec_call;
|
||||
child_ops.to_has_syscall_event = child_has_syscall_event;
|
||||
child_ops.to_has_exited = child_has_exited;
|
||||
child_ops.to_mourn_inferior = child_mourn_inferior;
|
||||
child_ops.to_can_run = child_can_run;
|
||||
|
@ -2289,7 +2289,7 @@ call_ttrace_wait (int pid, ttwopt_t option, ttstate_t *tsp, size_t tsp_size)
|
||||
thread descriptor.
|
||||
|
||||
This caches the state. The implementation of queries like
|
||||
target_has_execd can then use this cached state, rather than
|
||||
hpux_has_execd can then use this cached state, rather than
|
||||
be forced to make an explicit ttrace call to get it.
|
||||
|
||||
(Guard against the condition that this is the first time we've
|
||||
@ -3357,8 +3357,6 @@ child_remove_vfork_catchpoint (int tid)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CHILD_HAS_FORKED)
|
||||
|
||||
/* Q: Do we need to map the returned process ID to a thread ID?
|
||||
|
||||
* A: I don't think so--here we want a _real_ pid. Any later
|
||||
@ -3366,7 +3364,7 @@ child_remove_vfork_catchpoint (int tid)
|
||||
* start the mapping.
|
||||
*/
|
||||
int
|
||||
child_has_forked (int tid, int *childpid)
|
||||
hpux_has_forked (int tid, int *childpid)
|
||||
{
|
||||
int tt_status;
|
||||
ttstate_t ttrace_state;
|
||||
@ -3403,15 +3401,11 @@ child_has_forked (int tid, int *childpid)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(CHILD_HAS_VFORKED)
|
||||
|
||||
/* See child_has_forked for pid discussion.
|
||||
/* See hpux_has_forked for pid discussion.
|
||||
*/
|
||||
int
|
||||
child_has_vforked (int tid, int *childpid)
|
||||
hpux_has_vforked (int tid, int *childpid)
|
||||
{
|
||||
int tt_status;
|
||||
ttstate_t ttrace_state;
|
||||
@ -3446,7 +3440,6 @@ child_has_vforked (int tid, int *childpid)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(CHILD_INSERT_EXEC_CATCHPOINT)
|
||||
@ -3475,9 +3468,8 @@ child_remove_exec_catchpoint (int tid)
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(CHILD_HAS_EXECD)
|
||||
int
|
||||
child_has_execd (int tid, char **execd_pathname)
|
||||
hpux_has_execd (int tid, char **execd_pathname)
|
||||
{
|
||||
int tt_status;
|
||||
ttstate_t ttrace_state;
|
||||
@ -3516,12 +3508,10 @@ child_has_execd (int tid, char **execd_pathname)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(CHILD_HAS_SYSCALL_EVENT)
|
||||
int
|
||||
child_has_syscall_event (int pid, enum target_waitkind *kind, int *syscall_id)
|
||||
hpux_has_syscall_event (int pid, enum target_waitkind *kind, int *syscall_id)
|
||||
{
|
||||
int tt_status;
|
||||
ttstate_t ttrace_state;
|
||||
@ -3561,7 +3551,6 @@ child_has_syscall_event (int pid, enum target_waitkind *kind, int *syscall_id)
|
||||
*syscall_id = ttrace_state.tts_scno;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
90
gdb/target.c
90
gdb/target.c
@ -486,12 +486,6 @@ cleanup_target (struct target_ops *t)
|
||||
de_fault (to_remove_vfork_catchpoint,
|
||||
(int (*) (int))
|
||||
tcomplain);
|
||||
de_fault (to_has_forked,
|
||||
(int (*) (int, int *))
|
||||
return_zero);
|
||||
de_fault (to_has_vforked,
|
||||
(int (*) (int, int *))
|
||||
return_zero);
|
||||
de_fault (to_post_follow_vfork,
|
||||
(void (*) (int, int, int, int))
|
||||
target_ignore);
|
||||
@ -501,15 +495,9 @@ cleanup_target (struct target_ops *t)
|
||||
de_fault (to_remove_exec_catchpoint,
|
||||
(int (*) (int))
|
||||
tcomplain);
|
||||
de_fault (to_has_execd,
|
||||
(int (*) (int, char **))
|
||||
return_zero);
|
||||
de_fault (to_reported_exec_events_per_exec_call,
|
||||
(int (*) (void))
|
||||
return_one);
|
||||
de_fault (to_has_syscall_event,
|
||||
(int (*) (int, enum target_waitkind *, int *))
|
||||
return_zero);
|
||||
de_fault (to_has_exited,
|
||||
(int (*) (int, int, int *))
|
||||
return_zero);
|
||||
@ -624,14 +612,10 @@ update_current_target (void)
|
||||
INHERIT (to_remove_fork_catchpoint, t);
|
||||
INHERIT (to_insert_vfork_catchpoint, t);
|
||||
INHERIT (to_remove_vfork_catchpoint, t);
|
||||
INHERIT (to_has_forked, t);
|
||||
INHERIT (to_has_vforked, t);
|
||||
INHERIT (to_post_follow_vfork, t);
|
||||
INHERIT (to_insert_exec_catchpoint, t);
|
||||
INHERIT (to_remove_exec_catchpoint, t);
|
||||
INHERIT (to_has_execd, t);
|
||||
INHERIT (to_reported_exec_events_per_exec_call, t);
|
||||
INHERIT (to_has_syscall_event, t);
|
||||
INHERIT (to_has_exited, t);
|
||||
INHERIT (to_mourn_inferior, t);
|
||||
INHERIT (to_can_run, t);
|
||||
@ -2124,32 +2108,6 @@ debug_to_remove_vfork_catchpoint (int pid)
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int
|
||||
debug_to_has_forked (int pid, int *child_pid)
|
||||
{
|
||||
int has_forked;
|
||||
|
||||
has_forked = debug_target.to_has_forked (pid, child_pid);
|
||||
|
||||
fprintf_unfiltered (gdb_stdlog, "target_has_forked (%d, %d) = %d\n",
|
||||
pid, *child_pid, has_forked);
|
||||
|
||||
return has_forked;
|
||||
}
|
||||
|
||||
static int
|
||||
debug_to_has_vforked (int pid, int *child_pid)
|
||||
{
|
||||
int has_vforked;
|
||||
|
||||
has_vforked = debug_target.to_has_vforked (pid, child_pid);
|
||||
|
||||
fprintf_unfiltered (gdb_stdlog, "target_has_vforked (%d, %d) = %d\n",
|
||||
pid, *child_pid, has_vforked);
|
||||
|
||||
return has_vforked;
|
||||
}
|
||||
|
||||
static void
|
||||
debug_to_post_follow_vfork (int parent_pid, int followed_parent, int child_pid,
|
||||
int followed_child)
|
||||
@ -2187,20 +2145,6 @@ debug_to_remove_exec_catchpoint (int pid)
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int
|
||||
debug_to_has_execd (int pid, char **execd_pathname)
|
||||
{
|
||||
int has_execd;
|
||||
|
||||
has_execd = debug_target.to_has_execd (pid, execd_pathname);
|
||||
|
||||
fprintf_unfiltered (gdb_stdlog, "target_has_execd (%d, %s) = %d\n",
|
||||
pid, (*execd_pathname ? *execd_pathname : "<NULL>"),
|
||||
has_execd);
|
||||
|
||||
return has_execd;
|
||||
}
|
||||
|
||||
static int
|
||||
debug_to_reported_exec_events_per_exec_call (void)
|
||||
{
|
||||
@ -2215,36 +2159,6 @@ debug_to_reported_exec_events_per_exec_call (void)
|
||||
return reported_exec_events;
|
||||
}
|
||||
|
||||
static int
|
||||
debug_to_has_syscall_event (int pid, enum target_waitkind *kind,
|
||||
int *syscall_id)
|
||||
{
|
||||
int has_syscall_event;
|
||||
char *kind_spelling = "??";
|
||||
|
||||
has_syscall_event = debug_target.to_has_syscall_event (pid, kind, syscall_id);
|
||||
if (has_syscall_event)
|
||||
{
|
||||
switch (*kind)
|
||||
{
|
||||
case TARGET_WAITKIND_SYSCALL_ENTRY:
|
||||
kind_spelling = "SYSCALL_ENTRY";
|
||||
break;
|
||||
case TARGET_WAITKIND_SYSCALL_RETURN:
|
||||
kind_spelling = "SYSCALL_RETURN";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
"target_has_syscall_event (%d, %s, %d) = %d\n",
|
||||
pid, kind_spelling, *syscall_id, has_syscall_event);
|
||||
|
||||
return has_syscall_event;
|
||||
}
|
||||
|
||||
static int
|
||||
debug_to_has_exited (int pid, int wait_status, int *exit_status)
|
||||
{
|
||||
@ -2417,14 +2331,10 @@ setup_target_debug (void)
|
||||
current_target.to_remove_fork_catchpoint = debug_to_remove_fork_catchpoint;
|
||||
current_target.to_insert_vfork_catchpoint = debug_to_insert_vfork_catchpoint;
|
||||
current_target.to_remove_vfork_catchpoint = debug_to_remove_vfork_catchpoint;
|
||||
current_target.to_has_forked = debug_to_has_forked;
|
||||
current_target.to_has_vforked = debug_to_has_vforked;
|
||||
current_target.to_post_follow_vfork = debug_to_post_follow_vfork;
|
||||
current_target.to_insert_exec_catchpoint = debug_to_insert_exec_catchpoint;
|
||||
current_target.to_remove_exec_catchpoint = debug_to_remove_exec_catchpoint;
|
||||
current_target.to_has_execd = debug_to_has_execd;
|
||||
current_target.to_reported_exec_events_per_exec_call = debug_to_reported_exec_events_per_exec_call;
|
||||
current_target.to_has_syscall_event = debug_to_has_syscall_event;
|
||||
current_target.to_has_exited = debug_to_has_exited;
|
||||
current_target.to_mourn_inferior = debug_to_mourn_inferior;
|
||||
current_target.to_can_run = debug_to_can_run;
|
||||
|
48
gdb/target.h
48
gdb/target.h
@ -278,14 +278,10 @@ struct target_ops
|
||||
int (*to_remove_fork_catchpoint) (int);
|
||||
int (*to_insert_vfork_catchpoint) (int);
|
||||
int (*to_remove_vfork_catchpoint) (int);
|
||||
int (*to_has_forked) (int, int *);
|
||||
int (*to_has_vforked) (int, int *);
|
||||
void (*to_post_follow_vfork) (int, int, int, int);
|
||||
int (*to_insert_exec_catchpoint) (int);
|
||||
int (*to_remove_exec_catchpoint) (int);
|
||||
int (*to_has_execd) (int, char **);
|
||||
int (*to_reported_exec_events_per_exec_call) (void);
|
||||
int (*to_has_syscall_event) (int, enum target_waitkind *, int *);
|
||||
int (*to_has_exited) (int, int, int *);
|
||||
void (*to_mourn_inferior) (void);
|
||||
int (*to_can_run) (void);
|
||||
@ -556,10 +552,6 @@ extern int child_insert_vfork_catchpoint (int);
|
||||
|
||||
extern int child_remove_vfork_catchpoint (int);
|
||||
|
||||
extern int child_has_forked (int, int *);
|
||||
|
||||
extern int child_has_vforked (int, int *);
|
||||
|
||||
extern void child_acknowledge_created_inferior (int);
|
||||
|
||||
extern void child_post_follow_vfork (int, int, int, int);
|
||||
@ -568,16 +560,20 @@ extern int child_insert_exec_catchpoint (int);
|
||||
|
||||
extern int child_remove_exec_catchpoint (int);
|
||||
|
||||
extern int child_has_execd (int, char **);
|
||||
|
||||
extern int child_reported_exec_events_per_exec_call (void);
|
||||
|
||||
extern int child_has_syscall_event (int, enum target_waitkind *, int *);
|
||||
|
||||
extern int child_has_exited (int, int, int *);
|
||||
|
||||
extern int child_thread_alive (ptid_t);
|
||||
|
||||
/* From infrun.c. */
|
||||
|
||||
extern int inferior_has_forked (int pid, int *child_pid);
|
||||
|
||||
extern int inferior_has_vforked (int pid, int *child_pid);
|
||||
|
||||
extern int inferior_has_execd (int pid, char **execd_pathname);
|
||||
|
||||
/* From exec.c */
|
||||
|
||||
extern void print_section_info (struct target_ops *, bfd *);
|
||||
@ -742,20 +738,6 @@ extern void target_load (char *arg, int from_tty);
|
||||
#define target_remove_vfork_catchpoint(pid) \
|
||||
(*current_target.to_remove_vfork_catchpoint) (pid)
|
||||
|
||||
/* Returns TRUE if PID has invoked the fork() system call. And,
|
||||
also sets CHILD_PID to the process id of the other ("child")
|
||||
inferior process that was created by that call. */
|
||||
|
||||
#define target_has_forked(pid,child_pid) \
|
||||
(*current_target.to_has_forked) (pid,child_pid)
|
||||
|
||||
/* Returns TRUE if PID has invoked the vfork() system call. And,
|
||||
also sets CHILD_PID to the process id of the other ("child")
|
||||
inferior process that was created by that call. */
|
||||
|
||||
#define target_has_vforked(pid,child_pid) \
|
||||
(*current_target.to_has_vforked) (pid,child_pid)
|
||||
|
||||
/* An inferior process has been created via a vfork() system call.
|
||||
The debugger has followed the parent, the child, or both. The
|
||||
process of setting up for that follow may have required some
|
||||
@ -777,13 +759,6 @@ extern void target_load (char *arg, int from_tty);
|
||||
#define target_remove_exec_catchpoint(pid) \
|
||||
(*current_target.to_remove_exec_catchpoint) (pid)
|
||||
|
||||
/* Returns TRUE if PID has invoked a flavor of the exec() system call.
|
||||
And, also sets EXECD_PATHNAME to the pathname of the executable
|
||||
file that was passed to exec(), and is now being executed. */
|
||||
|
||||
#define target_has_execd(pid,execd_pathname) \
|
||||
(*current_target.to_has_execd) (pid,execd_pathname)
|
||||
|
||||
/* Returns the number of exec events that are reported when a process
|
||||
invokes a flavor of the exec() system call on this target, if exec
|
||||
events are being reported. */
|
||||
@ -791,13 +766,6 @@ extern void target_load (char *arg, int from_tty);
|
||||
#define target_reported_exec_events_per_exec_call() \
|
||||
(*current_target.to_reported_exec_events_per_exec_call) ()
|
||||
|
||||
/* Returns TRUE if PID has reported a syscall event. And, also sets
|
||||
KIND to the appropriate TARGET_WAITKIND_, and sets SYSCALL_ID to
|
||||
the unique integer ID of the syscall. */
|
||||
|
||||
#define target_has_syscall_event(pid,kind,syscall_id) \
|
||||
(*current_target.to_has_syscall_event) (pid,kind,syscall_id)
|
||||
|
||||
/* Returns TRUE if PID has exited. And, also sets EXIT_STATUS to the
|
||||
exit code of PID, if any. */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user