1 /* Multi-process control for GDB, the GNU debugger.
3 Copyright (C) 2008-2022 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
25 #include "completer.h"
27 #include "gdbthread.h"
29 #include "observable.h"
32 #include "gdbsupport/environ.h"
33 #include "cli/cli-utils.h"
34 #include "arch-utils.h"
35 #include "target-descriptions.h"
36 #include "readline/tilde.h"
37 #include "progspace-and-thread.h"
38 #include "gdbsupport/buildargv.h"
39 #include "cli/cli-style.h"
41 /* Keep a registry of per-inferior data-pointers required by other GDB
44 DEFINE_REGISTRY (inferior
, REGISTRY_ACCESS_FIELD
)
46 intrusive_list
<inferior
> inferior_list
;
47 static int highest_inferior_num
;
50 bool print_inferior_events
= true;
52 /* The Current Inferior. This is a strong reference. I.e., whenever
53 an inferior is the current inferior, its refcount is
55 static inferior_ref current_inferior_
;
58 current_inferior (void)
60 return current_inferior_
.get ();
64 set_current_inferior (struct inferior
*inf
)
66 /* There's always an inferior. */
67 gdb_assert (inf
!= NULL
);
69 current_inferior_
= inferior_ref::new_reference (inf
);
72 private_inferior::~private_inferior () = default;
74 inferior::~inferior ()
78 m_continuations
.clear ();
79 inferior_free_data (inf
);
80 target_desc_info_free (inf
->tdesc_info
);
83 inferior::inferior (int pid_
)
84 : num (++highest_inferior_num
),
86 environment (gdb_environ::from_host_environ ()),
89 inferior_alloc_data (this);
91 m_target_stack
.push (get_dummy_target ());
97 inferior::unpush_target (struct target_ops
*t
)
99 /* If unpushing the process stratum target from the inferior while threads
100 exist in the inferior, ensure that we don't leave any threads of the
101 inferior in the target's "resumed with pending wait status" list.
103 See also the comment in set_thread_exited. */
104 if (t
->stratum () == process_stratum
)
106 process_stratum_target
*proc_target
= as_process_stratum_target (t
);
108 for (thread_info
*thread
: this->non_exited_threads ())
109 proc_target
->maybe_remove_resumed_with_pending_wait_status (thread
);
112 return m_target_stack
.unpush (t
);
116 inferior::set_tty (std::string terminal_name
)
118 m_terminal
= std::move (terminal_name
);
128 inferior::add_continuation (std::function
<void ()> &&cont
)
130 m_continuations
.emplace_front (std::move (cont
));
134 inferior::do_all_continuations ()
136 while (!m_continuations
.empty ())
138 auto iter
= m_continuations
.begin ();
140 m_continuations
.erase (iter
);
145 add_inferior_silent (int pid
)
147 inferior
*inf
= new inferior (pid
);
149 inferior_list
.push_back (*inf
);
151 gdb::observers::inferior_added
.notify (inf
);
154 inferior_appeared (inf
, pid
);
160 add_inferior (int pid
)
162 struct inferior
*inf
= add_inferior_silent (pid
);
164 if (print_inferior_events
)
167 gdb_printf (_("[New inferior %d (%s)]\n"),
169 target_pid_to_str (ptid_t (pid
)).c_str ());
171 gdb_printf (_("[New inferior %d]\n"), inf
->num
);
177 /* See inferior.h. */
180 inferior::clear_thread_list (bool silent
)
182 thread_list
.clear_and_dispose ([=] (thread_info
*thr
)
184 threads_debug_printf ("deleting thread %s, silent = %d",
185 thr
->ptid
.to_string ().c_str (), silent
);
186 set_thread_exited (thr
, silent
);
187 if (thr
->deletable ())
190 ptid_thread_map
.clear ();
194 delete_inferior (struct inferior
*inf
)
196 inf
->clear_thread_list (true);
198 auto it
= inferior_list
.iterator_to (*inf
);
199 inferior_list
.erase (it
);
201 gdb::observers::inferior_removed
.notify (inf
);
203 /* If this program space is rendered useless, remove it. */
204 if (inf
->pspace
->empty ())
210 /* If SILENT then be quiet -- don't announce a inferior exit, or the
211 exit of its threads. */
214 exit_inferior_1 (struct inferior
*inf
, int silent
)
216 inf
->clear_thread_list (silent
);
218 gdb::observers::inferior_exit
.notify (inf
);
221 inf
->fake_pid_p
= false;
224 if (inf
->vfork_parent
!= NULL
)
226 inf
->vfork_parent
->vfork_child
= NULL
;
227 inf
->vfork_parent
= NULL
;
229 if (inf
->vfork_child
!= NULL
)
231 inf
->vfork_child
->vfork_parent
= NULL
;
232 inf
->vfork_child
= NULL
;
235 inf
->pending_detach
= 0;
237 inf
->control
= inferior_control_state (NO_STOP_QUIETLY
);
239 /* Clear the register cache and the frame cache. */
240 registers_changed ();
241 reinit_frame_cache ();
245 exit_inferior (inferior
*inf
)
247 exit_inferior_1 (inf
, 0);
251 exit_inferior_silent (inferior
*inf
)
253 exit_inferior_1 (inf
, 1);
256 /* See inferior.h. */
259 detach_inferior (inferior
*inf
)
261 /* Save the pid, since exit_inferior_1 will reset it. */
264 exit_inferior_1 (inf
, 0);
266 if (print_inferior_events
)
267 gdb_printf (_("[Inferior %d (%s) detached]\n"),
269 target_pid_to_str (ptid_t (pid
)).c_str ());
273 inferior_appeared (struct inferior
*inf
, int pid
)
275 /* If this is the first inferior with threads, reset the global
277 delete_exited_threads ();
278 if (!any_thread_p ())
282 inf
->has_exit_code
= 0;
285 gdb::observers::inferior_appeared
.notify (inf
);
289 find_inferior_id (int num
)
291 for (inferior
*inf
: all_inferiors ())
299 find_inferior_pid (process_stratum_target
*targ
, int pid
)
301 /* Looking for inferior pid == 0 is always wrong, and indicative of
302 a bug somewhere else. There may be more than one with pid == 0,
304 gdb_assert (pid
!= 0);
306 for (inferior
*inf
: all_inferiors (targ
))
316 find_inferior_ptid (process_stratum_target
*targ
, ptid_t ptid
)
318 return find_inferior_pid (targ
, ptid
.pid ());
321 /* See inferior.h. */
324 find_inferior_for_program_space (struct program_space
*pspace
)
326 struct inferior
*cur_inf
= current_inferior ();
328 if (cur_inf
->pspace
== pspace
)
331 for (inferior
*inf
: all_inferiors ())
332 if (inf
->pspace
== pspace
)
339 have_inferiors (void)
341 for (inferior
*inf ATTRIBUTE_UNUSED
: all_non_exited_inferiors ())
347 /* Return the number of live inferiors. We account for the case
348 where an inferior might have a non-zero pid but no threads, as
349 in the middle of a 'mourn' operation. */
352 number_of_live_inferiors (process_stratum_target
*proc_target
)
356 for (inferior
*inf
: all_non_exited_inferiors (proc_target
))
357 if (inf
->has_execution ())
358 for (thread_info
*tp ATTRIBUTE_UNUSED
: inf
->non_exited_threads ())
360 /* Found a live thread in this inferior, go to the next
369 /* Return true if there is at least one live inferior. */
372 have_live_inferiors (void)
374 return number_of_live_inferiors (NULL
) > 0;
377 /* Prune away any unused inferiors, and then prune away no longer used
381 prune_inferiors (void)
383 for (inferior
*inf
: all_inferiors_safe ())
385 if (!inf
->deletable ()
390 delete_inferior (inf
);
394 /* Simply returns the count of inferiors. */
397 number_of_inferiors (void)
399 auto rng
= all_inferiors ();
400 return std::distance (rng
.begin (), rng
.end ());
403 /* Converts an inferior process id to a string. Like
404 target_pid_to_str, but special cases the null process. */
407 inferior_pid_to_str (int pid
)
410 return target_pid_to_str (ptid_t (pid
));
415 /* See inferior.h. */
418 print_selected_inferior (struct ui_out
*uiout
)
420 struct inferior
*inf
= current_inferior ();
421 const char *filename
= inf
->pspace
->exec_filename
.get ();
423 if (filename
== NULL
)
424 filename
= _("<noexec>");
426 uiout
->message (_("[Switching to inferior %d [%s] (%s)]\n"),
427 inf
->num
, inferior_pid_to_str (inf
->pid
).c_str (), filename
);
430 /* Helper for print_inferior. Returns the 'connection-id' string for
434 uiout_field_connection (process_stratum_target
*proc_target
)
436 if (proc_target
== NULL
)
440 else if (proc_target
->connection_string () != NULL
)
442 return string_printf ("%d (%s %s)",
443 proc_target
->connection_number
,
444 proc_target
->shortname (),
445 proc_target
->connection_string ());
449 return string_printf ("%d (%s)",
450 proc_target
->connection_number
,
451 proc_target
->shortname ());
455 /* Prints the list of inferiors and their details on UIOUT. This is a
456 version of 'info_inferior_command' suitable for use from MI.
458 If REQUESTED_INFERIORS is not NULL, it's a list of GDB ids of the
459 inferiors that should be printed. Otherwise, all inferiors are
463 print_inferior (struct ui_out
*uiout
, const char *requested_inferiors
)
466 size_t connection_id_len
= 20;
468 /* Compute number of inferiors we will print. */
469 for (inferior
*inf
: all_inferiors ())
471 if (!number_is_in_list (requested_inferiors
, inf
->num
))
474 std::string conn
= uiout_field_connection (inf
->process_target ());
475 if (connection_id_len
< conn
.size ())
476 connection_id_len
= conn
.size ();
483 uiout
->message ("No inferiors.\n");
487 ui_out_emit_table
table_emitter (uiout
, 5, inf_count
, "inferiors");
488 uiout
->table_header (1, ui_left
, "current", "");
489 uiout
->table_header (4, ui_left
, "number", "Num");
490 uiout
->table_header (17, ui_left
, "target-id", "Description");
491 uiout
->table_header (connection_id_len
, ui_left
,
492 "connection-id", "Connection");
493 uiout
->table_header (17, ui_left
, "exec", "Executable");
495 uiout
->table_body ();
497 /* Restore the current thread after the loop because we switch the
498 inferior in the loop. */
499 scoped_restore_current_pspace_and_thread restore_pspace_thread
;
500 inferior
*current_inf
= current_inferior ();
501 for (inferior
*inf
: all_inferiors ())
503 if (!number_is_in_list (requested_inferiors
, inf
->num
))
506 ui_out_emit_tuple
tuple_emitter (uiout
, NULL
);
508 if (inf
== current_inf
)
509 uiout
->field_string ("current", "*");
511 uiout
->field_skip ("current");
513 uiout
->field_signed ("number", inf
->num
);
515 /* Because target_pid_to_str uses the current inferior,
516 switch the inferior. */
517 switch_to_inferior_no_thread (inf
);
519 uiout
->field_string ("target-id", inferior_pid_to_str (inf
->pid
));
521 std::string conn
= uiout_field_connection (inf
->process_target ());
522 uiout
->field_string ("connection-id", conn
);
524 if (inf
->pspace
->exec_filename
!= nullptr)
525 uiout
->field_string ("exec", inf
->pspace
->exec_filename
.get (),
526 file_name_style
.style ());
528 uiout
->field_skip ("exec");
530 /* Print extra info that isn't really fit to always present in
531 tabular form. Currently we print the vfork parent/child
532 relationships, if any. */
533 if (inf
->vfork_parent
)
535 uiout
->text (_("\n\tis vfork child of inferior "));
536 uiout
->field_signed ("vfork-parent", inf
->vfork_parent
->num
);
538 if (inf
->vfork_child
)
540 uiout
->text (_("\n\tis vfork parent of inferior "));
541 uiout
->field_signed ("vfork-child", inf
->vfork_child
->num
);
549 detach_inferior_command (const char *args
, int from_tty
)
552 error (_("Requires argument (inferior id(s) to detach)"));
554 scoped_restore_current_thread restore_thread
;
556 number_or_range_parser
parser (args
);
557 while (!parser
.finished ())
559 int num
= parser
.get_number ();
561 inferior
*inf
= find_inferior_id (num
);
564 warning (_("Inferior ID %d not known."), num
);
570 warning (_("Inferior ID %d is not running."), num
);
574 thread_info
*tp
= any_thread_of_inferior (inf
);
577 warning (_("Inferior ID %d has no threads."), num
);
581 switch_to_thread (tp
);
583 detach_command (NULL
, from_tty
);
588 kill_inferior_command (const char *args
, int from_tty
)
591 error (_("Requires argument (inferior id(s) to kill)"));
593 scoped_restore_current_thread restore_thread
;
595 number_or_range_parser
parser (args
);
596 while (!parser
.finished ())
598 int num
= parser
.get_number ();
600 inferior
*inf
= find_inferior_id (num
);
603 warning (_("Inferior ID %d not known."), num
);
609 warning (_("Inferior ID %d is not running."), num
);
613 thread_info
*tp
= any_thread_of_inferior (inf
);
616 warning (_("Inferior ID %d has no threads."), num
);
620 switch_to_thread (tp
);
625 bfd_cache_close_all ();
628 /* See inferior.h. */
631 switch_to_inferior_no_thread (inferior
*inf
)
633 set_current_inferior (inf
);
634 switch_to_no_thread ();
635 set_current_program_space (inf
->pspace
);
639 inferior_command (const char *args
, int from_tty
)
641 struct inferior
*inf
;
646 inf
= current_inferior ();
647 gdb_assert (inf
!= nullptr);
648 const char *filename
= inf
->pspace
->exec_filename
.get ();
650 if (filename
== nullptr)
651 filename
= _("<noexec>");
653 gdb_printf (_("[Current inferior is %d [%s] (%s)]\n"),
654 inf
->num
, inferior_pid_to_str (inf
->pid
).c_str (),
659 num
= parse_and_eval_long (args
);
661 inf
= find_inferior_id (num
);
663 error (_("Inferior ID %d not known."), num
);
667 if (inf
!= current_inferior ())
669 thread_info
*tp
= any_thread_of_inferior (inf
);
671 error (_("Inferior has no threads."));
673 switch_to_thread (tp
);
676 gdb::observers::user_selected_context_changed
.notify
677 (USER_SELECTED_INFERIOR
678 | USER_SELECTED_THREAD
679 | USER_SELECTED_FRAME
);
683 switch_to_inferior_no_thread (inf
);
685 gdb::observers::user_selected_context_changed
.notify
686 (USER_SELECTED_INFERIOR
);
691 /* Print information about currently known inferiors. */
694 info_inferiors_command (const char *args
, int from_tty
)
696 print_inferior (current_uiout
, args
);
699 /* remove-inferior ID */
702 remove_inferior_command (const char *args
, int from_tty
)
704 if (args
== NULL
|| *args
== '\0')
705 error (_("Requires an argument (inferior id(s) to remove)"));
707 number_or_range_parser
parser (args
);
708 while (!parser
.finished ())
710 int num
= parser
.get_number ();
711 struct inferior
*inf
= find_inferior_id (num
);
715 warning (_("Inferior ID %d not known."), num
);
719 if (!inf
->deletable ())
721 warning (_("Can not remove current inferior %d."), num
);
727 warning (_("Can not remove active inferior %d."), num
);
731 delete_inferior (inf
);
736 add_inferior_with_spaces (void)
738 struct address_space
*aspace
;
739 struct program_space
*pspace
;
740 struct inferior
*inf
;
742 /* If all inferiors share an address space on this system, this
743 doesn't really return a new address space; otherwise, it
745 aspace
= maybe_new_address_space ();
746 pspace
= new program_space (aspace
);
747 inf
= add_inferior (0);
748 inf
->pspace
= pspace
;
749 inf
->aspace
= pspace
->aspace
;
751 /* Setup the inferior's initial arch, based on information obtained
752 from the global "set ..." options. */
754 inf
->gdbarch
= gdbarch_find_by_info (info
);
755 /* The "set ..." options reject invalid settings, so we should
756 always have a valid arch by now. */
757 gdb_assert (inf
->gdbarch
!= NULL
);
762 /* See inferior.h. */
765 switch_to_inferior_and_push_target (inferior
*new_inf
,
766 bool no_connection
, inferior
*org_inf
)
768 process_stratum_target
*proc_target
= org_inf
->process_target ();
770 /* Switch over temporarily, while reading executable and
772 switch_to_inferior_no_thread (new_inf
);
774 /* Reuse the target for new inferior. */
775 if (!no_connection
&& proc_target
!= NULL
)
777 new_inf
->push_target (proc_target
);
778 if (proc_target
->connection_string () != NULL
)
779 gdb_printf (_("Added inferior %d on connection %d (%s %s)\n"),
781 proc_target
->connection_number
,
782 proc_target
->shortname (),
783 proc_target
->connection_string ());
785 gdb_printf (_("Added inferior %d on connection %d (%s)\n"),
787 proc_target
->connection_number
,
788 proc_target
->shortname ());
791 gdb_printf (_("Added inferior %d\n"), new_inf
->num
);
794 /* add-inferior [-copies N] [-exec FILENAME] [-no-connection] */
797 add_inferior_command (const char *args
, int from_tty
)
800 gdb::unique_xmalloc_ptr
<char> exec
;
801 symfile_add_flags add_flags
= 0;
802 bool no_connection
= false;
805 add_flags
|= SYMFILE_VERBOSE
;
809 gdb_argv
built_argv (args
);
811 for (char **argv
= built_argv
.get (); *argv
!= NULL
; argv
++)
815 if (strcmp (*argv
, "-copies") == 0)
819 error (_("No argument to -copies"));
820 copies
= parse_and_eval_long (*argv
);
822 else if (strcmp (*argv
, "-no-connection") == 0)
823 no_connection
= true;
824 else if (strcmp (*argv
, "-exec") == 0)
828 error (_("No argument to -exec"));
829 exec
.reset (tilde_expand (*argv
));
833 error (_("Invalid argument"));
837 inferior
*orginf
= current_inferior ();
839 scoped_restore_current_pspace_and_thread restore_pspace_thread
;
841 for (i
= 0; i
< copies
; ++i
)
843 inferior
*inf
= add_inferior_with_spaces ();
845 switch_to_inferior_and_push_target (inf
, no_connection
, orginf
);
849 exec_file_attach (exec
.get (), from_tty
);
850 symbol_file_add_main (exec
.get (), add_flags
);
855 /* clone-inferior [-copies N] [ID] [-no-connection] */
858 clone_inferior_command (const char *args
, int from_tty
)
861 struct inferior
*orginf
= NULL
;
862 bool no_connection
= false;
866 gdb_argv
built_argv (args
);
868 char **argv
= built_argv
.get ();
869 for (; *argv
!= NULL
; argv
++)
873 if (strcmp (*argv
, "-copies") == 0)
877 error (_("No argument to -copies"));
878 copies
= parse_and_eval_long (*argv
);
881 error (_("Invalid copies number"));
883 else if (strcmp (*argv
, "-no-connection") == 0)
884 no_connection
= true;
892 /* The first non-option (-) argument specified the
894 num
= parse_and_eval_long (*argv
);
895 orginf
= find_inferior_id (num
);
898 error (_("Inferior ID %d not known."), num
);
902 error (_("Invalid argument"));
907 /* If no inferior id was specified, then the user wants to clone the
910 orginf
= current_inferior ();
912 scoped_restore_current_pspace_and_thread restore_pspace_thread
;
914 for (i
= 0; i
< copies
; ++i
)
916 struct address_space
*aspace
;
917 struct program_space
*pspace
;
918 struct inferior
*inf
;
920 /* If all inferiors share an address space on this system, this
921 doesn't really return a new address space; otherwise, it
923 aspace
= maybe_new_address_space ();
924 pspace
= new program_space (aspace
);
925 inf
= add_inferior (0);
926 inf
->pspace
= pspace
;
927 inf
->aspace
= pspace
->aspace
;
928 inf
->gdbarch
= orginf
->gdbarch
;
930 switch_to_inferior_and_push_target (inf
, no_connection
, orginf
);
932 /* If the original inferior had a user specified target
933 description, make the clone use it too. */
934 if (target_desc_info_from_user_p (inf
->tdesc_info
))
935 copy_inferior_target_desc_info (inf
, orginf
);
937 clone_program_space (pspace
, orginf
->pspace
);
939 /* Copy properties from the original inferior to the new one. */
940 inf
->set_args (orginf
->args ());
941 inf
->set_cwd (orginf
->cwd ());
942 inf
->set_tty (orginf
->tty ());
943 for (const std::string
&set_var
: orginf
->environment
.user_set_env ())
945 /* set_var has the form NAME=value. Split on the first '='. */
946 const std::string::size_type pos
= set_var
.find ('=');
947 gdb_assert (pos
!= std::string::npos
);
948 const std::string varname
= set_var
.substr (0, pos
);
950 (varname
.c_str (), orginf
->environment
.get (varname
.c_str ()));
952 for (const std::string
&unset_var
953 : orginf
->environment
.user_unset_env ())
954 inf
->environment
.unset (unset_var
.c_str ());
958 /* Print notices when new inferiors are created and die. */
960 show_print_inferior_events (struct ui_file
*file
, int from_tty
,
961 struct cmd_list_element
*c
, const char *value
)
963 gdb_printf (file
, _("Printing of inferior events is %s.\n"), value
);
966 /* Return a new value for the selected inferior's id. */
968 static struct value
*
969 inferior_id_make_value (struct gdbarch
*gdbarch
, struct internalvar
*var
,
972 struct inferior
*inf
= current_inferior ();
974 return value_from_longest (builtin_type (gdbarch
)->builtin_int
, inf
->num
);
977 /* Implementation of `$_inferior' variable. */
979 static const struct internalvar_funcs inferior_funcs
=
981 inferior_id_make_value
,
988 initialize_inferiors (void)
990 struct cmd_list_element
*c
= NULL
;
992 /* There's always one inferior. Note that this function isn't an
993 automatic _initialize_foo function, since other _initialize_foo
994 routines may need to install their per-inferior data keys. We
995 can only allocate an inferior when all those modules have done
996 that. Do this after initialize_progspace, due to the
997 current_program_space reference. */
998 set_current_inferior (add_inferior_silent (0));
999 current_inferior_
->pspace
= current_program_space
;
1000 current_inferior_
->aspace
= current_program_space
->aspace
;
1001 /* The architecture will be initialized shortly, by
1002 initialize_current_architecture. */
1004 add_info ("inferiors", info_inferiors_command
,
1005 _("Print a list of inferiors being managed.\n\
1006 Usage: info inferiors [ID]...\n\
1007 If IDs are specified, the list is limited to just those inferiors.\n\
1008 By default all inferiors are displayed."));
1010 c
= add_com ("add-inferior", no_class
, add_inferior_command
, _("\
1011 Add a new inferior.\n\
1012 Usage: add-inferior [-copies N] [-exec FILENAME] [-no-connection]\n\
1013 N is the optional number of inferiors to add, default is 1.\n\
1014 FILENAME is the file name of the executable to use\n\
1016 By default, the new inferior inherits the current inferior's connection.\n\
1017 If -no-connection is specified, the new inferior begins with\n\
1018 no target connection yet."));
1019 set_cmd_completer (c
, filename_completer
);
1021 add_com ("remove-inferiors", no_class
, remove_inferior_command
, _("\
1022 Remove inferior ID (or list of IDs).\n\
1023 Usage: remove-inferiors ID..."));
1025 add_com ("clone-inferior", no_class
, clone_inferior_command
, _("\
1026 Clone inferior ID.\n\
1027 Usage: clone-inferior [-copies N] [-no-connection] [ID]\n\
1028 Add N copies of inferior ID. The new inferiors have the same\n\
1029 executable loaded as the copied inferior. If -copies is not specified,\n\
1030 adds 1 copy. If ID is not specified, it is the current inferior\n\
1032 By default, the new inferiors inherit the copied inferior's connection.\n\
1033 If -no-connection is specified, the new inferiors begin with\n\
1034 no target connection yet."));
1036 add_cmd ("inferiors", class_run
, detach_inferior_command
, _("\
1037 Detach from inferior ID (or list of IDS).\n\
1038 Usage; detach inferiors ID..."),
1041 add_cmd ("inferiors", class_run
, kill_inferior_command
, _("\
1042 Kill inferior ID (or list of IDs).\n\
1043 Usage: kill inferiors ID..."),
1046 add_cmd ("inferior", class_run
, inferior_command
, _("\
1047 Use this command to switch between inferiors.\n\
1048 Usage: inferior ID\n\
1049 The new inferior ID must be currently known."),
1052 add_setshow_boolean_cmd ("inferior-events", no_class
,
1053 &print_inferior_events
, _("\
1054 Set printing of inferior events (such as inferior start and exit)."), _("\
1055 Show printing of inferior events (such as inferior start and exit)."), NULL
,
1057 show_print_inferior_events
,
1058 &setprintlist
, &showprintlist
);
1060 create_internalvar_type_lazy ("_inferior", &inferior_funcs
, NULL
);