summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@debian.org>2002-11-16 19:23:52 +0000
committerDaniel Jacobowitz <dan@debian.org>2002-11-16 19:23:52 +0000
commit6eab4de19308d21c73da53fdb1274914b91f5983 (patch)
tree99fd609af860e1339df674502b20821695a054f4
parent5669b25630620754cc59df21b7f31a3f5610a814 (diff)
downloadgdb-6eab4de19308d21c73da53fdb1274914b91f5983.tar.gz
* config/pa/nm-hppah.h (CHILD_POST_FOLLOW_INFERIOR_BY_CLONE): Don't
define. (struct target_waitstatus): Add opaque definition. * corelow.c (init_core_ops): Don't set to_clone_and_follow_inferior. * exec.c (init_exec_ops): Likewise. * fork-child.c (clone_and_follow_inferior): Remove. * hppah-nat.c (child_post_follow_inferior_by_clone): Remove. * inferior.h (clone_and_follow_inferior): Remove prototype. * infrun.c (follow_fork_mode_both): Remove. (follow_fork_mode_kind_names): Remove commented out "both". (follow_inferior_fork): Remove follow_fork_mode_both support. * inftarg.c (child_clone_and_follow_inferior): Remove. (child_post_follow_inferior_by_clone): Remove. (init_child_ops): Don't set to_clone_and_follow_inferior or to_post_follow_inferior_by_clone. * target.c (default_clone_and_follow_inferior): Remove. (cleanup_target): Don't set to_clone_and_follow_inferior or to_post_follow_inferior_by_clone. (find_default_clone_and_follow_inferior): Remove. (init_dummy_target): Don't set to_clone_and_follow_inferior. (debug_to_clone_and_follow_inferior): Remove. (debug_to_post_follow_inferior_by_clone): Remove. (setup_target_debug): Don't set to_clone_and_follow_inferior or to_post_follow_inferior_by_clone. * target.h (struct target_ops): Remove to_clone_and_follow_inferior and to_post_follow_inferior_by_clone. (child_clone_and_follow_inferior): Remove prototype. (child_post_follow_inferior_by_clone): Remove prototype. (target_clone_and_follow_inferior): Remove macro. (target_post_follow_inferior_by_clone): Remove macro. (find_default_clone_and_follow_inferior): Remove prototype.
-rw-r--r--gdb/ChangeLog34
-rw-r--r--gdb/config/pa/nm-hppah.h2
-rw-r--r--gdb/corelow.c1
-rw-r--r--gdb/exec.c1
-rw-r--r--gdb/fork-child.c125
-rw-r--r--gdb/hppah-nat.c18
-rw-r--r--gdb/inferior.h2
-rw-r--r--gdb/infrun.c24
-rw-r--r--gdb/inftarg.c23
-rw-r--r--gdb/target.c46
-rw-r--r--gdb/target.h35
11 files changed, 35 insertions, 276 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c3299969d85..607e89e6c64 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,39 @@
2002-11-16 Daniel Jacobowitz <drow@mvista.com>
+ * config/pa/nm-hppah.h (CHILD_POST_FOLLOW_INFERIOR_BY_CLONE): Don't
+ define.
+ (struct target_waitstatus): Add opaque definition.
+ * corelow.c (init_core_ops): Don't set to_clone_and_follow_inferior.
+ * exec.c (init_exec_ops): Likewise.
+ * fork-child.c (clone_and_follow_inferior): Remove.
+ * hppah-nat.c (child_post_follow_inferior_by_clone): Remove.
+ * inferior.h (clone_and_follow_inferior): Remove prototype.
+ * infrun.c (follow_fork_mode_both): Remove.
+ (follow_fork_mode_kind_names): Remove commented out "both".
+ (follow_inferior_fork): Remove follow_fork_mode_both support.
+ * inftarg.c (child_clone_and_follow_inferior): Remove.
+ (child_post_follow_inferior_by_clone): Remove.
+ (init_child_ops): Don't set to_clone_and_follow_inferior
+ or to_post_follow_inferior_by_clone.
+ * target.c (default_clone_and_follow_inferior): Remove.
+ (cleanup_target): Don't set to_clone_and_follow_inferior
+ or to_post_follow_inferior_by_clone.
+ (find_default_clone_and_follow_inferior): Remove.
+ (init_dummy_target): Don't set to_clone_and_follow_inferior.
+ (debug_to_clone_and_follow_inferior): Remove.
+ (debug_to_post_follow_inferior_by_clone): Remove.
+ (setup_target_debug): Don't set to_clone_and_follow_inferior
+ or to_post_follow_inferior_by_clone.
+ * target.h (struct target_ops): Remove to_clone_and_follow_inferior
+ and to_post_follow_inferior_by_clone.
+ (child_clone_and_follow_inferior): Remove prototype.
+ (child_post_follow_inferior_by_clone): Remove prototype.
+ (target_clone_and_follow_inferior): Remove macro.
+ (target_post_follow_inferior_by_clone): Remove macro.
+ (find_default_clone_and_follow_inferior): Remove prototype.
+
+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.
diff --git a/gdb/config/pa/nm-hppah.h b/gdb/config/pa/nm-hppah.h
index 9f9c6e26185..26b4c5bd5cd 100644
--- a/gdb/config/pa/nm-hppah.h
+++ b/gdb/config/pa/nm-hppah.h
@@ -65,7 +65,6 @@
/* In hppah-nat.c: */
#define FETCH_INFERIOR_REGISTERS
#define CHILD_XFER_MEMORY
-#define CHILD_POST_FOLLOW_INFERIOR_BY_CLONE
#define CHILD_POST_FOLLOW_VFORK
/* While this is for use by threaded programs, it doesn't appear
@@ -88,6 +87,7 @@ extern int hppa_prepare_to_proceed (void);
#define CHILD_THREAD_ALIVE
#define CHILD_PID_TO_STR
#define CHILD_WAIT
+struct target_waitstatus;
extern ptid_t child_wait (ptid_t, struct target_waitstatus *);
#define REQUIRE_ATTACH(pid) hppa_require_attach(pid)
diff --git a/gdb/corelow.c b/gdb/corelow.c
index f7e3cf0f425..d2b26a2ef99 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -518,7 +518,6 @@ init_core_ops (void)
core_ops.to_insert_breakpoint = ignore;
core_ops.to_remove_breakpoint = ignore;
core_ops.to_create_inferior = find_default_create_inferior;
- core_ops.to_clone_and_follow_inferior = find_default_clone_and_follow_inferior;
core_ops.to_thread_alive = core_file_thread_alive;
core_ops.to_stratum = core_stratum;
core_ops.to_has_memory = 1;
diff --git a/gdb/exec.c b/gdb/exec.c
index 3a3e888b955..6ac7bd07248 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -721,7 +721,6 @@ Specify the filename of the executable file.";
exec_ops.to_insert_breakpoint = ignore;
exec_ops.to_remove_breakpoint = ignore;
exec_ops.to_create_inferior = find_default_create_inferior;
- exec_ops.to_clone_and_follow_inferior = find_default_clone_and_follow_inferior;
exec_ops.to_stratum = file_stratum;
exec_ops.to_has_memory = 1;
exec_ops.to_make_corefile_notes = exec_make_note_section;
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index aacd53cac71..0b14a946186 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -379,131 +379,6 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
#endif
}
-/* An inferior Unix process CHILD_PID has been created by a call to
- fork() (or variants like vfork). It is presently stopped, and waiting
- to be resumed. clone_and_follow_inferior will fork the debugger,
- and that clone will "follow" (attach to) CHILD_PID. The original copy
- of the debugger will not touch CHILD_PID again.
-
- Also, the original debugger will set FOLLOWED_CHILD FALSE, while the
- clone will set it TRUE.
- */
-void
-clone_and_follow_inferior (int child_pid, int *followed_child)
-{
- int debugger_pid;
- int status;
- char pid_spelling[100]; /* Arbitrary but sufficient length. */
-
- /* This semaphore is used to coordinate the two debuggers' handoff
- of CHILD_PID. The original debugger will detach from CHILD_PID,
- and then the clone debugger will attach to it. (It must be done
- this way because on some targets, only one process at a time can
- trace another. Thus, the original debugger must relinquish its
- tracing rights before the clone can pick them up.)
- */
-#define SEM_TALK (1)
-#define SEM_LISTEN (0)
- int handoff_semaphore[2]; /* Original "talks" to [1], clone "listens" to [0] */
- int talk_value = 99;
- int listen_value;
-
- /* Set debug_fork then attach to the child while it sleeps, to debug. */
- static int debug_fork = 0;
-
- /* It is generally good practice to flush any possible pending stdio
- output prior to doing a fork, to avoid the possibility of both the
- parent and child flushing the same data after the fork. */
-
- gdb_flush (gdb_stdout);
- gdb_flush (gdb_stderr);
-
- /* Open the semaphore pipes.
- */
- status = pipe (handoff_semaphore);
- if (status < 0)
- error ("error getting pipe for handoff semaphore");
-
- /* Clone the debugger. Note that the apparent call to vfork()
- below *might* actually be a call to fork() due to the fact that
- autoconf will ``#define vfork fork'' on certain platforms. */
- if (debug_fork)
- debugger_pid = fork ();
- else
- debugger_pid = vfork ();
-
- if (debugger_pid < 0)
- perror_with_name ("fork");
-
- /* Are we the original debugger? If so, we must relinquish all claims
- to CHILD_PID. */
- if (debugger_pid != 0)
- {
- char signal_spelling[100]; /* Arbitrary but sufficient length */
-
- /* Detach from CHILD_PID. Deliver a "stop" signal when we do, though,
- so that it remains stopped until the clone debugger can attach
- to it.
- */
- detach_breakpoints (child_pid);
-
- sprintf (signal_spelling, "%d", target_signal_to_host (TARGET_SIGNAL_STOP));
- target_require_detach (child_pid, signal_spelling, 1);
-
- /* Notify the clone debugger that it should attach to CHILD_PID. */
- write (handoff_semaphore[SEM_TALK], &talk_value, sizeof (talk_value));
-
- *followed_child = 0;
- }
-
- /* We're the child. */
- else
- {
- if (debug_fork)
- sleep (debug_fork);
-
- /* The child (i.e., the cloned debugger) must now attach to
- CHILD_PID. inferior_ptid is presently set to the parent process
- of the fork, while CHILD_PID should be the child process of the
- fork.
-
- Wait until the original debugger relinquishes control of CHILD_PID,
- though.
- */
- read (handoff_semaphore[SEM_LISTEN], &listen_value, sizeof (listen_value));
-
- /* Note that we DON'T want to actually detach from inferior_ptid,
- because that would allow it to run free. The original
- debugger wants to retain control of the process. So, we
- just reset inferior_ptid to CHILD_PID, and then ensure that all
- breakpoints are really set in CHILD_PID.
- */
- target_mourn_inferior ();
-
- /* Ask the tty subsystem to switch to the one we specified earlier
- (or to share the current terminal, if none was specified). */
-
- new_tty ();
-
- dont_repeat ();
- sprintf (pid_spelling, "%d", child_pid);
- target_require_attach (pid_spelling, 1);
-
- /* Perform any necessary cleanup, after attachment. (This form
- of attaching can behave differently on some targets than the
- standard method, where a process formerly not under debugger
- control was suddenly attached to..)
- */
- target_post_follow_inferior_by_clone ();
-
- *followed_child = 1;
- }
-
- /* Discard the handoff sempahore. */
- (void) close (handoff_semaphore[SEM_LISTEN]);
- (void) close (handoff_semaphore[SEM_TALK]);
-}
-
/* Accept NTRAPS traps from the inferior. */
void
diff --git a/gdb/hppah-nat.c b/gdb/hppah-nat.c
index 5daa14dc77a..d5767a9c55f 100644
--- a/gdb/hppah-nat.c
+++ b/gdb/hppah-nat.c
@@ -386,24 +386,6 @@ child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
void
-child_post_follow_inferior_by_clone (void)
-{
- int status;
-
- /* This function is used when following both the parent and child
- of a fork. In this case, the debugger clones itself. The original
- debugger follows the parent, the clone follows the child. The
- original detaches from the child, delivering a SIGSTOP to it to
- keep it from running away until the clone can attach itself.
-
- At this point, the clone has attached to the child. Because of
- the SIGSTOP, we must now deliver a SIGCONT to the child, or it
- won't behave properly. */
- status = kill (PIDGET (inferior_ptid), SIGCONT);
-}
-
-
-void
child_post_follow_vfork (int parent_pid, int followed_parent, int child_pid,
int followed_child)
{
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 2cccda1103b..5cf3540b1c0 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -270,8 +270,6 @@ extern void fork_inferior (char *, char *, char **,
void (*)(int), void (*)(void), char *);
-extern void clone_and_follow_inferior (int, int *);
-
extern void startup_inferior (int);
extern char *construct_inferior_arguments (struct gdbarch *, int, char **);
diff --git a/gdb/infrun.c b/gdb/infrun.c
index da06520c145..b179bf63ea6 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -371,17 +371,11 @@ static struct
pending_follow;
static const char follow_fork_mode_ask[] = "ask";
-static const char follow_fork_mode_both[] = "both";
static const char follow_fork_mode_child[] = "child";
static const char follow_fork_mode_parent[] = "parent";
static const char *follow_fork_mode_kind_names[] = {
follow_fork_mode_ask,
- /* ??rehrauer: The "both" option is broken, by what may be a 10.20
- kernel problem. It's also not terribly useful without a GUI to
- help the user drive two debuggers. So for now, I'm disabling the
- "both" option. */
- /* follow_fork_mode_both, */
follow_fork_mode_child,
follow_fork_mode_parent,
NULL
@@ -486,24 +480,6 @@ follow_inferior_fork (int parent_pid, int child_pid, int has_forked,
insert_breakpoints ();
}
- /* If we're to be following both parent and child, then fork ourselves,
- and attach the debugger clone to the child. */
- else if (follow_mode == follow_fork_mode_both)
- {
- char pid_suffix[100]; /* Arbitrary length. */
-
- /* Clone ourselves to follow the child. This is the end of our
- involvement with child_pid; our clone will take it from here... */
- dont_repeat ();
- target_clone_and_follow_inferior (child_pid, &followed_child);
- followed_parent = !followed_child;
-
- /* We continue to follow the parent. To help distinguish the two
- debuggers, though, both we and our clone will reset our prompts. */
- sprintf (pid_suffix, "[%d] ", PIDGET (inferior_ptid));
- set_prompt (strcat (get_prompt (), pid_suffix));
- }
-
/* The parent and child of a vfork share the same address space.
Also, on some targets the order in which vfork and exec events
are received for parent in child requires some delicate handling
diff --git a/gdb/inftarg.c b/gdb/inftarg.c
index 05445fe1e68..27166db6b10 100644
--- a/gdb/inftarg.c
+++ b/gdb/inftarg.c
@@ -433,27 +433,6 @@ child_acknowledge_created_inferior (int pid)
#endif
-void
-child_clone_and_follow_inferior (int child_pid, int *followed_child)
-{
- clone_and_follow_inferior (child_pid, followed_child);
-
- /* Don't resume CHILD_PID; it's stopped where it ought to be, until
- the decision gets made elsewhere how to continue it.
- */
-}
-
-
-#if !defined(CHILD_POST_FOLLOW_INFERIOR_BY_CLONE)
-void
-child_post_follow_inferior_by_clone (void)
-{
- /* This version of Unix doesn't require a meaningful "post follow inferior"
- operation by a clone debugger.
- */
-}
-#endif
-
#if !defined(CHILD_INSERT_FORK_CATCHPOINT)
int
child_insert_fork_catchpoint (int pid)
@@ -662,8 +641,6 @@ init_child_ops (void)
child_ops.to_create_inferior = child_create_inferior;
child_ops.to_post_startup_inferior = child_post_startup_inferior;
child_ops.to_acknowledge_created_inferior = child_acknowledge_created_inferior;
- child_ops.to_clone_and_follow_inferior = child_clone_and_follow_inferior;
- child_ops.to_post_follow_inferior_by_clone = child_post_follow_inferior_by_clone;
child_ops.to_insert_fork_catchpoint = child_insert_fork_catchpoint;
child_ops.to_remove_fork_catchpoint = child_remove_fork_catchpoint;
child_ops.to_insert_vfork_catchpoint = child_insert_vfork_catchpoint;
diff --git a/gdb/target.c b/gdb/target.c
index 561e1032ddd..795468c2c85 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -44,8 +44,6 @@ static void cleanup_target (struct target_ops *);
static void maybe_kill_then_create_inferior (char *, char *, char **);
-static void default_clone_and_follow_inferior (int, int *);
-
static void maybe_kill_then_attach (char *, int);
static void kill_or_be_killed (int);
@@ -348,12 +346,6 @@ maybe_kill_then_create_inferior (char *exec, char *args, char **env)
target_create_inferior (exec, args, env);
}
-static void
-default_clone_and_follow_inferior (int child_pid, int *followed_child)
-{
- target_clone_and_follow_inferior (child_pid, followed_child);
-}
-
/* Clean up a target struct so it no longer has any zero pointers in it.
We default entries, at least to stubs that print error messages. */
@@ -469,11 +461,6 @@ cleanup_target (struct target_ops *t)
de_fault (to_acknowledge_created_inferior,
(void (*) (int))
target_ignore);
- de_fault (to_clone_and_follow_inferior,
- default_clone_and_follow_inferior);
- de_fault (to_post_follow_inferior_by_clone,
- (void (*) (void))
- target_ignore);
de_fault (to_insert_fork_catchpoint,
(int (*) (int))
tcomplain);
@@ -606,8 +593,6 @@ update_current_target (void)
INHERIT (to_create_inferior, t);
INHERIT (to_post_startup_inferior, t);
INHERIT (to_acknowledge_created_inferior, t);
- INHERIT (to_clone_and_follow_inferior, t);
- INHERIT (to_post_follow_inferior_by_clone, t);
INHERIT (to_insert_fork_catchpoint, t);
INHERIT (to_remove_fork_catchpoint, t);
INHERIT (to_insert_vfork_catchpoint, t);
@@ -1254,16 +1239,6 @@ find_default_create_inferior (char *exec_file, char *allargs, char **env)
return;
}
-void
-find_default_clone_and_follow_inferior (int child_pid, int *followed_child)
-{
- struct target_ops *t;
-
- t = find_default_run_target ("run");
- (t->to_clone_and_follow_inferior) (child_pid, followed_child);
- return;
-}
-
static int
default_region_size_ok_for_hw_watchpoint (int byte_count)
{
@@ -1564,7 +1539,6 @@ init_dummy_target (void)
dummy_target.to_require_attach = find_default_require_attach;
dummy_target.to_require_detach = find_default_require_detach;
dummy_target.to_create_inferior = find_default_create_inferior;
- dummy_target.to_clone_and_follow_inferior = find_default_clone_and_follow_inferior;
dummy_target.to_pid_to_str = normal_pid_to_str;
dummy_target.to_stratum = dummy_stratum;
dummy_target.to_find_memory_regions = dummy_find_memory_regions;
@@ -2038,24 +2012,6 @@ debug_to_acknowledge_created_inferior (int pid)
pid);
}
-static void
-debug_to_clone_and_follow_inferior (int child_pid, int *followed_child)
-{
- debug_target.to_clone_and_follow_inferior (child_pid, followed_child);
-
- fprintf_unfiltered (gdb_stdlog,
- "target_clone_and_follow_inferior (%d, %d)\n",
- child_pid, *followed_child);
-}
-
-static void
-debug_to_post_follow_inferior_by_clone (void)
-{
- debug_target.to_post_follow_inferior_by_clone ();
-
- fprintf_unfiltered (gdb_stdlog, "target_post_follow_inferior_by_clone ()\n");
-}
-
static int
debug_to_insert_fork_catchpoint (int pid)
{
@@ -2325,8 +2281,6 @@ setup_target_debug (void)
current_target.to_create_inferior = debug_to_create_inferior;
current_target.to_post_startup_inferior = debug_to_post_startup_inferior;
current_target.to_acknowledge_created_inferior = debug_to_acknowledge_created_inferior;
- current_target.to_clone_and_follow_inferior = debug_to_clone_and_follow_inferior;
- current_target.to_post_follow_inferior_by_clone = debug_to_post_follow_inferior_by_clone;
current_target.to_insert_fork_catchpoint = debug_to_insert_fork_catchpoint;
current_target.to_remove_fork_catchpoint = debug_to_remove_fork_catchpoint;
current_target.to_insert_vfork_catchpoint = debug_to_insert_vfork_catchpoint;
diff --git a/gdb/target.h b/gdb/target.h
index d9ed6897061..337ea7c2ca3 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -272,8 +272,6 @@ struct target_ops
void (*to_create_inferior) (char *, char *, char **);
void (*to_post_startup_inferior) (ptid_t);
void (*to_acknowledge_created_inferior) (int);
- void (*to_clone_and_follow_inferior) (int, int *);
- void (*to_post_follow_inferior_by_clone) (void);
int (*to_insert_fork_catchpoint) (int);
int (*to_remove_fork_catchpoint) (int);
int (*to_insert_vfork_catchpoint) (int);
@@ -540,10 +538,6 @@ extern void child_post_startup_inferior (ptid_t);
extern void child_acknowledge_created_inferior (int);
-extern void child_clone_and_follow_inferior (int, int *);
-
-extern void child_post_follow_inferior_by_clone (void);
-
extern int child_insert_fork_catchpoint (int);
extern int child_remove_fork_catchpoint (int);
@@ -695,33 +689,6 @@ extern void target_load (char *arg, int from_tty);
#define target_acknowledge_created_inferior(pid) \
(*current_target.to_acknowledge_created_inferior) (pid)
-/* An inferior process has been created via a fork() or similar
- system call. This function will clone the debugger, then ensure
- that CHILD_PID is attached to by that debugger.
-
- FOLLOWED_CHILD is set TRUE on return *for the clone debugger only*,
- and FALSE otherwise. (The original and clone debuggers can use this
- to determine which they are, if need be.)
-
- (This is not a terribly useful feature without a GUI to prevent
- the two debuggers from competing for shell input.) */
-
-#define target_clone_and_follow_inferior(child_pid,followed_child) \
- (*current_target.to_clone_and_follow_inferior) (child_pid, followed_child)
-
-/* This operation is intended to be used as the last in a sequence of
- steps taken when following both parent and child of a fork. This
- is used by a clone of the debugger, which will follow the child.
-
- The original debugger has detached from this process, and the
- clone has attached to it.
-
- On some targets, this requires a bit of cleanup to make it work
- correctly. */
-
-#define target_post_follow_inferior_by_clone() \
- (*current_target.to_post_follow_inferior_by_clone) ()
-
/* On some targets, we can catch an inferior fork or vfork event when
it occurs. These functions insert/remove an already-created
catchpoint for such events. */
@@ -1200,8 +1167,6 @@ extern void find_default_require_detach (int, char *, int);
extern void find_default_create_inferior (char *, char *, char **);
-extern void find_default_clone_and_follow_inferior (int, int *);
-
extern struct target_ops *find_run_target (void);
extern struct target_ops *find_core_target (void);