aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2005-09-04 16:18:20 +0000
committerDaniel Jacobowitz <drow@false.org>2005-09-04 16:18:20 +0000
commitee057212343faef868b546ce17e9dfc3b370f8e0 (patch)
treea2b1f32ba5ad16e317c1d9b695959efef068b462 /gdb/target.c
parent7c04e189032a40c4d4dd414ed8e563b4385bd8bc (diff)
downloadgdb-ee057212343faef868b546ce17e9dfc3b370f8e0.zip
gdb-ee057212343faef868b546ce17e9dfc3b370f8e0.tar.gz
gdb-ee057212343faef868b546ce17e9dfc3b370f8e0.tar.bz2
* inf-child.c (inf_child_follow_fork): Add OPS argument.
* inf-ptrace.c (inf_ptrace_follow_fork): Likewise. * inf-ttrace.c (inf_ttrace_follow_fork): Likewise. * inftarg.c (child_follow_fork): Likewise. * linux-nat.c (child_follow_fork): Likewise. Use ops instead of &deprecated_child_ops. * target.c (update_current_target): Do not inherit to_follow_fork. (target_follow_fork): New function. (debug_to_follow_fork): Remove. (setup_target_debug): Don't set to_follow_fork. * target.h (struct target_ops): Add struct target_ops * to to_follow_fork. (child_follow_fork): Add struct target_ops * argument. (target_follow_fork): Replace macro with prototype.
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/gdb/target.c b/gdb/target.c
index 83501e6..d842f50 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -422,7 +422,7 @@ update_current_target (void)
INHERIT (to_remove_fork_catchpoint, t);
INHERIT (to_insert_vfork_catchpoint, t);
INHERIT (to_remove_vfork_catchpoint, t);
- INHERIT (to_follow_fork, t);
+ /* Do not inherit to_follow_fork. */
INHERIT (to_insert_exec_catchpoint, t);
INHERIT (to_remove_exec_catchpoint, t);
INHERIT (to_reported_exec_events_per_exec_call, t);
@@ -579,9 +579,6 @@ update_current_target (void)
de_fault (to_remove_vfork_catchpoint,
(int (*) (int))
tcomplain);
- de_fault (to_follow_fork,
- (int (*) (int))
- target_ignore);
de_fault (to_insert_exec_catchpoint,
(void (*) (int))
tcomplain);
@@ -1501,6 +1498,31 @@ target_async_mask (int mask)
}
/* Look through the list of possible targets for a target that can
+ follow forks. */
+
+int
+target_follow_fork (int follow_child)
+{
+ struct target_ops *t;
+
+ for (t = current_target.beneath; t != NULL; t = t->beneath)
+ {
+ if (t->to_follow_fork != NULL)
+ {
+ int retval = t->to_follow_fork (t, follow_child);
+ if (targetdebug)
+ fprintf_unfiltered (gdb_stdlog, "target_follow_fork (%d) = %d\n",
+ follow_child, retval);
+ return retval;
+ }
+ }
+
+ /* Some target returned a fork event, but did not know how to follow it. */
+ internal_error (__FILE__, __LINE__,
+ "could not find a target to follow fork");
+}
+
+/* Look through the list of possible targets for a target that can
execute a run or attach command without any other data. This is
used to locate the default process stratum.
@@ -2336,17 +2358,6 @@ debug_to_remove_vfork_catchpoint (int pid)
return retval;
}
-static int
-debug_to_follow_fork (int follow_child)
-{
- int retval = debug_target.to_follow_fork (follow_child);
-
- fprintf_unfiltered (gdb_stdlog, "target_follow_fork (%d) = %d\n",
- follow_child, retval);
-
- return retval;
-}
-
static void
debug_to_insert_exec_catchpoint (int pid)
{
@@ -2539,7 +2550,6 @@ 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_follow_fork = debug_to_follow_fork;
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_reported_exec_events_per_exec_call = debug_to_reported_exec_events_per_exec_call;