37 #include "readline/tilde.h"
77 struct inferior *saved_inferior = arg;
99 inferior_free_data (inf);
132 memset (inf, 0,
sizeof (*inf));
144 inferior_alloc_data (inf);
211 infprev->next = inf->next;
385 if (inf->
pspace == pspace)
390 if (inf->
pspace == pspace)
406 if ((*callback) (inf, data))
442 return inferior->
pid;
611 ui_out_text (uiout,
_(
"\n\tis vfork child of inferior "));
616 ui_out_text (uiout,
_(
"\n\tis vfork parent of inferior "));
635 error (
_(
"Requires argument (inferior id(s) to detach)"));
644 warning (
_(
"Inferior ID %d not known."), num);
653 warning (
_(
"Inferior ID %d has no threads."), num);
671 error (
_(
"Requires argument (inferior id(s) to kill)"));
680 warning (
_(
"Inferior ID %d not known."), num);
689 warning (
_(
"Inferior ID %d has no threads."), num);
698 bfd_cache_close_all ();
711 error (
_(
"Inferior ID %d not known."), num);
728 error (
_(
"Inferior has no threads."));
749 else if (inf->
pid != 0)
773 if (args == NULL || *args ==
'\0')
774 error (
_(
"Requires an argument (inferior id(s) to remove)"));
784 warning (
_(
"Inferior ID %d not known."), num);
790 warning (
_(
"Can not remove current symbol inferior %d."), num);
796 warning (
_(
"Can not remove active inferior %d."), num);
849 for (; *argv != NULL; argv++)
853 if (strcmp (*argv,
"-copies") == 0)
857 error (
_(
"No argument to -copies"));
860 else if (strcmp (*argv,
"-exec") == 0)
864 error (
_(
"No argument to -exec"));
865 exec = tilde_expand (*argv);
870 error (
_(
"Invalid argument"));
876 for (i = 0; i < copies; ++i)
913 for (; *argv != NULL; argv++)
917 if (strcmp (*argv,
"-copies") == 0)
921 error (
_(
"No argument to -copies"));
925 error (
_(
"Invalid copies number"));
940 error (
_(
"Inferior ID %d not known."), num);
944 error (
_(
"Invalid argument"));
956 for (i = 0; i < copies; ++i)
1015 _(
"IDs of specified inferiors (all inferiors if no argument)."));
1018 Add a new inferior.\n\
1019 Usage: add-inferior [-copies <N>] [-exec <FILENAME>]\n\
1020 N is the optional number of inferiors to add, default is 1.\n\
1021 FILENAME is the file name of the executable to use\n\
1022 as main program."));
1026 Remove inferior ID (or list of IDs).\n\
1027 Usage: remove-inferiors ID..."));
1030 Clone inferior ID.\n\
1031 Usage: clone-inferior [-copies <N>] [ID]\n\
1032 Add N copies of inferior ID. The new inferior has the same\n\
1033 executable loaded as the copied inferior. If -copies is not specified,\n\
1034 adds 1 copy. If ID is not specified, it is the current inferior\n\
1038 Detach from inferior ID (or list of IDS)."),
1042 Kill inferior ID (or list of IDs)."),
1046 Use this command to switch between inferiors.\n\
1047 The new inferior ID must be currently known."),
1052 Set printing of inferior events (e.g., inferior start and exit)."),
_(
"\
1053 Show printing of inferior events (e.g., inferior start and exit)."), NULL,
void init_inferior_list(void)
static int delete_thread_of_inferior(struct thread_info *tp, void *data)
struct cleanup * make_cleanup_freeargv(char **arg)
int have_live_inferiors(void)
static void free_inferior(struct inferior *inf)
struct address_space * maybe_new_address_space(void)
void _initialize_inferiors(void)
struct frame_info * get_selected_frame(const char *message)
void delete_inferior_silent(int pid)
static void restore_inferior(void *arg)
int valid_gdb_inferior_id(int num)
#define DEFINE_REGISTRY(TAG, ACCESS)
void ui_out_field_int(struct ui_out *uiout, const char *fldname, int value)
struct address_space * aspace
void delete_thread(ptid_t)
struct target_desc_info * tdesc_info
static void print_inferior(struct ui_out *uiout, char *requested_inferiors)
int number_is_in_list(const char *list, int number)
void copy_inferior_target_desc_info(struct inferior *destinf, struct inferior *srcinf)
static void info_inferiors_command(char *args, int from_tty)
void warning(const char *fmt,...)
int target_desc_info_from_user_p(struct target_desc_info *info)
struct cleanup * make_cleanup_ui_out_table_begin_end(struct ui_out *ui_out, int nr_cols, int nr_rows, const char *tblid)
void delete_thread_silent(ptid_t)
struct inferior * add_inferior_silent(int pid)
struct gdbarch * gdbarch_find_by_info(struct gdbarch_info info)
#define REGISTRY_ACCESS_FIELD(CONTAINER)
void switch_to_thread(ptid_t ptid)
void init_environ(struct gdb_environ *e)
struct inferior * find_inferior_ptid(ptid_t ptid)
static void remove_inferior_command(char *args, int from_tty)
struct cmd_list_element * cmdlist
struct inferior * iterate_over_inferiors(int(*callback)(struct inferior *, void *), void *data)
char * target_pid_to_str(ptid_t ptid)
int number_of_inferiors(void)
static void detach_inferior_command(char *args, int from_tty)
int target_has_execution_1(ptid_t the_ptid)
void ui_out_text(struct ui_out *uiout, const char *string)
struct cleanup * save_current_inferior(void)
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
void free_environ(struct gdb_environ *e)
void null_cleanup(void *arg)
struct thread_info * iterate_over_threads(thread_callback_func, void *)
static void kill_inferior_command(char *args, int from_tty)
static void add_inferior_command(char *args, int from_tty)
void discard_all_inferior_continuations(struct inferior *inf)
struct address_space * aspace
void ui_out_field_skip(struct ui_out *uiout, const char *fldname)
struct gdb_environ * make_environ(void)
static int highest_inferior_num
struct cleanup * make_cleanup_ui_out_tuple_begin_end(struct ui_out *uiout, const char *id)
struct program_space * pspace
void fprintf_filtered(struct ui_file *stream, const char *format,...)
struct gdb_environ * environment
void set_cmd_completer(struct cmd_list_element *cmd, completer_ftype *completer)
struct inferior * add_inferior(int pid)
void ui_out_message(struct ui_out *uiout, int verbosity, const char *format,...)
struct inferior_control_state control
void discard_all_inferiors(void)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc, struct cmd_list_element **list)
ptid_t pid_to_ptid(int pid)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
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 void clone_inferior_command(char *args, int from_tty)
struct cmd_list_element * add_info(const char *name, cmd_cfunc_ftype *fun, const char *doc)
static struct inferior * current_inferior_
static void inferior_command(char *args, int from_tty)
struct cmd_list_element * setprintlist
void exit_inferior(int pid)
static char * inferior_pid_to_str(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)
struct inferior * vfork_child
void symbol_file_add_main(const char *args, int from_tty)
struct program_space * clone_program_space(struct program_space *dest, struct program_space *src)
int ptid_get_pid(ptid_t ptid)
void print_stack_frame(struct frame_info *, int print_level, enum print_what print_what, int set_current_sal)
void exec_file_attach(const char *filename, int from_tty)
int in_inferior_list(int pid)
struct cmd_list_element * detachlist
void delete_inferior(int pid)
void gdbarch_info_init(struct gdbarch_info *info)
void detach_inferior(int pid)
char * pspace_exec_filename
char ** gdb_buildargv(const char *s)
void ui_out_table_header(struct ui_out *uiout, int width, enum ui_align alignment, const char *col_name, const char *colhdr)
void initialize_inferiors(void)
int gdb_inferior_id_to_pid(int num)
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)
int pid_to_thread_id(ptid_t ptid)
struct cleanup * save_current_space_and_thread(void)
struct inferior * find_inferior_for_program_space(struct program_space *pspace)
struct private_inferior * priv
void ui_out_field_string(struct ui_out *uiout, const char *fldname, const char *string)
void ui_out_table_body(struct ui_out *uiout)
struct cmd_list_element * killlist
void prune_program_spaces(void)
struct ui_out * current_uiout
int is_running(ptid_t ptid)
int get_number_or_range(struct get_number_or_range_state *state)
struct inferior * vfork_parent
void delete_inferior_1(struct inferior *todel, int silent)
struct thread_info * any_thread_of_process(int pid)
void error(const char *fmt,...)
struct cmd_list_element * add_com(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc)
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t int int rusage_t pid_t pid
void set_current_inferior(struct inferior *inf)
void observer_notify_inferior_appeared(struct inferior *inf)
void inferior_appeared(struct inferior *inf, int pid)
void init_number_or_range(struct get_number_or_range_state *state, const char *string)
void do_cleanups(struct cleanup *old_chain)
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_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
void detach_command(char *args, int from_tty)
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)