Change inferior thread list to be a thread map
[deliverable/binutils-gdb.git] / gdb / inferior.c
1 /* Multi-process control for GDB, the GNU debugger.
2
3 Copyright (C) 2008-2019 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
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.
11
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.
16
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/>. */
19
20 #include "defs.h"
21 #include "exec.h"
22 #include "inferior.h"
23 #include "target.h"
24 #include "command.h"
25 #include "completer.h"
26 #include "gdbcmd.h"
27 #include "gdbthread.h"
28 #include "ui-out.h"
29 #include "observable.h"
30 #include "gdbcore.h"
31 #include "symfile.h"
32 #include "gdbsupport/environ.h"
33 #include "cli/cli-utils.h"
34 #include "continuations.h"
35 #include "arch-utils.h"
36 #include "target-descriptions.h"
37 #include "readline/tilde.h"
38 #include "progspace-and-thread.h"
39
40 /* Keep a registry of per-inferior data-pointers required by other GDB
41 modules. */
42
43 DEFINE_REGISTRY (inferior, REGISTRY_ACCESS_FIELD)
44
45 struct inferior *inferior_list = NULL;
46 static int highest_inferior_num;
47
48 /* See inferior.h. */
49 bool print_inferior_events = true;
50
51 /* The Current Inferior. This is a strong reference. I.e., whenever
52 an inferior is the current inferior, its refcount is
53 incremented. */
54 static struct inferior *current_inferior_ = NULL;
55
56 struct inferior*
57 current_inferior (void)
58 {
59 return current_inferior_;
60 }
61
62 void
63 set_current_inferior (struct inferior *inf)
64 {
65 /* There's always an inferior. */
66 gdb_assert (inf != NULL);
67
68 inf->incref ();
69 current_inferior_->decref ();
70 current_inferior_ = inf;
71 }
72
73 private_inferior::~private_inferior () = default;
74
75 inferior::~inferior ()
76 {
77 inferior *inf = this;
78
79 discard_all_inferior_continuations (inf);
80 inferior_free_data (inf);
81 xfree (inf->args);
82 xfree (inf->terminal);
83 target_desc_info_free (inf->tdesc_info);
84 }
85
86 inferior::inferior (int pid_)
87 : num (++highest_inferior_num),
88 pid (pid_),
89 environment (gdb_environ::from_host_environ ()),
90 registry_data ()
91 {
92 inferior_alloc_data (this);
93 }
94
95 struct inferior *
96 add_inferior_silent (int pid)
97 {
98 inferior *inf = new inferior (pid);
99
100 if (inferior_list == NULL)
101 inferior_list = inf;
102 else
103 {
104 inferior *last;
105
106 for (last = inferior_list; last->next != NULL; last = last->next)
107 ;
108 last->next = inf;
109 }
110
111 gdb::observers::inferior_added.notify (inf);
112
113 if (pid != 0)
114 inferior_appeared (inf, pid);
115
116 return inf;
117 }
118
119 struct inferior *
120 add_inferior (int pid)
121 {
122 struct inferior *inf = add_inferior_silent (pid);
123
124 if (print_inferior_events)
125 {
126 if (pid != 0)
127 printf_unfiltered (_("[New inferior %d (%s)]\n"),
128 inf->num,
129 target_pid_to_str (ptid_t (pid)).c_str ());
130 else
131 printf_unfiltered (_("[New inferior %d]\n"), inf->num);
132 }
133
134 return inf;
135 }
136
137 void
138 delete_inferior (struct inferior *todel)
139 {
140 struct inferior *inf, *infprev;
141
142 infprev = NULL;
143
144 for (inf = inferior_list; inf; infprev = inf, inf = inf->next)
145 if (inf == todel)
146 break;
147
148 if (!inf)
149 return;
150
151 for (thread_info *tp : inf->threads ())
152 delete_thread_silent_noremove (tp);
153
154 if (infprev)
155 infprev->next = inf->next;
156 else
157 inferior_list = inf->next;
158
159 gdb::observers::inferior_removed.notify (inf);
160
161 /* If this program space is rendered useless, remove it. */
162 if (program_space_empty_p (inf->pspace))
163 delete_program_space (inf->pspace);
164
165 delete inf;
166 }
167
168 /* If SILENT then be quiet -- don't announce a inferior exit, or the
169 exit of its threads. */
170
171 static void
172 exit_inferior_1 (struct inferior *inftoex, int silent)
173 {
174 struct inferior *inf;
175
176 for (inf = inferior_list; inf; inf = inf->next)
177 if (inf == inftoex)
178 break;
179
180 if (!inf)
181 return;
182
183 for (thread_info *tp : inf->threads ())
184 {
185 if (silent)
186 delete_thread_silent_noremove (tp);
187 else
188 delete_thread_noremove (tp);
189 }
190
191 inf->thread_map.clear ();
192
193 gdb::observers::inferior_exit.notify (inf);
194
195 inf->pid = 0;
196 inf->fake_pid_p = false;
197 inf->priv = NULL;
198
199 if (inf->vfork_parent != NULL)
200 {
201 inf->vfork_parent->vfork_child = NULL;
202 inf->vfork_parent = NULL;
203 }
204 if (inf->vfork_child != NULL)
205 {
206 inf->vfork_child->vfork_parent = NULL;
207 inf->vfork_child = NULL;
208 }
209
210 inf->pending_detach = 0;
211 /* Reset it. */
212 inf->control = inferior_control_state (NO_STOP_QUIETLY);
213
214 /* Clear the register cache and the frame cache. */
215 registers_changed ();
216 reinit_frame_cache ();
217 }
218
219 void
220 exit_inferior (inferior *inf)
221 {
222 exit_inferior_1 (inf, 0);
223 }
224
225 void
226 exit_inferior_silent (inferior *inf)
227 {
228 exit_inferior_1 (inf, 1);
229 }
230
231 /* See inferior.h. */
232
233 void
234 detach_inferior (inferior *inf)
235 {
236 /* Save the pid, since exit_inferior_1 will reset it. */
237 int pid = inf->pid;
238
239 exit_inferior_1 (inf, 0);
240
241 if (print_inferior_events)
242 printf_unfiltered (_("[Inferior %d (%s) detached]\n"),
243 inf->num,
244 target_pid_to_str (ptid_t (pid)).c_str ());
245 }
246
247 void
248 inferior_appeared (struct inferior *inf, int pid)
249 {
250 /* If this is the first inferior with threads, reset the global
251 thread id. */
252 if (!any_thread_p ())
253 init_thread_list ();
254
255 inf->pid = pid;
256 inf->has_exit_code = 0;
257 inf->exit_code = 0;
258
259 gdb::observers::inferior_appeared.notify (inf);
260 }
261
262 void
263 discard_all_inferiors (void)
264 {
265 for (inferior *inf : all_non_exited_inferiors ())
266 exit_inferior_silent (inf);
267 }
268
269 struct inferior *
270 find_inferior_id (int num)
271 {
272 for (inferior *inf : all_inferiors ())
273 if (inf->num == num)
274 return inf;
275
276 return NULL;
277 }
278
279 struct inferior *
280 find_inferior_pid (int pid)
281 {
282 /* Looking for inferior pid == 0 is always wrong, and indicative of
283 a bug somewhere else. There may be more than one with pid == 0,
284 for instance. */
285 gdb_assert (pid != 0);
286
287 for (inferior *inf : all_inferiors ())
288 if (inf->pid == pid)
289 return inf;
290
291 return NULL;
292 }
293
294 /* See inferior.h */
295
296 struct inferior *
297 find_inferior_ptid (ptid_t ptid)
298 {
299 return find_inferior_pid (ptid.pid ());
300 }
301
302 /* See inferior.h. */
303
304 struct inferior *
305 find_inferior_for_program_space (struct program_space *pspace)
306 {
307 struct inferior *cur_inf = current_inferior ();
308
309 if (cur_inf->pspace == pspace)
310 return cur_inf;
311
312 for (inferior *inf : all_inferiors ())
313 if (inf->pspace == pspace)
314 return inf;
315
316 return NULL;
317 }
318
319 struct inferior *
320 iterate_over_inferiors (int (*callback) (struct inferior *, void *),
321 void *data)
322 {
323 for (inferior *inf : all_inferiors_safe ())
324 if ((*callback) (inf, data))
325 return inf;
326
327 return NULL;
328 }
329
330 int
331 have_inferiors (void)
332 {
333 for (inferior *inf ATTRIBUTE_UNUSED : all_non_exited_inferiors ())
334 return 1;
335
336 return 0;
337 }
338
339 /* Return the number of live inferiors. We account for the case
340 where an inferior might have a non-zero pid but no threads, as
341 in the middle of a 'mourn' operation. */
342
343 int
344 number_of_live_inferiors (void)
345 {
346 int num_inf = 0;
347
348 for (inferior *inf : all_non_exited_inferiors ())
349 if (target_has_execution_1 (ptid_t (inf->pid)))
350 for (thread_info *tp ATTRIBUTE_UNUSED : inf->non_exited_threads ())
351 {
352 /* Found a live thread in this inferior, go to the next
353 inferior. */
354 ++num_inf;
355 break;
356 }
357
358 return num_inf;
359 }
360
361 /* Return true if there is at least one live inferior. */
362
363 int
364 have_live_inferiors (void)
365 {
366 return number_of_live_inferiors () > 0;
367 }
368
369 /* Prune away any unused inferiors, and then prune away no longer used
370 program spaces. */
371
372 void
373 prune_inferiors (void)
374 {
375 inferior *ss;
376
377 ss = inferior_list;
378 while (ss)
379 {
380 if (!ss->deletable ()
381 || !ss->removable
382 || ss->pid != 0)
383 {
384 ss = ss->next;
385 continue;
386 }
387
388 inferior *ss_next = ss->next;
389 delete_inferior (ss);
390 ss = ss_next;
391 }
392 }
393
394 /* Simply returns the count of inferiors. */
395
396 int
397 number_of_inferiors (void)
398 {
399 auto rng = all_inferiors ();
400 return std::distance (rng.begin (), rng.end ());
401 }
402
403 /* Converts an inferior process id to a string. Like
404 target_pid_to_str, but special cases the null process. */
405
406 static std::string
407 inferior_pid_to_str (int pid)
408 {
409 if (pid != 0)
410 return target_pid_to_str (ptid_t (pid));
411 else
412 return _("<null>");
413 }
414
415 /* See inferior.h. */
416
417 void
418 print_selected_inferior (struct ui_out *uiout)
419 {
420 struct inferior *inf = current_inferior ();
421 const char *filename = inf->pspace->pspace_exec_filename;
422
423 if (filename == NULL)
424 filename = _("<noexec>");
425
426 uiout->message (_("[Switching to inferior %d [%s] (%s)]\n"),
427 inf->num, inferior_pid_to_str (inf->pid).c_str (), filename);
428 }
429
430 /* Prints the list of inferiors and their details on UIOUT. This is a
431 version of 'info_inferior_command' suitable for use from MI.
432
433 If REQUESTED_INFERIORS is not NULL, it's a list of GDB ids of the
434 inferiors that should be printed. Otherwise, all inferiors are
435 printed. */
436
437 static void
438 print_inferior (struct ui_out *uiout, const char *requested_inferiors)
439 {
440 int inf_count = 0;
441
442 /* Compute number of inferiors we will print. */
443 for (inferior *inf : all_inferiors ())
444 {
445 if (!number_is_in_list (requested_inferiors, inf->num))
446 continue;
447
448 ++inf_count;
449 }
450
451 if (inf_count == 0)
452 {
453 uiout->message ("No inferiors.\n");
454 return;
455 }
456
457 ui_out_emit_table table_emitter (uiout, 4, inf_count, "inferiors");
458 uiout->table_header (1, ui_left, "current", "");
459 uiout->table_header (4, ui_left, "number", "Num");
460 uiout->table_header (17, ui_left, "target-id", "Description");
461 uiout->table_header (17, ui_left, "exec", "Executable");
462
463 uiout->table_body ();
464 for (inferior *inf : all_inferiors ())
465 {
466 if (!number_is_in_list (requested_inferiors, inf->num))
467 continue;
468
469 ui_out_emit_tuple tuple_emitter (uiout, NULL);
470
471 if (inf == current_inferior ())
472 uiout->field_string ("current", "*");
473 else
474 uiout->field_skip ("current");
475
476 uiout->field_signed ("number", inf->num);
477
478 uiout->field_string ("target-id", inferior_pid_to_str (inf->pid));
479
480 if (inf->pspace->pspace_exec_filename != NULL)
481 uiout->field_string ("exec", inf->pspace->pspace_exec_filename);
482 else
483 uiout->field_skip ("exec");
484
485 /* Print extra info that isn't really fit to always present in
486 tabular form. Currently we print the vfork parent/child
487 relationships, if any. */
488 if (inf->vfork_parent)
489 {
490 uiout->text (_("\n\tis vfork child of inferior "));
491 uiout->field_signed ("vfork-parent", inf->vfork_parent->num);
492 }
493 if (inf->vfork_child)
494 {
495 uiout->text (_("\n\tis vfork parent of inferior "));
496 uiout->field_signed ("vfork-child", inf->vfork_child->num);
497 }
498
499 uiout->text ("\n");
500 }
501 }
502
503 static void
504 detach_inferior_command (const char *args, int from_tty)
505 {
506 if (!args || !*args)
507 error (_("Requires argument (inferior id(s) to detach)"));
508
509 number_or_range_parser parser (args);
510 while (!parser.finished ())
511 {
512 int num = parser.get_number ();
513
514 inferior *inf = find_inferior_id (num);
515 if (inf == NULL)
516 {
517 warning (_("Inferior ID %d not known."), num);
518 continue;
519 }
520
521 if (inf->pid == 0)
522 {
523 warning (_("Inferior ID %d is not running."), num);
524 continue;
525 }
526
527 thread_info *tp = any_thread_of_inferior (inf);
528 if (tp == NULL)
529 {
530 warning (_("Inferior ID %d has no threads."), num);
531 continue;
532 }
533
534 switch_to_thread (tp);
535
536 detach_command (NULL, from_tty);
537 }
538 }
539
540 static void
541 kill_inferior_command (const char *args, int from_tty)
542 {
543 if (!args || !*args)
544 error (_("Requires argument (inferior id(s) to kill)"));
545
546 number_or_range_parser parser (args);
547 while (!parser.finished ())
548 {
549 int num = parser.get_number ();
550
551 inferior *inf = find_inferior_id (num);
552 if (inf == NULL)
553 {
554 warning (_("Inferior ID %d not known."), num);
555 continue;
556 }
557
558 if (inf->pid == 0)
559 {
560 warning (_("Inferior ID %d is not running."), num);
561 continue;
562 }
563
564 thread_info *tp = any_thread_of_inferior (inf);
565 if (tp == NULL)
566 {
567 warning (_("Inferior ID %d has no threads."), num);
568 continue;
569 }
570
571 switch_to_thread (tp);
572
573 target_kill ();
574 }
575
576 bfd_cache_close_all ();
577 }
578
579 static void
580 inferior_command (const char *args, int from_tty)
581 {
582 struct inferior *inf;
583 int num;
584
585 num = parse_and_eval_long (args);
586
587 inf = find_inferior_id (num);
588 if (inf == NULL)
589 error (_("Inferior ID %d not known."), num);
590
591 if (inf->pid != 0)
592 {
593 if (inf != current_inferior ())
594 {
595 thread_info *tp = first_thread_of_inferior (inf);
596 if (tp == NULL)
597 error (_("Inferior has no threads."));
598
599 switch_to_thread (tp);
600 }
601
602 gdb::observers::user_selected_context_changed.notify
603 (USER_SELECTED_INFERIOR
604 | USER_SELECTED_THREAD
605 | USER_SELECTED_FRAME);
606 }
607 else
608 {
609 set_current_inferior (inf);
610 switch_to_no_thread ();
611 set_current_program_space (inf->pspace);
612
613 gdb::observers::user_selected_context_changed.notify
614 (USER_SELECTED_INFERIOR);
615 }
616 }
617
618 /* Print information about currently known inferiors. */
619
620 static void
621 info_inferiors_command (const char *args, int from_tty)
622 {
623 print_inferior (current_uiout, args);
624 }
625
626 /* remove-inferior ID */
627
628 static void
629 remove_inferior_command (const char *args, int from_tty)
630 {
631 if (args == NULL || *args == '\0')
632 error (_("Requires an argument (inferior id(s) to remove)"));
633
634 number_or_range_parser parser (args);
635 while (!parser.finished ())
636 {
637 int num = parser.get_number ();
638 struct inferior *inf = find_inferior_id (num);
639
640 if (inf == NULL)
641 {
642 warning (_("Inferior ID %d not known."), num);
643 continue;
644 }
645
646 if (!inf->deletable ())
647 {
648 warning (_("Can not remove current inferior %d."), num);
649 continue;
650 }
651
652 if (inf->pid != 0)
653 {
654 warning (_("Can not remove active inferior %d."), num);
655 continue;
656 }
657
658 delete_inferior (inf);
659 }
660 }
661
662 struct inferior *
663 add_inferior_with_spaces (void)
664 {
665 struct address_space *aspace;
666 struct program_space *pspace;
667 struct inferior *inf;
668 struct gdbarch_info info;
669
670 /* If all inferiors share an address space on this system, this
671 doesn't really return a new address space; otherwise, it
672 really does. */
673 aspace = maybe_new_address_space ();
674 pspace = new program_space (aspace);
675 inf = add_inferior (0);
676 inf->pspace = pspace;
677 inf->aspace = pspace->aspace;
678
679 /* Setup the inferior's initial arch, based on information obtained
680 from the global "set ..." options. */
681 gdbarch_info_init (&info);
682 inf->gdbarch = gdbarch_find_by_info (info);
683 /* The "set ..." options reject invalid settings, so we should
684 always have a valid arch by now. */
685 gdb_assert (inf->gdbarch != NULL);
686
687 return inf;
688 }
689
690 /* add-inferior [-copies N] [-exec FILENAME] */
691
692 static void
693 add_inferior_command (const char *args, int from_tty)
694 {
695 int i, copies = 1;
696 gdb::unique_xmalloc_ptr<char> exec;
697 symfile_add_flags add_flags = 0;
698
699 if (from_tty)
700 add_flags |= SYMFILE_VERBOSE;
701
702 if (args)
703 {
704 gdb_argv built_argv (args);
705
706 for (char **argv = built_argv.get (); *argv != NULL; argv++)
707 {
708 if (**argv == '-')
709 {
710 if (strcmp (*argv, "-copies") == 0)
711 {
712 ++argv;
713 if (!*argv)
714 error (_("No argument to -copies"));
715 copies = parse_and_eval_long (*argv);
716 }
717 else if (strcmp (*argv, "-exec") == 0)
718 {
719 ++argv;
720 if (!*argv)
721 error (_("No argument to -exec"));
722 exec.reset (tilde_expand (*argv));
723 }
724 }
725 else
726 error (_("Invalid argument"));
727 }
728 }
729
730 scoped_restore_current_pspace_and_thread restore_pspace_thread;
731
732 for (i = 0; i < copies; ++i)
733 {
734 struct inferior *inf = add_inferior_with_spaces ();
735
736 printf_filtered (_("Added inferior %d\n"), inf->num);
737
738 if (exec != NULL)
739 {
740 /* Switch over temporarily, while reading executable and
741 symbols.q. */
742 set_current_program_space (inf->pspace);
743 set_current_inferior (inf);
744 switch_to_no_thread ();
745
746 exec_file_attach (exec.get (), from_tty);
747 symbol_file_add_main (exec.get (), add_flags);
748 }
749 }
750 }
751
752 /* clone-inferior [-copies N] [ID] */
753
754 static void
755 clone_inferior_command (const char *args, int from_tty)
756 {
757 int i, copies = 1;
758 struct inferior *orginf = NULL;
759
760 if (args)
761 {
762 gdb_argv built_argv (args);
763
764 char **argv = built_argv.get ();
765 for (; *argv != NULL; argv++)
766 {
767 if (**argv == '-')
768 {
769 if (strcmp (*argv, "-copies") == 0)
770 {
771 ++argv;
772 if (!*argv)
773 error (_("No argument to -copies"));
774 copies = parse_and_eval_long (*argv);
775
776 if (copies < 0)
777 error (_("Invalid copies number"));
778 }
779 }
780 else
781 {
782 if (orginf == NULL)
783 {
784 int num;
785
786 /* The first non-option (-) argument specified the
787 program space ID. */
788 num = parse_and_eval_long (*argv);
789 orginf = find_inferior_id (num);
790
791 if (orginf == NULL)
792 error (_("Inferior ID %d not known."), num);
793 continue;
794 }
795 else
796 error (_("Invalid argument"));
797 }
798 }
799 }
800
801 /* If no inferior id was specified, then the user wants to clone the
802 current inferior. */
803 if (orginf == NULL)
804 orginf = current_inferior ();
805
806 scoped_restore_current_pspace_and_thread restore_pspace_thread;
807
808 for (i = 0; i < copies; ++i)
809 {
810 struct address_space *aspace;
811 struct program_space *pspace;
812 struct inferior *inf;
813
814 /* If all inferiors share an address space on this system, this
815 doesn't really return a new address space; otherwise, it
816 really does. */
817 aspace = maybe_new_address_space ();
818 pspace = new program_space (aspace);
819 inf = add_inferior (0);
820 inf->pspace = pspace;
821 inf->aspace = pspace->aspace;
822 inf->gdbarch = orginf->gdbarch;
823
824 /* If the original inferior had a user specified target
825 description, make the clone use it too. */
826 if (target_desc_info_from_user_p (inf->tdesc_info))
827 copy_inferior_target_desc_info (inf, orginf);
828
829 printf_filtered (_("Added inferior %d.\n"), inf->num);
830
831 set_current_inferior (inf);
832 switch_to_no_thread ();
833 clone_program_space (pspace, orginf->pspace);
834 }
835 }
836
837 /* Print notices when new inferiors are created and die. */
838 static void
839 show_print_inferior_events (struct ui_file *file, int from_tty,
840 struct cmd_list_element *c, const char *value)
841 {
842 fprintf_filtered (file, _("Printing of inferior events is %s.\n"), value);
843 }
844
845 /* Return a new value for the selected inferior's id. */
846
847 static struct value *
848 inferior_id_make_value (struct gdbarch *gdbarch, struct internalvar *var,
849 void *ignore)
850 {
851 struct inferior *inf = current_inferior ();
852
853 return value_from_longest (builtin_type (gdbarch)->builtin_int, inf->num);
854 }
855
856 /* Implementation of `$_inferior' variable. */
857
858 static const struct internalvar_funcs inferior_funcs =
859 {
860 inferior_id_make_value,
861 NULL,
862 NULL
863 };
864
865 \f
866
867 void
868 initialize_inferiors (void)
869 {
870 struct cmd_list_element *c = NULL;
871
872 /* There's always one inferior. Note that this function isn't an
873 automatic _initialize_foo function, since other _initialize_foo
874 routines may need to install their per-inferior data keys. We
875 can only allocate an inferior when all those modules have done
876 that. Do this after initialize_progspace, due to the
877 current_program_space reference. */
878 current_inferior_ = add_inferior_silent (0);
879 current_inferior_->incref ();
880 current_inferior_->pspace = current_program_space;
881 current_inferior_->aspace = current_program_space->aspace;
882 /* The architecture will be initialized shortly, by
883 initialize_current_architecture. */
884
885 add_info ("inferiors", info_inferiors_command,
886 _("Print a list of inferiors being managed.\n\
887 Usage: info inferiors [ID]...\n\
888 If IDs are specified, the list is limited to just those inferiors.\n\
889 By default all inferiors are displayed."));
890
891 c = add_com ("add-inferior", no_class, add_inferior_command, _("\
892 Add a new inferior.\n\
893 Usage: add-inferior [-copies N] [-exec FILENAME]\n\
894 N is the optional number of inferiors to add, default is 1.\n\
895 FILENAME is the file name of the executable to use\n\
896 as main program."));
897 set_cmd_completer (c, filename_completer);
898
899 add_com ("remove-inferiors", no_class, remove_inferior_command, _("\
900 Remove inferior ID (or list of IDs).\n\
901 Usage: remove-inferiors ID..."));
902
903 add_com ("clone-inferior", no_class, clone_inferior_command, _("\
904 Clone inferior ID.\n\
905 Usage: clone-inferior [-copies N] [ID]\n\
906 Add N copies of inferior ID. The new inferior has the same\n\
907 executable loaded as the copied inferior. If -copies is not specified,\n\
908 adds 1 copy. If ID is not specified, it is the current inferior\n\
909 that is cloned."));
910
911 add_cmd ("inferiors", class_run, detach_inferior_command, _("\
912 Detach from inferior ID (or list of IDS).\n\
913 Usage; detach inferiors ID..."),
914 &detachlist);
915
916 add_cmd ("inferiors", class_run, kill_inferior_command, _("\
917 Kill inferior ID (or list of IDs).\n\
918 Usage: kill inferiors ID..."),
919 &killlist);
920
921 add_cmd ("inferior", class_run, inferior_command, _("\
922 Use this command to switch between inferiors.\n\
923 Usage: inferior ID\n\
924 The new inferior ID must be currently known."),
925 &cmdlist);
926
927 add_setshow_boolean_cmd ("inferior-events", no_class,
928 &print_inferior_events, _("\
929 Set printing of inferior events (such as inferior start and exit)."), _("\
930 Show printing of inferior events (such as inferior start and exit)."), NULL,
931 NULL,
932 show_print_inferior_events,
933 &setprintlist, &showprintlist);
934
935 create_internalvar_type_lazy ("_inferior", &inferior_funcs, NULL);
936 }
This page took 0.049207 seconds and 4 git commands to generate.