37 #include "readline/tilde.h" 81 inferior_free_data (
inf);
93 inferior_alloc_data (
this);
175 infprev->next =
inf->next;
215 if (
inf->vfork_parent != NULL)
217 inf->vfork_parent->vfork_child = NULL;
218 inf->vfork_parent = NULL;
220 if (
inf->vfork_child != NULL)
222 inf->vfork_child->vfork_parent = NULL;
223 inf->vfork_child = NULL;
226 inf->pending_detach = 0;
271 inf->has_exit_code = 0;
354 if ((*callback) (
inf, data))
515 const char *filename =
inf->pspace->pspace_exec_filename;
517 if (filename == NULL)
518 filename =
_(
"<noexec>");
520 uiout->
message (
_(
"[Switching to inferior %d [%s] (%s)]\n"),
548 uiout->
message (
"No inferiors.\n");
575 if (
inf->pspace->pspace_exec_filename != NULL)
583 if (
inf->vfork_parent)
585 uiout->
text (
_(
"\n\tis vfork child of inferior "));
586 uiout->
field_int (
"vfork-parent",
inf->vfork_parent->num);
588 if (
inf->vfork_child)
590 uiout->
text (
_(
"\n\tis vfork parent of inferior "));
591 uiout->
field_int (
"vfork-child",
inf->vfork_child->num);
604 error (
_(
"Requires argument (inferior id(s) to detach)"));
613 warning (
_(
"Inferior ID %d not known."), num);
620 warning (
_(
"Inferior ID %d is not running."), num);
627 warning (
_(
"Inferior ID %d has no threads."), num);
643 error (
_(
"Requires argument (inferior id(s) to kill)"));
652 warning (
_(
"Inferior ID %d not known."), num);
659 warning (
_(
"Inferior ID %d is not running."), num);
666 warning (
_(
"Inferior ID %d has no threads."), num);
675 bfd_cache_close_all ();
688 error (
_(
"Inferior ID %d not known."),
num);
698 error (
_(
"Inferior has no threads."));
731 if (args == NULL || *args ==
'\0')
732 error (
_(
"Requires an argument (inferior id(s) to remove)"));
746 if (!
inf->deletable ())
748 warning (
_(
"Can not remove current inferior %d."),
num);
754 warning (
_(
"Can not remove active inferior %d."),
num);
776 inf->pspace = pspace;
797 symfile_add_flags add_flags = 0;
810 if (strcmp (*
argv,
"-copies") == 0)
814 error (
_(
"No argument to -copies"));
817 else if (strcmp (*
argv,
"-exec") == 0)
821 error (
_(
"No argument to -exec"));
822 exec.reset (tilde_expand (*
argv));
826 error (
_(
"Invalid argument"));
832 for (i = 0; i < copies; ++i)
864 char **
argv = built_argv.
get ();
869 if (strcmp (*
argv,
"-copies") == 0)
873 error (
_(
"No argument to -copies"));
877 error (
_(
"Invalid copies number"));
892 error (
_(
"Inferior ID %d not known."),
num);
896 error (
_(
"Invalid argument"));
908 for (i = 0; i < copies; ++i)
947 static struct value *
986 _(
"IDs of specified inferiors (all inferiors if no argument)."));
989 Add a new inferior.\n\ 990 Usage: add-inferior [-copies <N>] [-exec <FILENAME>]\n\ 991 N is the optional number of inferiors to add, default is 1.\n\ 992 FILENAME is the file name of the executable to use\n\ 997 Remove inferior ID (or list of IDs).\n\ 998 Usage: remove-inferiors ID..."));
1001 Clone inferior ID.\n\ 1002 Usage: clone-inferior [-copies <N>] [ID]\n\ 1003 Add N copies of inferior ID. The new inferior has the same\n\ 1004 executable loaded as the copied inferior. If -copies is not specified,\n\ 1005 adds 1 copy. If ID is not specified, it is the current inferior\n\ 1009 Detach from inferior ID (or list of IDS)."),
1013 Kill inferior ID (or list of IDs)."),
1017 Use this command to switch between inferiors.\n\ 1018 The new inferior ID must be currently known."),
1023 Set printing of inferior events (e.g., inferior start and exit)."),
_(
"\ 1024 Show printing of inferior events (e.g., inferior start and exit)."), NULL,
static void clone_inferior_command(const char *args, int from_tty)
static int delete_thread_of_inferior(struct thread_info *tp, void *data)
static void info_inferiors_command(const char *args, int from_tty)
int have_live_inferiors(void)
struct address_space * maybe_new_address_space(void)
void detach_command(const char *args, int from_tty)
int valid_gdb_inferior_id(int num)
#define DEFINE_REGISTRY(TAG, ACCESS)
void field_string(const char *fldname, const char *string)
struct address_space * aspace
int ptid_get_pid(const ptid_t &ptid)
void delete_thread(ptid_t)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int int rusage_t pid_t pid
static void detach_inferior_command(const char *args, int from_tty)
int number_is_in_list(const char *list, int number)
void copy_inferior_target_desc_info(struct inferior *destinf, struct inferior *srcinf)
void warning(const char *fmt,...)
int target_desc_info_from_user_p(struct target_desc_info *info)
void delete_thread_silent(ptid_t)
struct inferior * add_inferior_silent(int pid)
void field_skip(const char *fldname)
struct cmd_list_element * add_info(const char *name, cmd_const_cfunc_ftype *fun, const char *doc)
struct gdbarch * gdbarch_find_by_info(struct gdbarch_info info)
void table_header(int width, ui_align align, const std::string &col_name, const std::string &col_hdr)
#define REGISTRY_ACCESS_FIELD(CONTAINER)
void observer_notify_user_selected_context_changed(user_selected_what selection)
static void remove_inferior_command(const char *args, int from_tty)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **list)
void filename_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word)
void symbol_file_add_main(const char *args, symfile_add_flags add_flags)
struct inferior * find_inferior_ptid(ptid_t ptid)
struct cmd_list_element * cmdlist
struct inferior * iterate_over_inferiors(int(*callback)(struct inferior *, void *), void *data)
int program_space_empty_p(struct program_space *pspace)
void delete_program_space(struct program_space *pspace)
static const struct internalvar_funcs inferior_funcs
int number_of_inferiors(void)
int target_has_execution_1(ptid_t the_ptid)
static void inferior_command(const char *args, int from_tty)
void text(const char *string)
struct address_space * aspace
void observer_notify_inferior_added(struct inferior *inf)
void printf_filtered(const char *format,...)
struct program_space * add_program_space(struct address_space *aspace)
void set_current_program_space(struct program_space *pspace)
static int print_inferior_events
struct program_space * pspace
struct thread_info * iterate_over_threads(thread_callback_func, void *)
void switch_to_thread(ptid_t ptid)
void discard_all_inferior_continuations(struct inferior *inf)
std::unique_ptr< T, xfree_deleter< T > > unique_xmalloc_ptr
static int highest_inferior_num
void delete_inferior(struct inferior *todel)
void fprintf_filtered(struct ui_file *stream, const char *format,...)
void set_cmd_completer(struct cmd_list_element *cmd, completer_ftype *completer)
struct inferior * add_inferior(int pid)
static void print_inferior(struct ui_out *uiout, const char *requested_inferiors)
void discard_all_inferiors(void)
ptid_t pid_to_ptid(int pid)
void prune_inferiors(void)
struct inferior * find_inferior_pid(int pid)
struct inferior * inferior_list
static void show_print_inferior_events(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static struct inferior * current_inferior_
struct value * value_from_longest(struct type *type, LONGEST num)
struct cmd_list_element * setprintlist
void exit_inferior(int pid)
void printf_unfiltered(const char *format,...)
int pid_to_gdb_inferior_id(int pid)
void observer_notify_inferior_removed(struct inferior *inf)
void target_desc_info_free(struct target_desc_info *tdesc_info)
virtual ~private_inferior()=0
int number_of_live_inferiors(void)
void print_selected_inferior(struct ui_out *uiout)
struct program_space * clone_program_space(struct program_space *dest, struct program_space *src)
static void kill_inferior_command(const char *args, int from_tty)
void exec_file_attach(const char *filename, int from_tty)
int in_inferior_list(int pid)
struct cmd_list_element * detachlist
#define ALL_NON_EXITED_THREADS(T)
void field_int(const char *fldname, int value)
void gdbarch_info_init(struct gdbarch_info *info)
void detach_inferior(int pid)
const char * target_pid_to_str(ptid_t ptid)
void add_setshow_boolean_cmd(const char *name, enum command_class theclass, int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
void initialize_inferiors(void)
int gdb_inferior_id_to_pid(int num)
void message(const char *format,...) ATTRIBUTE_PRINTF(2
struct inferior * add_inferior_with_spaces(void)
void exit_inferior_num_silent(int num)
struct inferior * find_inferior_id(int num)
struct cmd_list_element * showprintlist
struct inferior * current_inferior(void)
struct program_space * current_program_space
void exit_inferior_silent(int pid)
static int ignore(struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
static void add_inferior_command(const char *args, int from_tty)
struct inferior * find_inferior_for_program_space(struct program_space *pspace)
struct cmd_list_element * killlist
struct cmd_list_element * add_com(const char *name, enum command_class theclass, cmd_const_cfunc_ftype *fun, const char *doc)
static const char * inferior_pid_to_str(int pid)
struct internalvar * create_internalvar_type_lazy(const char *name, const struct internalvar_funcs *funcs, void *data)
struct thread_info * any_thread_of_process(int pid)
void error(const char *fmt,...)
void set_current_inferior(struct inferior *inf)
void observer_notify_inferior_appeared(struct inferior *inf)
void inferior_appeared(struct inferior *inf, int pid)
static struct value * inferior_id_make_value(struct gdbarch *gdbarch, struct internalvar *var, void *ignore)
static void exit_inferior_1(struct inferior *inftoex, int silent)
void observer_notify_inferior_exit(struct inferior *inf)
LONGEST parse_and_eval_long(const char *exp)