+
+struct private_inferior;
+
+/* GDB represents the state of each program execution with an object
+ called an inferior. An inferior typically corresponds to a process
+ but is more general and applies also to targets that do not have a
+ notion of processes. Each run of an executable creates a new
+ inferior, as does each attachment to an existing process.
+ Inferiors have unique internal identifiers that are different from
+ target process ids. Each inferior may in turn have multiple
+ threads running in it. */
+
+struct inferior
+{
+ /* Pointer to next inferior in singly-linked list of inferiors. */
+ struct inferior *next;
+
+ /* Convenient handle (GDB inferior id). Unique across all
+ inferiors. */
+ int num;
+
+ /* Actual target inferior id, usually, a process id. This matches
+ the ptid_t.pid member of threads of this inferior. */
+ int pid;
+
+ /* True if this was an auto-created inferior, e.g. created from
+ following a fork; false, if this inferior was manually added by
+ the user, and we should not attempt to prune it
+ automatically. */
+ int removable;
+
+ /* The address space bound to this inferior. */
+ struct address_space *aspace;
+
+ /* The program space bound to this inferior. */
+ struct program_space *pspace;
+
+ /* The arguments string to use when running. */
+ char *args;
+
+ /* The size of elements in argv. */
+ int argc;
+
+ /* The vector version of arguments. If ARGC is nonzero,
+ then we must compute ARGS from this (via the target).
+ This is always coming from main's argv and therefore
+ should never be freed. */
+ char **argv;
+
+ /* The name of terminal device to use for I/O. */
+ char *terminal;
+
+ /* Environment to use for running inferior,
+ in format described in environ.h. */
+ struct gdb_environ *environment;
+
+ /* See the definition of stop_kind above. */
+ enum stop_kind stop_soon;
+
+ /* Nonzero if this child process was attached rather than
+ forked. */
+ int attach_flag;
+
+ /* If this inferior is a vfork child, then this is the pointer to
+ its vfork parent, if GDB is still attached to it. */
+ struct inferior *vfork_parent;
+
+ /* If this process is a vfork parent, this is the pointer to the
+ child. Since a vfork parent is left frozen by the kernel until
+ the child execs or exits, a process can only have one vfork child
+ at a given time. */
+ struct inferior *vfork_child;
+
+ /* True if this inferior should be detached when it's vfork sibling
+ exits or execs. */
+ int pending_detach;
+
+ /* True if this inferior is a vfork parent waiting for a vfork child
+ not under our control to be done with the shared memory region,
+ either by exiting or execing. */
+ int waiting_for_vfork_done;
+
+ /* True if we're in the process of detaching from this inferior. */
+ int detaching;
+
+ /* What is left to do for an execution command after any thread of
+ this inferior stops. For continuations associated with a
+ specific thread, see `struct thread_info'. */
+ struct continuation *continuations;
+
+ /* Private data used by the target vector implementation. */
+ struct private_inferior *private;
+
+ /* We keep a count of the number of times the user has requested a
+ particular syscall to be tracked, and pass this information to the
+ target. This lets capable targets implement filtering directly. */
+
+ /* Number of times that "any" syscall is requested. */
+ int any_syscall_count;
+
+ /* Count of each system call. */
+ VEC(int) *syscalls_counts;
+
+ /* This counts all syscall catch requests, so we can readily determine
+ if any catching is necessary. */
+ int total_syscalls_count;
+
+ /* Per inferior data-pointers required by other GDB modules. */
+ void **data;
+ unsigned num_data;
+};
+
+/* Keep a registry of per-inferior data-pointers required by other GDB
+ modules. */
+
+extern const struct inferior_data *register_inferior_data (void);
+extern const struct inferior_data *register_inferior_data_with_cleanup
+ (void (*cleanup) (struct inferior *, void *));
+extern void clear_inferior_data (struct inferior *inf);
+extern void set_inferior_data (struct inferior *inf,
+ const struct inferior_data *data, void *value);
+extern void *inferior_data (struct inferior *inf,
+ const struct inferior_data *data);
+
+/* Create an empty inferior list, or empty the existing one. */
+extern void init_inferior_list (void);
+
+/* Add an inferior to the inferior list, print a message that a new
+ inferior is found, and return the pointer to the new inferior.
+ Caller may use this pointer to initialize the private inferior
+ data. */
+extern struct inferior *add_inferior (int pid);
+
+/* Same as add_inferior, but don't print new inferior notifications to
+ the CLI. */
+extern struct inferior *add_inferior_silent (int pid);
+
+/* Delete an existing inferior list entry, due to inferior exit. */
+extern void delete_inferior (int pid);
+
+extern void delete_inferior_1 (struct inferior *todel, int silent);
+
+/* Same as delete_inferior, but don't print new inferior notifications
+ to the CLI. */
+extern void delete_inferior_silent (int pid);
+
+/* Delete an existing inferior list entry, due to inferior detaching. */
+extern void detach_inferior (int pid);
+
+extern void exit_inferior (int pid);
+
+extern void exit_inferior_silent (int pid);
+
+extern void exit_inferior_num_silent (int num);
+
+extern void inferior_appeared (struct inferior *inf, int pid);
+
+/* Get rid of all inferiors. */
+extern void discard_all_inferiors (void);
+
+/* Translate the integer inferior id (GDB's homegrown id, not the system's)
+ into a "pid" (which may be overloaded with extra inferior information). */
+extern int gdb_inferior_id_to_pid (int);
+
+/* Translate a target 'pid' into the integer inferior id (GDB's
+ homegrown id, not the system's). */
+extern int pid_to_gdb_inferior_id (int pid);
+
+/* Boolean test for an already-known pid. */
+extern int in_inferior_list (int pid);
+
+/* Boolean test for an already-known inferior id (GDB's homegrown id,
+ not the system's). */
+extern int valid_gdb_inferior_id (int num);
+
+/* Search function to lookup an inferior by target 'pid'. */
+extern struct inferior *find_inferior_pid (int pid);
+
+/* Search function to lookup an inferior by GDB 'num'. */
+extern struct inferior *find_inferior_id (int num);
+
+/* Find an inferior bound to PSPACE. */
+extern struct inferior *
+ find_inferior_for_program_space (struct program_space *pspace);
+
+/* Inferior iterator function.
+
+ Calls a callback function once for each inferior, so long as the
+ callback function returns false. If the callback function returns
+ true, the iteration will end and the current inferior will be
+ returned. This can be useful for implementing a search for a
+ inferior with arbitrary attributes, or for applying some operation
+ to every inferior.
+
+ It is safe to delete the iterated inferior from the callback. */
+extern struct inferior *iterate_over_inferiors (int (*) (struct inferior *,
+ void *),
+ void *);
+
+/* Prints the list of inferiors and their details on UIOUT.
+
+ If REQUESTED_INFERIOR is not -1, it's the GDB id of the inferior
+ that should be printed. Otherwise, all inferiors are printed. */
+extern void print_inferior (struct ui_out *uiout, int requested_inferior);
+
+/* Returns true if the inferior list is not empty. */
+extern int have_inferiors (void);
+
+/* Returns true if there are any live inferiors in the inferior list
+ (not cores, not executables, real live processes). */
+extern int have_live_inferiors (void);
+
+/* Return a pointer to the current inferior. It is an error to call
+ this if there is no current inferior. */
+extern struct inferior *current_inferior (void);
+
+extern void set_current_inferior (struct inferior *);
+
+extern struct cleanup *save_current_inferior (void);
+
+extern struct inferior *inferior_list;
+
+/* Prune away automatically added inferiors that aren't required
+ anymore. */
+extern void prune_inferiors (void);
+
+extern int number_of_inferiors (void);
+
+extern struct inferior *add_inferior_with_spaces (void);
+