]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/infcmd.c
e8ac46a8ac44bc22938b42728de4c98dd1cddc69
[thirdparty/binutils-gdb.git] / gdb / infcmd.c
1 /* Memory-access and commands for "inferior" process, for GDB.
2
3 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
4 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
5 Free Software Foundation, Inc.
6
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21
22 #include "defs.h"
23 #include <signal.h>
24 #include "gdb_string.h"
25 #include "symtab.h"
26 #include "gdbtypes.h"
27 #include "frame.h"
28 #include "inferior.h"
29 #include "environ.h"
30 #include "value.h"
31 #include "gdbcmd.h"
32 #include "symfile.h"
33 #include "gdbcore.h"
34 #include "target.h"
35 #include "language.h"
36 #include "symfile.h"
37 #include "objfiles.h"
38 #include "completer.h"
39 #include "ui-out.h"
40 #include "event-top.h"
41 #include "parser-defs.h"
42 #include "regcache.h"
43 #include "reggroups.h"
44 #include "block.h"
45 #include "solib.h"
46 #include <ctype.h>
47 #include "gdb_assert.h"
48 #include "observer.h"
49 #include "target-descriptions.h"
50 #include "user-regs.h"
51
52 /* Functions exported for general use, in inferior.h: */
53
54 void all_registers_info (char *, int);
55
56 void registers_info (char *, int);
57
58 void nexti_command (char *, int);
59
60 void stepi_command (char *, int);
61
62 void continue_command (char *, int);
63
64 void interrupt_target_command (char *args, int from_tty);
65
66 /* Local functions: */
67
68 static void nofp_registers_info (char *, int);
69
70 static void print_return_value (struct type *value_type);
71
72 static void finish_command_continuation (struct continuation_arg *);
73
74 static void until_next_command (int);
75
76 static void until_command (char *, int);
77
78 static void path_info (char *, int);
79
80 static void path_command (char *, int);
81
82 static void unset_command (char *, int);
83
84 static void float_info (char *, int);
85
86 static void detach_command (char *, int);
87
88 static void disconnect_command (char *, int);
89
90 static void unset_environment_command (char *, int);
91
92 static void set_environment_command (char *, int);
93
94 static void environment_info (char *, int);
95
96 static void program_info (char *, int);
97
98 static void finish_command (char *, int);
99
100 static void signal_command (char *, int);
101
102 static void jump_command (char *, int);
103
104 static void step_1 (int, int, char *);
105 static void step_once (int skip_subroutines, int single_inst, int count);
106 static void step_1_continuation (struct continuation_arg *arg);
107
108 static void next_command (char *, int);
109
110 static void step_command (char *, int);
111
112 static void run_command (char *, int);
113
114 static void run_no_args_command (char *args, int from_tty);
115
116 static void go_command (char *line_no, int from_tty);
117
118 static int strip_bg_char (char **);
119
120 void _initialize_infcmd (void);
121
122 #define GO_USAGE "Usage: go <location>\n"
123
124 #define ERROR_NO_INFERIOR \
125 if (!target_has_execution) error (_("The program is not being run."));
126
127 /* String containing arguments to give to the program, separated by spaces.
128 Empty string (pointer to '\0') means no args. */
129
130 static char *inferior_args;
131
132 /* The inferior arguments as a vector. If INFERIOR_ARGC is nonzero,
133 then we must compute INFERIOR_ARGS from this (via the target). */
134
135 static int inferior_argc;
136 static char **inferior_argv;
137
138 /* File name for default use for standard in/out in the inferior. */
139
140 static char *inferior_io_terminal;
141
142 /* Pid of our debugged inferior, or 0 if no inferior now.
143 Since various parts of infrun.c test this to see whether there is a program
144 being debugged it should be nonzero (currently 3 is used) for remote
145 debugging. */
146
147 ptid_t inferior_ptid;
148
149 /* Last signal that the inferior received (why it stopped). */
150
151 enum target_signal stop_signal;
152
153 /* Address at which inferior stopped. */
154
155 CORE_ADDR stop_pc;
156
157 /* Chain containing status of breakpoint(s) that we have stopped at. */
158
159 bpstat stop_bpstat;
160
161 /* Flag indicating that a command has proceeded the inferior past the
162 current breakpoint. */
163
164 int breakpoint_proceeded;
165
166 /* Nonzero if stopped due to a step command. */
167
168 int stop_step;
169
170 /* Nonzero if stopped due to completion of a stack dummy routine. */
171
172 int stop_stack_dummy;
173
174 /* Nonzero if stopped due to a random (unexpected) signal in inferior
175 process. */
176
177 int stopped_by_random_signal;
178
179 /* Range to single step within.
180 If this is nonzero, respond to a single-step signal
181 by continuing to step if the pc is in this range. */
182
183 CORE_ADDR step_range_start; /* Inclusive */
184 CORE_ADDR step_range_end; /* Exclusive */
185
186 /* Stack frame address as of when stepping command was issued.
187 This is how we know when we step into a subroutine call,
188 and how to set the frame for the breakpoint used to step out. */
189
190 struct frame_id step_frame_id;
191
192 enum step_over_calls_kind step_over_calls;
193
194 /* If stepping, nonzero means step count is > 1
195 so don't print frame next time inferior stops
196 if it stops due to stepping. */
197
198 int step_multi;
199
200 /* Environment to use for running inferior,
201 in format described in environ.h. */
202
203 struct gdb_environ *inferior_environ;
204 \f
205 /* Accessor routines. */
206
207 void
208 set_inferior_io_terminal (const char *terminal_name)
209 {
210 if (inferior_io_terminal)
211 xfree (inferior_io_terminal);
212
213 if (!terminal_name)
214 inferior_io_terminal = NULL;
215 else
216 inferior_io_terminal = savestring (terminal_name, strlen (terminal_name));
217 }
218
219 const char *
220 get_inferior_io_terminal (void)
221 {
222 return inferior_io_terminal;
223 }
224
225 char *
226 get_inferior_args (void)
227 {
228 if (inferior_argc != 0)
229 {
230 char *n, *old;
231
232 n = gdbarch_construct_inferior_arguments (current_gdbarch,
233 inferior_argc, inferior_argv);
234 old = set_inferior_args (n);
235 xfree (old);
236 }
237
238 if (inferior_args == NULL)
239 inferior_args = xstrdup ("");
240
241 return inferior_args;
242 }
243
244 char *
245 set_inferior_args (char *newargs)
246 {
247 char *saved_args = inferior_args;
248
249 inferior_args = newargs;
250 inferior_argc = 0;
251 inferior_argv = 0;
252
253 return saved_args;
254 }
255
256 void
257 set_inferior_args_vector (int argc, char **argv)
258 {
259 inferior_argc = argc;
260 inferior_argv = argv;
261 }
262
263 /* Notice when `set args' is run. */
264 static void
265 notice_args_set (char *args, int from_tty, struct cmd_list_element *c)
266 {
267 inferior_argc = 0;
268 inferior_argv = 0;
269 }
270
271 /* Notice when `show args' is run. */
272 static void
273 notice_args_read (struct ui_file *file, int from_tty,
274 struct cmd_list_element *c, const char *value)
275 {
276 deprecated_show_value_hack (file, from_tty, c, value);
277 /* Might compute the value. */
278 get_inferior_args ();
279 }
280
281 \f
282 /* Compute command-line string given argument vector. This does the
283 same shell processing as fork_inferior. */
284 char *
285 construct_inferior_arguments (struct gdbarch *gdbarch, int argc, char **argv)
286 {
287 char *result;
288
289 if (STARTUP_WITH_SHELL)
290 {
291 /* This holds all the characters considered special to the
292 typical Unix shells. We include `^' because the SunOS
293 /bin/sh treats it as a synonym for `|'. */
294 char *special = "\"!#$&*()\\|[]{}<>?'\"`~^; \t\n";
295 int i;
296 int length = 0;
297 char *out, *cp;
298
299 /* We over-compute the size. It shouldn't matter. */
300 for (i = 0; i < argc; ++i)
301 length += 2 * strlen (argv[i]) + 1 + 2 * (argv[i][0] == '\0');
302
303 result = (char *) xmalloc (length);
304 out = result;
305
306 for (i = 0; i < argc; ++i)
307 {
308 if (i > 0)
309 *out++ = ' ';
310
311 /* Need to handle empty arguments specially. */
312 if (argv[i][0] == '\0')
313 {
314 *out++ = '\'';
315 *out++ = '\'';
316 }
317 else
318 {
319 for (cp = argv[i]; *cp; ++cp)
320 {
321 if (strchr (special, *cp) != NULL)
322 *out++ = '\\';
323 *out++ = *cp;
324 }
325 }
326 }
327 *out = '\0';
328 }
329 else
330 {
331 /* In this case we can't handle arguments that contain spaces,
332 tabs, or newlines -- see breakup_args(). */
333 int i;
334 int length = 0;
335
336 for (i = 0; i < argc; ++i)
337 {
338 char *cp = strchr (argv[i], ' ');
339 if (cp == NULL)
340 cp = strchr (argv[i], '\t');
341 if (cp == NULL)
342 cp = strchr (argv[i], '\n');
343 if (cp != NULL)
344 error (_("can't handle command-line argument containing whitespace"));
345 length += strlen (argv[i]) + 1;
346 }
347
348 result = (char *) xmalloc (length);
349 result[0] = '\0';
350 for (i = 0; i < argc; ++i)
351 {
352 if (i > 0)
353 strcat (result, " ");
354 strcat (result, argv[i]);
355 }
356 }
357
358 return result;
359 }
360 \f
361
362 /* This function detects whether or not a '&' character (indicating
363 background execution) has been added as *the last* of the arguments ARGS
364 of a command. If it has, it removes it and returns 1. Otherwise it
365 does nothing and returns 0. */
366 static int
367 strip_bg_char (char **args)
368 {
369 char *p = NULL;
370
371 p = strchr (*args, '&');
372
373 if (p)
374 {
375 if (p == (*args + strlen (*args) - 1))
376 {
377 if (strlen (*args) > 1)
378 {
379 do
380 p--;
381 while (*p == ' ' || *p == '\t');
382 *(p + 1) = '\0';
383 }
384 else
385 *args = 0;
386 return 1;
387 }
388 }
389 return 0;
390 }
391
392 void
393 tty_command (char *file, int from_tty)
394 {
395 if (file == 0)
396 error_no_arg (_("terminal name for running target process"));
397
398 set_inferior_io_terminal (file);
399 }
400
401 /* Common actions to take after creating any sort of inferior, by any
402 means (running, attaching, connecting, et cetera). The target
403 should be stopped. */
404
405 void
406 post_create_inferior (struct target_ops *target, int from_tty)
407 {
408 /* Be sure we own the terminal in case write operations are performed. */
409 target_terminal_ours ();
410
411 /* If the target hasn't taken care of this already, do it now.
412 Targets which need to access registers during to_open,
413 to_create_inferior, or to_attach should do it earlier; but many
414 don't need to. */
415 target_find_description ();
416
417 if (exec_bfd)
418 {
419 /* Sometimes the platform-specific hook loads initial shared
420 libraries, and sometimes it doesn't. Try to do so first, so
421 that we can add them with the correct value for FROM_TTY.
422 If we made all the inferior hook methods consistent,
423 this call could be removed. */
424 #ifdef SOLIB_ADD
425 SOLIB_ADD (NULL, from_tty, target, auto_solib_add);
426 #else
427 solib_add (NULL, from_tty, target, auto_solib_add);
428 #endif
429
430 /* Create the hooks to handle shared library load and unload
431 events. */
432 #ifdef SOLIB_CREATE_INFERIOR_HOOK
433 SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid));
434 #else
435 solib_create_inferior_hook ();
436 #endif
437 }
438
439 observer_notify_inferior_created (target, from_tty);
440 }
441
442 /* Kill the inferior if already running. This function is designed
443 to be called when we are about to start the execution of the program
444 from the beginning. Ask the user to confirm that he wants to restart
445 the program being debugged when FROM_TTY is non-null. */
446
447 void
448 kill_if_already_running (int from_tty)
449 {
450 if (! ptid_equal (inferior_ptid, null_ptid) && target_has_execution)
451 {
452 if (from_tty
453 && !query ("The program being debugged has been started already.\n\
454 Start it from the beginning? "))
455 error (_("Program not restarted."));
456 target_kill ();
457 #if defined(SOLIB_RESTART)
458 SOLIB_RESTART ();
459 #endif
460 init_wait_for_inferior ();
461 }
462 }
463
464 /* Implement the "run" command. If TBREAK_AT_MAIN is set, then insert
465 a temporary breakpoint at the begining of the main program before
466 running the program. */
467
468 static void
469 run_command_1 (char *args, int from_tty, int tbreak_at_main)
470 {
471 char *exec_file;
472
473 dont_repeat ();
474
475 kill_if_already_running (from_tty);
476 clear_breakpoint_hit_counts ();
477
478 /* Clean up any leftovers from other runs. Some other things from
479 this function should probably be moved into target_pre_inferior. */
480 target_pre_inferior (from_tty);
481
482 /* Purge old solib objfiles. */
483 objfile_purge_solibs ();
484
485 clear_solib ();
486
487 /* The comment here used to read, "The exec file is re-read every
488 time we do a generic_mourn_inferior, so we just have to worry
489 about the symbol file." The `generic_mourn_inferior' function
490 gets called whenever the program exits. However, suppose the
491 program exits, and *then* the executable file changes? We need
492 to check again here. Since reopen_exec_file doesn't do anything
493 if the timestamp hasn't changed, I don't see the harm. */
494 reopen_exec_file ();
495 reread_symbols ();
496
497 /* Insert the temporary breakpoint if a location was specified. */
498 if (tbreak_at_main)
499 tbreak_command (main_name (), 0);
500
501 exec_file = (char *) get_exec_file (0);
502
503 /* We keep symbols from add-symbol-file, on the grounds that the
504 user might want to add some symbols before running the program
505 (right?). But sometimes (dynamic loading where the user manually
506 introduces the new symbols with add-symbol-file), the code which
507 the symbols describe does not persist between runs. Currently
508 the user has to manually nuke all symbols between runs if they
509 want them to go away (PR 2207). This is probably reasonable. */
510
511 if (!args)
512 {
513 if (target_can_async_p ())
514 async_disable_stdin ();
515 }
516 else
517 {
518 int async_exec = strip_bg_char (&args);
519
520 /* If we get a request for running in the bg but the target
521 doesn't support it, error out. */
522 if (async_exec && !target_can_async_p ())
523 error (_("Asynchronous execution not supported on this target."));
524
525 /* If we don't get a request of running in the bg, then we need
526 to simulate synchronous (fg) execution. */
527 if (!async_exec && target_can_async_p ())
528 {
529 /* Simulate synchronous execution */
530 async_disable_stdin ();
531 }
532
533 /* If there were other args, beside '&', process them. */
534 if (args)
535 {
536 char *old_args = set_inferior_args (xstrdup (args));
537 xfree (old_args);
538 }
539 }
540
541 if (from_tty)
542 {
543 ui_out_field_string (uiout, NULL, "Starting program");
544 ui_out_text (uiout, ": ");
545 if (exec_file)
546 ui_out_field_string (uiout, "execfile", exec_file);
547 ui_out_spaces (uiout, 1);
548 /* We call get_inferior_args() because we might need to compute
549 the value now. */
550 ui_out_field_string (uiout, "infargs", get_inferior_args ());
551 ui_out_text (uiout, "\n");
552 ui_out_flush (uiout);
553 }
554
555 /* We call get_inferior_args() because we might need to compute
556 the value now. */
557 target_create_inferior (exec_file, get_inferior_args (),
558 environ_vector (inferior_environ), from_tty);
559
560 /* Pass zero for FROM_TTY, because at this point the "run" command
561 has done its thing; now we are setting up the running program. */
562 post_create_inferior (&current_target, 0);
563
564 /* Start the target running. */
565 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
566 }
567
568
569 static void
570 run_command (char *args, int from_tty)
571 {
572 run_command_1 (args, from_tty, 0);
573 }
574
575 static void
576 run_no_args_command (char *args, int from_tty)
577 {
578 char *old_args = set_inferior_args (xstrdup (""));
579 xfree (old_args);
580 }
581 \f
582
583 /* Start the execution of the program up until the beginning of the main
584 program. */
585
586 static void
587 start_command (char *args, int from_tty)
588 {
589 /* Some languages such as Ada need to search inside the program
590 minimal symbols for the location where to put the temporary
591 breakpoint before starting. */
592 if (!have_minimal_symbols ())
593 error (_("No symbol table loaded. Use the \"file\" command."));
594
595 /* Run the program until reaching the main procedure... */
596 run_command_1 (args, from_tty, 1);
597 }
598
599 void
600 continue_command (char *proc_count_exp, int from_tty)
601 {
602 int async_exec = 0;
603 ERROR_NO_INFERIOR;
604
605 /* Find out whether we must run in the background. */
606 if (proc_count_exp != NULL)
607 async_exec = strip_bg_char (&proc_count_exp);
608
609 /* If we must run in the background, but the target can't do it,
610 error out. */
611 if (async_exec && !target_can_async_p ())
612 error (_("Asynchronous execution not supported on this target."));
613
614 /* If we are not asked to run in the bg, then prepare to run in the
615 foreground, synchronously. */
616 if (!async_exec && target_can_async_p ())
617 {
618 /* Simulate synchronous execution */
619 async_disable_stdin ();
620 }
621
622 /* If have argument (besides '&'), set proceed count of breakpoint
623 we stopped at. */
624 if (proc_count_exp != NULL)
625 {
626 bpstat bs = stop_bpstat;
627 int num, stat;
628 int stopped = 0;
629
630 while ((stat = bpstat_num (&bs, &num)) != 0)
631 if (stat > 0)
632 {
633 set_ignore_count (num,
634 parse_and_eval_long (proc_count_exp) - 1,
635 from_tty);
636 /* set_ignore_count prints a message ending with a period.
637 So print two spaces before "Continuing.". */
638 if (from_tty)
639 printf_filtered (" ");
640 stopped = 1;
641 }
642
643 if (!stopped && from_tty)
644 {
645 printf_filtered
646 ("Not stopped at any breakpoint; argument ignored.\n");
647 }
648 }
649
650 if (from_tty)
651 printf_filtered (_("Continuing.\n"));
652
653 clear_proceed_status ();
654
655 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
656 }
657 \f
658 /* Step until outside of current statement. */
659
660 static void
661 step_command (char *count_string, int from_tty)
662 {
663 step_1 (0, 0, count_string);
664 }
665
666 /* Likewise, but skip over subroutine calls as if single instructions. */
667
668 static void
669 next_command (char *count_string, int from_tty)
670 {
671 step_1 (1, 0, count_string);
672 }
673
674 /* Likewise, but step only one instruction. */
675
676 void
677 stepi_command (char *count_string, int from_tty)
678 {
679 step_1 (0, 1, count_string);
680 }
681
682 void
683 nexti_command (char *count_string, int from_tty)
684 {
685 step_1 (1, 1, count_string);
686 }
687
688 static void
689 disable_longjmp_breakpoint_cleanup (void *ignore)
690 {
691 disable_longjmp_breakpoint ();
692 }
693
694 static void
695 step_1 (int skip_subroutines, int single_inst, char *count_string)
696 {
697 int count = 1;
698 struct frame_info *frame;
699 struct cleanup *cleanups = 0;
700 int async_exec = 0;
701
702 ERROR_NO_INFERIOR;
703
704 if (count_string)
705 async_exec = strip_bg_char (&count_string);
706
707 /* If we get a request for running in the bg but the target
708 doesn't support it, error out. */
709 if (async_exec && !target_can_async_p ())
710 error (_("Asynchronous execution not supported on this target."));
711
712 /* If we don't get a request of running in the bg, then we need
713 to simulate synchronous (fg) execution. */
714 if (!async_exec && target_can_async_p ())
715 {
716 /* Simulate synchronous execution */
717 async_disable_stdin ();
718 }
719
720 count = count_string ? parse_and_eval_long (count_string) : 1;
721
722 if (!single_inst || skip_subroutines) /* leave si command alone */
723 {
724 enable_longjmp_breakpoint ();
725 if (!target_can_async_p ())
726 cleanups = make_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/);
727 else
728 make_exec_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/);
729 }
730
731 /* In synchronous case, all is well, just use the regular for loop. */
732 if (!target_can_async_p ())
733 {
734 for (; count > 0; count--)
735 {
736 clear_proceed_status ();
737
738 frame = get_current_frame ();
739 if (!frame) /* Avoid coredump here. Why tho? */
740 error (_("No current frame"));
741 step_frame_id = get_frame_id (frame);
742
743 if (!single_inst)
744 {
745 find_pc_line_pc_range (stop_pc, &step_range_start, &step_range_end);
746 if (step_range_end == 0)
747 {
748 char *name;
749 if (find_pc_partial_function (stop_pc, &name, &step_range_start,
750 &step_range_end) == 0)
751 error (_("Cannot find bounds of current function"));
752
753 target_terminal_ours ();
754 printf_filtered (_("\
755 Single stepping until exit from function %s, \n\
756 which has no line number information.\n"), name);
757 }
758 }
759 else
760 {
761 /* Say we are stepping, but stop after one insn whatever it does. */
762 step_range_start = step_range_end = 1;
763 if (!skip_subroutines)
764 /* It is stepi.
765 Don't step over function calls, not even to functions lacking
766 line numbers. */
767 step_over_calls = STEP_OVER_NONE;
768 }
769
770 if (skip_subroutines)
771 step_over_calls = STEP_OVER_ALL;
772
773 step_multi = (count > 1);
774 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
775
776 if (!stop_step)
777 break;
778 }
779
780 if (!single_inst || skip_subroutines)
781 do_cleanups (cleanups);
782 return;
783 }
784 /* In case of asynchronous target things get complicated, do only
785 one step for now, before returning control to the event loop. Let
786 the continuation figure out how many other steps we need to do,
787 and handle them one at the time, through step_once(). */
788 else
789 {
790 if (target_can_async_p ())
791 step_once (skip_subroutines, single_inst, count);
792 }
793 }
794
795 /* Called after we are done with one step operation, to check whether
796 we need to step again, before we print the prompt and return control
797 to the user. If count is > 1, we will need to do one more call to
798 proceed(), via step_once(). Basically it is like step_once and
799 step_1_continuation are co-recursive. */
800 static void
801 step_1_continuation (struct continuation_arg *arg)
802 {
803 int count;
804 int skip_subroutines;
805 int single_inst;
806
807 skip_subroutines = arg->data.integer;
808 single_inst = arg->next->data.integer;
809 count = arg->next->next->data.integer;
810
811 if (stop_step)
812 step_once (skip_subroutines, single_inst, count - 1);
813 else
814 if (!single_inst || skip_subroutines)
815 do_exec_cleanups (ALL_CLEANUPS);
816 }
817
818 /* Do just one step operation. If count >1 we will have to set up a
819 continuation to be done after the target stops (after this one
820 step). This is useful to implement the 'step n' kind of commands, in
821 case of asynchronous targets. We had to split step_1 into two parts,
822 one to be done before proceed() and one afterwards. This function is
823 called in case of step n with n>1, after the first step operation has
824 been completed.*/
825 static void
826 step_once (int skip_subroutines, int single_inst, int count)
827 {
828 struct continuation_arg *arg1;
829 struct continuation_arg *arg2;
830 struct continuation_arg *arg3;
831 struct frame_info *frame;
832
833 if (count > 0)
834 {
835 clear_proceed_status ();
836
837 frame = get_current_frame ();
838 if (!frame) /* Avoid coredump here. Why tho? */
839 error (_("No current frame"));
840 step_frame_id = get_frame_id (frame);
841
842 if (!single_inst)
843 {
844 find_pc_line_pc_range (stop_pc, &step_range_start, &step_range_end);
845
846 /* If we have no line info, switch to stepi mode. */
847 if (step_range_end == 0 && step_stop_if_no_debug)
848 {
849 step_range_start = step_range_end = 1;
850 }
851 else if (step_range_end == 0)
852 {
853 char *name;
854 if (find_pc_partial_function (stop_pc, &name, &step_range_start,
855 &step_range_end) == 0)
856 error (_("Cannot find bounds of current function"));
857
858 target_terminal_ours ();
859 printf_filtered (_("\
860 Single stepping until exit from function %s, \n\
861 which has no line number information.\n"), name);
862 }
863 }
864 else
865 {
866 /* Say we are stepping, but stop after one insn whatever it does. */
867 step_range_start = step_range_end = 1;
868 if (!skip_subroutines)
869 /* It is stepi.
870 Don't step over function calls, not even to functions lacking
871 line numbers. */
872 step_over_calls = STEP_OVER_NONE;
873 }
874
875 if (skip_subroutines)
876 step_over_calls = STEP_OVER_ALL;
877
878 step_multi = (count > 1);
879 arg1 =
880 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
881 arg2 =
882 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
883 arg3 =
884 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
885 arg1->next = arg2;
886 arg1->data.integer = skip_subroutines;
887 arg2->next = arg3;
888 arg2->data.integer = single_inst;
889 arg3->next = NULL;
890 arg3->data.integer = count;
891 add_intermediate_continuation (step_1_continuation, arg1);
892 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
893 }
894 }
895
896 \f
897 /* Continue program at specified address. */
898
899 static void
900 jump_command (char *arg, int from_tty)
901 {
902 CORE_ADDR addr;
903 struct symtabs_and_lines sals;
904 struct symtab_and_line sal;
905 struct symbol *fn;
906 struct symbol *sfn;
907 int async_exec = 0;
908
909 ERROR_NO_INFERIOR;
910
911 /* Find out whether we must run in the background. */
912 if (arg != NULL)
913 async_exec = strip_bg_char (&arg);
914
915 /* If we must run in the background, but the target can't do it,
916 error out. */
917 if (async_exec && !target_can_async_p ())
918 error (_("Asynchronous execution not supported on this target."));
919
920 /* If we are not asked to run in the bg, then prepare to run in the
921 foreground, synchronously. */
922 if (!async_exec && target_can_async_p ())
923 {
924 /* Simulate synchronous execution */
925 async_disable_stdin ();
926 }
927
928 if (!arg)
929 error_no_arg (_("starting address"));
930
931 sals = decode_line_spec_1 (arg, 1);
932 if (sals.nelts != 1)
933 {
934 error (_("Unreasonable jump request"));
935 }
936
937 sal = sals.sals[0];
938 xfree (sals.sals);
939
940 if (sal.symtab == 0 && sal.pc == 0)
941 error (_("No source file has been specified."));
942
943 resolve_sal_pc (&sal); /* May error out */
944
945 /* See if we are trying to jump to another function. */
946 fn = get_frame_function (get_current_frame ());
947 sfn = find_pc_function (sal.pc);
948 if (fn != NULL && sfn != fn)
949 {
950 if (!query ("Line %d is not in `%s'. Jump anyway? ", sal.line,
951 SYMBOL_PRINT_NAME (fn)))
952 {
953 error (_("Not confirmed."));
954 /* NOTREACHED */
955 }
956 }
957
958 if (sfn != NULL)
959 {
960 fixup_symbol_section (sfn, 0);
961 if (section_is_overlay (SYMBOL_BFD_SECTION (sfn)) &&
962 !section_is_mapped (SYMBOL_BFD_SECTION (sfn)))
963 {
964 if (!query ("WARNING!!! Destination is in unmapped overlay! Jump anyway? "))
965 {
966 error (_("Not confirmed."));
967 /* NOTREACHED */
968 }
969 }
970 }
971
972 addr = sal.pc;
973
974 if (from_tty)
975 {
976 printf_filtered (_("Continuing at "));
977 deprecated_print_address_numeric (addr, 1, gdb_stdout);
978 printf_filtered (".\n");
979 }
980
981 clear_proceed_status ();
982 proceed (addr, TARGET_SIGNAL_0, 0);
983 }
984 \f
985
986 /* Go to line or address in current procedure */
987 static void
988 go_command (char *line_no, int from_tty)
989 {
990 if (line_no == (char *) NULL || !*line_no)
991 printf_filtered (GO_USAGE);
992 else
993 {
994 tbreak_command (line_no, from_tty);
995 jump_command (line_no, from_tty);
996 }
997 }
998 \f
999
1000 /* Continue program giving it specified signal. */
1001
1002 static void
1003 signal_command (char *signum_exp, int from_tty)
1004 {
1005 enum target_signal oursig;
1006
1007 dont_repeat (); /* Too dangerous. */
1008 ERROR_NO_INFERIOR;
1009
1010 if (!signum_exp)
1011 error_no_arg (_("signal number"));
1012
1013 /* It would be even slicker to make signal names be valid expressions,
1014 (the type could be "enum $signal" or some such), then the user could
1015 assign them to convenience variables. */
1016 oursig = target_signal_from_name (signum_exp);
1017
1018 if (oursig == TARGET_SIGNAL_UNKNOWN)
1019 {
1020 /* No, try numeric. */
1021 int num = parse_and_eval_long (signum_exp);
1022
1023 if (num == 0)
1024 oursig = TARGET_SIGNAL_0;
1025 else
1026 oursig = target_signal_from_command (num);
1027 }
1028
1029 if (from_tty)
1030 {
1031 if (oursig == TARGET_SIGNAL_0)
1032 printf_filtered (_("Continuing with no signal.\n"));
1033 else
1034 printf_filtered (_("Continuing with signal %s.\n"),
1035 target_signal_to_name (oursig));
1036 }
1037
1038 clear_proceed_status ();
1039 /* "signal 0" should not get stuck if we are stopped at a breakpoint.
1040 FIXME: Neither should "signal foo" but when I tried passing
1041 (CORE_ADDR)-1 unconditionally I got a testsuite failure which I haven't
1042 tried to track down yet. */
1043 proceed (oursig == TARGET_SIGNAL_0 ? (CORE_ADDR) -1 : stop_pc, oursig, 0);
1044 }
1045
1046 /* Proceed until we reach a different source line with pc greater than
1047 our current one or exit the function. We skip calls in both cases.
1048
1049 Note that eventually this command should probably be changed so
1050 that only source lines are printed out when we hit the breakpoint
1051 we set. This may involve changes to wait_for_inferior and the
1052 proceed status code. */
1053
1054 static void
1055 until_next_command (int from_tty)
1056 {
1057 struct frame_info *frame;
1058 CORE_ADDR pc;
1059 struct symbol *func;
1060 struct symtab_and_line sal;
1061
1062 clear_proceed_status ();
1063
1064 frame = get_current_frame ();
1065
1066 /* Step until either exited from this function or greater
1067 than the current line (if in symbolic section) or pc (if
1068 not). */
1069
1070 pc = read_pc ();
1071 func = find_pc_function (pc);
1072
1073 if (!func)
1074 {
1075 struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (pc);
1076
1077 if (msymbol == NULL)
1078 error (_("Execution is not within a known function."));
1079
1080 step_range_start = SYMBOL_VALUE_ADDRESS (msymbol);
1081 step_range_end = pc;
1082 }
1083 else
1084 {
1085 sal = find_pc_line (pc, 0);
1086
1087 step_range_start = BLOCK_START (SYMBOL_BLOCK_VALUE (func));
1088 step_range_end = sal.end;
1089 }
1090
1091 step_over_calls = STEP_OVER_ALL;
1092 step_frame_id = get_frame_id (frame);
1093
1094 step_multi = 0; /* Only one call to proceed */
1095
1096 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
1097 }
1098
1099 static void
1100 until_command (char *arg, int from_tty)
1101 {
1102 int async_exec = 0;
1103
1104 if (!target_has_execution)
1105 error (_("The program is not running."));
1106
1107 /* Find out whether we must run in the background. */
1108 if (arg != NULL)
1109 async_exec = strip_bg_char (&arg);
1110
1111 /* If we must run in the background, but the target can't do it,
1112 error out. */
1113 if (async_exec && !target_can_async_p ())
1114 error (_("Asynchronous execution not supported on this target."));
1115
1116 /* If we are not asked to run in the bg, then prepare to run in the
1117 foreground, synchronously. */
1118 if (!async_exec && target_can_async_p ())
1119 {
1120 /* Simulate synchronous execution */
1121 async_disable_stdin ();
1122 }
1123
1124 if (arg)
1125 until_break_command (arg, from_tty, 0);
1126 else
1127 until_next_command (from_tty);
1128 }
1129
1130 static void
1131 advance_command (char *arg, int from_tty)
1132 {
1133 int async_exec = 0;
1134
1135 if (!target_has_execution)
1136 error (_("The program is not running."));
1137
1138 if (arg == NULL)
1139 error_no_arg (_("a location"));
1140
1141 /* Find out whether we must run in the background. */
1142 if (arg != NULL)
1143 async_exec = strip_bg_char (&arg);
1144
1145 /* If we must run in the background, but the target can't do it,
1146 error out. */
1147 if (async_exec && !target_can_async_p ())
1148 error (_("Asynchronous execution not supported on this target."));
1149
1150 /* If we are not asked to run in the bg, then prepare to run in the
1151 foreground, synchronously. */
1152 if (!async_exec && target_can_async_p ())
1153 {
1154 /* Simulate synchronous execution. */
1155 async_disable_stdin ();
1156 }
1157
1158 until_break_command (arg, from_tty, 1);
1159 }
1160 \f
1161 /* Print the result of a function at the end of a 'finish' command. */
1162
1163 static void
1164 print_return_value (struct type *value_type)
1165 {
1166 struct gdbarch *gdbarch = current_gdbarch;
1167 struct cleanup *old_chain;
1168 struct ui_stream *stb;
1169 struct value *value;
1170
1171 CHECK_TYPEDEF (value_type);
1172 gdb_assert (TYPE_CODE (value_type) != TYPE_CODE_VOID);
1173
1174 /* FIXME: 2003-09-27: When returning from a nested inferior function
1175 call, it's possible (with no help from the architecture vector)
1176 to locate and return/print a "struct return" value. This is just
1177 a more complicated case of what is already being done in in the
1178 inferior function call code. In fact, when inferior function
1179 calls are made async, this will likely be made the norm. */
1180
1181 switch (gdbarch_return_value (gdbarch, value_type, NULL, NULL, NULL))
1182 {
1183 case RETURN_VALUE_REGISTER_CONVENTION:
1184 case RETURN_VALUE_ABI_RETURNS_ADDRESS:
1185 case RETURN_VALUE_ABI_PRESERVES_ADDRESS:
1186 value = allocate_value (value_type);
1187 gdbarch_return_value (gdbarch, value_type, stop_registers,
1188 value_contents_raw (value), NULL);
1189 break;
1190 case RETURN_VALUE_STRUCT_CONVENTION:
1191 value = NULL;
1192 break;
1193 default:
1194 internal_error (__FILE__, __LINE__, _("bad switch"));
1195 }
1196
1197 if (value)
1198 {
1199 /* Print it. */
1200 stb = ui_out_stream_new (uiout);
1201 old_chain = make_cleanup_ui_out_stream_delete (stb);
1202 ui_out_text (uiout, "Value returned is ");
1203 ui_out_field_fmt (uiout, "gdb-result-var", "$%d",
1204 record_latest_value (value));
1205 ui_out_text (uiout, " = ");
1206 value_print (value, stb->stream, 0, Val_no_prettyprint);
1207 ui_out_field_stream (uiout, "return-value", stb);
1208 ui_out_text (uiout, "\n");
1209 do_cleanups (old_chain);
1210 }
1211 else
1212 {
1213 ui_out_text (uiout, "Value returned has type: ");
1214 ui_out_field_string (uiout, "return-type", TYPE_NAME (value_type));
1215 ui_out_text (uiout, ".");
1216 ui_out_text (uiout, " Cannot determine contents\n");
1217 }
1218 }
1219
1220 /* Stuff that needs to be done by the finish command after the target
1221 has stopped. In asynchronous mode, we wait for the target to stop
1222 in the call to poll or select in the event loop, so it is
1223 impossible to do all the stuff as part of the finish_command
1224 function itself. The only chance we have to complete this command
1225 is in fetch_inferior_event, which is called by the event loop as
1226 soon as it detects that the target has stopped. This function is
1227 called via the cmd_continuation pointer. */
1228
1229 static void
1230 finish_command_continuation (struct continuation_arg *arg)
1231 {
1232 struct symbol *function;
1233 struct breakpoint *breakpoint;
1234 struct cleanup *cleanups;
1235
1236 breakpoint = (struct breakpoint *) arg->data.pointer;
1237 function = (struct symbol *) arg->next->data.pointer;
1238 cleanups = (struct cleanup *) arg->next->next->data.pointer;
1239
1240 if (bpstat_find_breakpoint (stop_bpstat, breakpoint) != NULL
1241 && function != NULL)
1242 {
1243 struct type *value_type;
1244
1245 value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function));
1246 if (!value_type)
1247 internal_error (__FILE__, __LINE__,
1248 _("finish_command: function has no target type"));
1249
1250 if (TYPE_CODE (value_type) != TYPE_CODE_VOID)
1251 print_return_value (value_type);
1252 }
1253
1254 do_exec_cleanups (cleanups);
1255 }
1256
1257 /* "finish": Set a temporary breakpoint at the place the selected
1258 frame will return to, then continue. */
1259
1260 static void
1261 finish_command (char *arg, int from_tty)
1262 {
1263 struct symtab_and_line sal;
1264 struct frame_info *frame;
1265 struct symbol *function;
1266 struct breakpoint *breakpoint;
1267 struct cleanup *old_chain;
1268 struct continuation_arg *arg1, *arg2, *arg3;
1269
1270 int async_exec = 0;
1271
1272 /* Find out whether we must run in the background. */
1273 if (arg != NULL)
1274 async_exec = strip_bg_char (&arg);
1275
1276 /* If we must run in the background, but the target can't do it,
1277 error out. */
1278 if (async_exec && !target_can_async_p ())
1279 error (_("Asynchronous execution not supported on this target."));
1280
1281 /* If we are not asked to run in the bg, then prepare to run in the
1282 foreground, synchronously. */
1283 if (!async_exec && target_can_async_p ())
1284 {
1285 /* Simulate synchronous execution. */
1286 async_disable_stdin ();
1287 }
1288
1289 if (arg)
1290 error (_("The \"finish\" command does not take any arguments."));
1291 if (!target_has_execution)
1292 error (_("The program is not running."));
1293
1294 frame = get_prev_frame (get_selected_frame (_("No selected frame.")));
1295 if (frame == 0)
1296 error (_("\"finish\" not meaningful in the outermost frame."));
1297
1298 clear_proceed_status ();
1299
1300 sal = find_pc_line (get_frame_pc (frame), 0);
1301 sal.pc = get_frame_pc (frame);
1302
1303 breakpoint = set_momentary_breakpoint (sal, get_frame_id (frame), bp_finish);
1304
1305 if (!target_can_async_p ())
1306 old_chain = make_cleanup_delete_breakpoint (breakpoint);
1307 else
1308 old_chain = make_exec_cleanup_delete_breakpoint (breakpoint);
1309
1310 /* Find the function we will return from. */
1311
1312 function = find_pc_function (get_frame_pc (get_selected_frame (NULL)));
1313
1314 /* Print info on the selected frame, including level number but not
1315 source. */
1316 if (from_tty)
1317 {
1318 printf_filtered (_("Run till exit from "));
1319 print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
1320 }
1321
1322 /* If running asynchronously and the target support asynchronous
1323 execution, set things up for the rest of the finish command to be
1324 completed later on, when gdb has detected that the target has
1325 stopped, in fetch_inferior_event. */
1326 if (target_can_async_p ())
1327 {
1328 arg1 =
1329 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
1330 arg2 =
1331 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
1332 arg3 =
1333 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
1334 arg1->next = arg2;
1335 arg2->next = arg3;
1336 arg3->next = NULL;
1337 arg1->data.pointer = breakpoint;
1338 arg2->data.pointer = function;
1339 arg3->data.pointer = old_chain;
1340 add_continuation (finish_command_continuation, arg1);
1341 }
1342
1343 proceed_to_finish = 1; /* We want stop_registers, please... */
1344 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
1345
1346 /* Do this only if not running asynchronously or if the target
1347 cannot do async execution. Otherwise, complete this command when
1348 the target actually stops, in fetch_inferior_event. */
1349 if (!target_can_async_p ())
1350 {
1351 /* Did we stop at our breakpoint? */
1352 if (bpstat_find_breakpoint (stop_bpstat, breakpoint) != NULL
1353 && function != NULL)
1354 {
1355 struct type *value_type;
1356
1357 value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function));
1358 if (!value_type)
1359 internal_error (__FILE__, __LINE__,
1360 _("finish_command: function has no target type"));
1361
1362 if (TYPE_CODE (value_type) != TYPE_CODE_VOID)
1363 print_return_value (value_type);
1364 }
1365
1366 do_cleanups (old_chain);
1367 }
1368 }
1369 \f
1370
1371 static void
1372 program_info (char *args, int from_tty)
1373 {
1374 bpstat bs = stop_bpstat;
1375 int num;
1376 int stat = bpstat_num (&bs, &num);
1377
1378 if (!target_has_execution)
1379 {
1380 printf_filtered (_("The program being debugged is not being run.\n"));
1381 return;
1382 }
1383
1384 target_files_info ();
1385 printf_filtered (_("Program stopped at %s.\n"),
1386 hex_string ((unsigned long) stop_pc));
1387 if (stop_step)
1388 printf_filtered (_("It stopped after being stepped.\n"));
1389 else if (stat != 0)
1390 {
1391 /* There may be several breakpoints in the same place, so this
1392 isn't as strange as it seems. */
1393 while (stat != 0)
1394 {
1395 if (stat < 0)
1396 {
1397 printf_filtered (_("\
1398 It stopped at a breakpoint that has since been deleted.\n"));
1399 }
1400 else
1401 printf_filtered (_("It stopped at breakpoint %d.\n"), num);
1402 stat = bpstat_num (&bs, &num);
1403 }
1404 }
1405 else if (stop_signal != TARGET_SIGNAL_0)
1406 {
1407 printf_filtered (_("It stopped with signal %s, %s.\n"),
1408 target_signal_to_name (stop_signal),
1409 target_signal_to_string (stop_signal));
1410 }
1411
1412 if (!from_tty)
1413 {
1414 printf_filtered (_("\
1415 Type \"info stack\" or \"info registers\" for more information.\n"));
1416 }
1417 }
1418 \f
1419 static void
1420 environment_info (char *var, int from_tty)
1421 {
1422 if (var)
1423 {
1424 char *val = get_in_environ (inferior_environ, var);
1425 if (val)
1426 {
1427 puts_filtered (var);
1428 puts_filtered (" = ");
1429 puts_filtered (val);
1430 puts_filtered ("\n");
1431 }
1432 else
1433 {
1434 puts_filtered ("Environment variable \"");
1435 puts_filtered (var);
1436 puts_filtered ("\" not defined.\n");
1437 }
1438 }
1439 else
1440 {
1441 char **vector = environ_vector (inferior_environ);
1442 while (*vector)
1443 {
1444 puts_filtered (*vector++);
1445 puts_filtered ("\n");
1446 }
1447 }
1448 }
1449
1450 static void
1451 set_environment_command (char *arg, int from_tty)
1452 {
1453 char *p, *val, *var;
1454 int nullset = 0;
1455
1456 if (arg == 0)
1457 error_no_arg (_("environment variable and value"));
1458
1459 /* Find seperation between variable name and value */
1460 p = (char *) strchr (arg, '=');
1461 val = (char *) strchr (arg, ' ');
1462
1463 if (p != 0 && val != 0)
1464 {
1465 /* We have both a space and an equals. If the space is before the
1466 equals, walk forward over the spaces til we see a nonspace
1467 (possibly the equals). */
1468 if (p > val)
1469 while (*val == ' ')
1470 val++;
1471
1472 /* Now if the = is after the char following the spaces,
1473 take the char following the spaces. */
1474 if (p > val)
1475 p = val - 1;
1476 }
1477 else if (val != 0 && p == 0)
1478 p = val;
1479
1480 if (p == arg)
1481 error_no_arg (_("environment variable to set"));
1482
1483 if (p == 0 || p[1] == 0)
1484 {
1485 nullset = 1;
1486 if (p == 0)
1487 p = arg + strlen (arg); /* So that savestring below will work */
1488 }
1489 else
1490 {
1491 /* Not setting variable value to null */
1492 val = p + 1;
1493 while (*val == ' ' || *val == '\t')
1494 val++;
1495 }
1496
1497 while (p != arg && (p[-1] == ' ' || p[-1] == '\t'))
1498 p--;
1499
1500 var = savestring (arg, p - arg);
1501 if (nullset)
1502 {
1503 printf_filtered (_("\
1504 Setting environment variable \"%s\" to null value.\n"),
1505 var);
1506 set_in_environ (inferior_environ, var, "");
1507 }
1508 else
1509 set_in_environ (inferior_environ, var, val);
1510 xfree (var);
1511 }
1512
1513 static void
1514 unset_environment_command (char *var, int from_tty)
1515 {
1516 if (var == 0)
1517 {
1518 /* If there is no argument, delete all environment variables.
1519 Ask for confirmation if reading from the terminal. */
1520 if (!from_tty || query (_("Delete all environment variables? ")))
1521 {
1522 free_environ (inferior_environ);
1523 inferior_environ = make_environ ();
1524 }
1525 }
1526 else
1527 unset_in_environ (inferior_environ, var);
1528 }
1529
1530 /* Handle the execution path (PATH variable) */
1531
1532 static const char path_var_name[] = "PATH";
1533
1534 static void
1535 path_info (char *args, int from_tty)
1536 {
1537 puts_filtered ("Executable and object file path: ");
1538 puts_filtered (get_in_environ (inferior_environ, path_var_name));
1539 puts_filtered ("\n");
1540 }
1541
1542 /* Add zero or more directories to the front of the execution path. */
1543
1544 static void
1545 path_command (char *dirname, int from_tty)
1546 {
1547 char *exec_path;
1548 char *env;
1549 dont_repeat ();
1550 env = get_in_environ (inferior_environ, path_var_name);
1551 /* Can be null if path is not set */
1552 if (!env)
1553 env = "";
1554 exec_path = xstrdup (env);
1555 mod_path (dirname, &exec_path);
1556 set_in_environ (inferior_environ, path_var_name, exec_path);
1557 xfree (exec_path);
1558 if (from_tty)
1559 path_info ((char *) NULL, from_tty);
1560 }
1561 \f
1562
1563 /* Print out the machine register regnum. If regnum is -1, print all
1564 registers (print_all == 1) or all non-float and non-vector
1565 registers (print_all == 0).
1566
1567 For most machines, having all_registers_info() print the
1568 register(s) one per line is good enough. If a different format is
1569 required, (eg, for MIPS or Pyramid 90x, which both have lots of
1570 regs), or there is an existing convention for showing all the
1571 registers, define the architecture method PRINT_REGISTERS_INFO to
1572 provide that format. */
1573
1574 void
1575 default_print_registers_info (struct gdbarch *gdbarch,
1576 struct ui_file *file,
1577 struct frame_info *frame,
1578 int regnum, int print_all)
1579 {
1580 int i;
1581 const int numregs = gdbarch_num_regs (gdbarch)
1582 + gdbarch_num_pseudo_regs (gdbarch);
1583 gdb_byte buffer[MAX_REGISTER_SIZE];
1584
1585 for (i = 0; i < numregs; i++)
1586 {
1587 /* Decide between printing all regs, non-float / vector regs, or
1588 specific reg. */
1589 if (regnum == -1)
1590 {
1591 if (print_all)
1592 {
1593 if (!gdbarch_register_reggroup_p (gdbarch, i, all_reggroup))
1594 continue;
1595 }
1596 else
1597 {
1598 if (!gdbarch_register_reggroup_p (gdbarch, i, general_reggroup))
1599 continue;
1600 }
1601 }
1602 else
1603 {
1604 if (i != regnum)
1605 continue;
1606 }
1607
1608 /* If the register name is empty, it is undefined for this
1609 processor, so don't display anything. */
1610 if (gdbarch_register_name (gdbarch, i) == NULL
1611 || *(gdbarch_register_name (gdbarch, i)) == '\0')
1612 continue;
1613
1614 fputs_filtered (gdbarch_register_name (gdbarch, i), file);
1615 print_spaces_filtered (15 - strlen (gdbarch_register_name
1616 (gdbarch, i)), file);
1617
1618 /* Get the data in raw format. */
1619 if (! frame_register_read (frame, i, buffer))
1620 {
1621 fprintf_filtered (file, "*value not available*\n");
1622 continue;
1623 }
1624
1625 /* If virtual format is floating, print it that way, and in raw
1626 hex. */
1627 if (TYPE_CODE (register_type (gdbarch, i)) == TYPE_CODE_FLT)
1628 {
1629 int j;
1630
1631 val_print (register_type (gdbarch, i), buffer, 0, 0,
1632 file, 0, 1, 0, Val_pretty_default);
1633
1634 fprintf_filtered (file, "\t(raw 0x");
1635 for (j = 0; j < register_size (gdbarch, i); j++)
1636 {
1637 int idx;
1638 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
1639 idx = j;
1640 else
1641 idx = register_size (gdbarch, i) - 1 - j;
1642 fprintf_filtered (file, "%02x", (unsigned char) buffer[idx]);
1643 }
1644 fprintf_filtered (file, ")");
1645 }
1646 else
1647 {
1648 /* Print the register in hex. */
1649 val_print (register_type (gdbarch, i), buffer, 0, 0,
1650 file, 'x', 1, 0, Val_pretty_default);
1651 /* If not a vector register, print it also according to its
1652 natural format. */
1653 if (TYPE_VECTOR (register_type (gdbarch, i)) == 0)
1654 {
1655 fprintf_filtered (file, "\t");
1656 val_print (register_type (gdbarch, i), buffer, 0, 0,
1657 file, 0, 1, 0, Val_pretty_default);
1658 }
1659 }
1660
1661 fprintf_filtered (file, "\n");
1662 }
1663 }
1664
1665 void
1666 registers_info (char *addr_exp, int fpregs)
1667 {
1668 struct frame_info *frame;
1669 struct gdbarch *gdbarch;
1670 int regnum, numregs;
1671 char *end;
1672
1673 if (!target_has_registers)
1674 error (_("The program has no registers now."));
1675 frame = get_selected_frame (NULL);
1676 gdbarch = get_frame_arch (frame);
1677
1678 if (!addr_exp)
1679 {
1680 gdbarch_print_registers_info (gdbarch, gdb_stdout,
1681 frame, -1, fpregs);
1682 return;
1683 }
1684
1685 while (*addr_exp != '\0')
1686 {
1687 char *start;
1688 const char *end;
1689
1690 /* Keep skipping leading white space. */
1691 if (isspace ((*addr_exp)))
1692 {
1693 addr_exp++;
1694 continue;
1695 }
1696
1697 /* Discard any leading ``$''. Check that there is something
1698 resembling a register following it. */
1699 if (addr_exp[0] == '$')
1700 addr_exp++;
1701 if (isspace ((*addr_exp)) || (*addr_exp) == '\0')
1702 error (_("Missing register name"));
1703
1704 /* Find the start/end of this register name/num/group. */
1705 start = addr_exp;
1706 while ((*addr_exp) != '\0' && !isspace ((*addr_exp)))
1707 addr_exp++;
1708 end = addr_exp;
1709
1710 /* Figure out what we've found and display it. */
1711
1712 /* A register name? */
1713 {
1714 int regnum = frame_map_name_to_regnum (frame, start, end - start);
1715 if (regnum >= 0)
1716 {
1717 /* User registers lie completely outside of the range of
1718 normal registers. Catch them early so that the target
1719 never sees them. */
1720 if (regnum >= gdbarch_num_regs (gdbarch)
1721 + gdbarch_num_pseudo_regs (gdbarch))
1722 {
1723 struct value *val = value_of_user_reg (regnum, frame);
1724
1725 printf_filtered ("%s: ", start);
1726 print_scalar_formatted (value_contents (val),
1727 check_typedef (value_type (val)),
1728 'x', 0, gdb_stdout);
1729 printf_filtered ("\n");
1730 }
1731 else
1732 gdbarch_print_registers_info (gdbarch, gdb_stdout,
1733 frame, regnum, fpregs);
1734 continue;
1735 }
1736 }
1737
1738 /* A register number? (how portable is this one?). */
1739 {
1740 char *endptr;
1741 int regnum = strtol (start, &endptr, 0);
1742 if (endptr == end
1743 && regnum >= 0
1744 && regnum < gdbarch_num_regs (gdbarch)
1745 + gdbarch_num_pseudo_regs (gdbarch))
1746 {
1747 gdbarch_print_registers_info (gdbarch, gdb_stdout,
1748 frame, regnum, fpregs);
1749 continue;
1750 }
1751 }
1752
1753 /* A register group? */
1754 {
1755 struct reggroup *group;
1756 for (group = reggroup_next (gdbarch, NULL);
1757 group != NULL;
1758 group = reggroup_next (gdbarch, group))
1759 {
1760 /* Don't bother with a length check. Should the user
1761 enter a short register group name, go with the first
1762 group that matches. */
1763 if (strncmp (start, reggroup_name (group), end - start) == 0)
1764 break;
1765 }
1766 if (group != NULL)
1767 {
1768 int regnum;
1769 for (regnum = 0;
1770 regnum < gdbarch_num_regs (gdbarch)
1771 + gdbarch_num_pseudo_regs (gdbarch);
1772 regnum++)
1773 {
1774 if (gdbarch_register_reggroup_p (gdbarch, regnum, group))
1775 gdbarch_print_registers_info (gdbarch,
1776 gdb_stdout, frame,
1777 regnum, fpregs);
1778 }
1779 continue;
1780 }
1781 }
1782
1783 /* Nothing matched. */
1784 error (_("Invalid register `%.*s'"), (int) (end - start), start);
1785 }
1786 }
1787
1788 void
1789 all_registers_info (char *addr_exp, int from_tty)
1790 {
1791 registers_info (addr_exp, 1);
1792 }
1793
1794 static void
1795 nofp_registers_info (char *addr_exp, int from_tty)
1796 {
1797 registers_info (addr_exp, 0);
1798 }
1799
1800 static void
1801 print_vector_info (struct gdbarch *gdbarch, struct ui_file *file,
1802 struct frame_info *frame, const char *args)
1803 {
1804 if (gdbarch_print_vector_info_p (gdbarch))
1805 gdbarch_print_vector_info (gdbarch, file, frame, args);
1806 else
1807 {
1808 int regnum;
1809 int printed_something = 0;
1810
1811 for (regnum = 0;
1812 regnum < gdbarch_num_regs (gdbarch)
1813 + gdbarch_num_pseudo_regs (gdbarch);
1814 regnum++)
1815 {
1816 if (gdbarch_register_reggroup_p (gdbarch, regnum, vector_reggroup))
1817 {
1818 printed_something = 1;
1819 gdbarch_print_registers_info (gdbarch, file, frame, regnum, 1);
1820 }
1821 }
1822 if (!printed_something)
1823 fprintf_filtered (file, "No vector information\n");
1824 }
1825 }
1826
1827 static void
1828 vector_info (char *args, int from_tty)
1829 {
1830 if (!target_has_registers)
1831 error (_("The program has no registers now."));
1832
1833 print_vector_info (current_gdbarch, gdb_stdout,
1834 get_selected_frame (NULL), args);
1835 }
1836 \f
1837
1838 /*
1839 * TODO:
1840 * Should save/restore the tty state since it might be that the
1841 * program to be debugged was started on this tty and it wants
1842 * the tty in some state other than what we want. If it's running
1843 * on another terminal or without a terminal, then saving and
1844 * restoring the tty state is a harmless no-op.
1845 * This only needs to be done if we are attaching to a process.
1846 */
1847
1848 /*
1849 attach_command --
1850 takes a program started up outside of gdb and ``attaches'' to it.
1851 This stops it cold in its tracks and allows us to start debugging it.
1852 and wait for the trace-trap that results from attaching. */
1853
1854 void
1855 attach_command (char *args, int from_tty)
1856 {
1857 char *exec_file;
1858 char *full_exec_path = NULL;
1859
1860 dont_repeat (); /* Not for the faint of heart */
1861
1862 if (target_has_execution)
1863 {
1864 if (query ("A program is being debugged already. Kill it? "))
1865 target_kill ();
1866 else
1867 error (_("Not killed."));
1868 }
1869
1870 /* Clean up any leftovers from other runs. Some other things from
1871 this function should probably be moved into target_pre_inferior. */
1872 target_pre_inferior (from_tty);
1873
1874 /* Clear out solib state. Otherwise the solib state of the previous
1875 inferior might have survived and is entirely wrong for the new
1876 target. This has been observed on GNU/Linux using glibc 2.3. How
1877 to reproduce:
1878
1879 bash$ ./foo&
1880 [1] 4711
1881 bash$ ./foo&
1882 [1] 4712
1883 bash$ gdb ./foo
1884 [...]
1885 (gdb) attach 4711
1886 (gdb) detach
1887 (gdb) attach 4712
1888 Cannot access memory at address 0xdeadbeef
1889 */
1890 clear_solib ();
1891
1892 target_attach (args, from_tty);
1893
1894 /* Set up the "saved terminal modes" of the inferior
1895 based on what modes we are starting it with. */
1896 target_terminal_init ();
1897
1898 /* Set up execution context to know that we should return from
1899 wait_for_inferior as soon as the target reports a stop. */
1900 init_wait_for_inferior ();
1901 clear_proceed_status ();
1902
1903 /* No traps are generated when attaching to inferior under Mach 3
1904 or GNU hurd. */
1905 #ifndef ATTACH_NO_WAIT
1906 /* Careful here. See comments in inferior.h. Basically some OSes
1907 don't ignore SIGSTOPs on continue requests anymore. We need a
1908 way for handle_inferior_event to reset the stop_signal variable
1909 after an attach, and this is what STOP_QUIETLY_NO_SIGSTOP is for. */
1910 stop_soon = STOP_QUIETLY_NO_SIGSTOP;
1911 wait_for_inferior ();
1912 stop_soon = NO_STOP_QUIETLY;
1913 #endif
1914
1915 /*
1916 * If no exec file is yet known, try to determine it from the
1917 * process itself.
1918 */
1919 exec_file = (char *) get_exec_file (0);
1920 if (!exec_file)
1921 {
1922 exec_file = target_pid_to_exec_file (PIDGET (inferior_ptid));
1923 if (exec_file)
1924 {
1925 /* It's possible we don't have a full path, but rather just a
1926 filename. Some targets, such as HP-UX, don't provide the
1927 full path, sigh.
1928
1929 Attempt to qualify the filename against the source path.
1930 (If that fails, we'll just fall back on the original
1931 filename. Not much more we can do...)
1932 */
1933 if (!source_full_path_of (exec_file, &full_exec_path))
1934 full_exec_path = savestring (exec_file, strlen (exec_file));
1935
1936 exec_file_attach (full_exec_path, from_tty);
1937 symbol_file_add_main (full_exec_path, from_tty);
1938 }
1939 }
1940 else
1941 {
1942 reopen_exec_file ();
1943 reread_symbols ();
1944 }
1945
1946 /* Take any necessary post-attaching actions for this platform.
1947 */
1948 target_post_attach (PIDGET (inferior_ptid));
1949
1950 post_create_inferior (&current_target, from_tty);
1951
1952 /* Install inferior's terminal modes. */
1953 target_terminal_inferior ();
1954
1955 normal_stop ();
1956
1957 if (deprecated_attach_hook)
1958 deprecated_attach_hook ();
1959 }
1960
1961 /*
1962 * detach_command --
1963 * takes a program previously attached to and detaches it.
1964 * The program resumes execution and will no longer stop
1965 * on signals, etc. We better not have left any breakpoints
1966 * in the program or it'll die when it hits one. For this
1967 * to work, it may be necessary for the process to have been
1968 * previously attached. It *might* work if the program was
1969 * started via the normal ptrace (PTRACE_TRACEME).
1970 */
1971
1972 static void
1973 detach_command (char *args, int from_tty)
1974 {
1975 dont_repeat (); /* Not for the faint of heart. */
1976 target_detach (args, from_tty);
1977 #if defined(SOLIB_RESTART)
1978 SOLIB_RESTART ();
1979 #endif
1980 if (deprecated_detach_hook)
1981 deprecated_detach_hook ();
1982 }
1983
1984 /* Disconnect from the current target without resuming it (leaving it
1985 waiting for a debugger).
1986
1987 We'd better not have left any breakpoints in the program or the
1988 next debugger will get confused. Currently only supported for some
1989 remote targets, since the normal attach mechanisms don't work on
1990 stopped processes on some native platforms (e.g. GNU/Linux). */
1991
1992 static void
1993 disconnect_command (char *args, int from_tty)
1994 {
1995 dont_repeat (); /* Not for the faint of heart */
1996 target_disconnect (args, from_tty);
1997 #if defined(SOLIB_RESTART)
1998 SOLIB_RESTART ();
1999 #endif
2000 if (deprecated_detach_hook)
2001 deprecated_detach_hook ();
2002 }
2003
2004 /* Stop the execution of the target while running in async mode, in
2005 the backgound. */
2006 void
2007 interrupt_target_command (char *args, int from_tty)
2008 {
2009 if (target_can_async_p ())
2010 {
2011 dont_repeat (); /* Not for the faint of heart */
2012 target_stop ();
2013 }
2014 }
2015
2016 static void
2017 print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
2018 struct frame_info *frame, const char *args)
2019 {
2020 if (gdbarch_print_float_info_p (gdbarch))
2021 gdbarch_print_float_info (gdbarch, file, frame, args);
2022 else
2023 {
2024 int regnum;
2025 int printed_something = 0;
2026
2027 for (regnum = 0;
2028 regnum < gdbarch_num_regs (gdbarch)
2029 + gdbarch_num_pseudo_regs (gdbarch);
2030 regnum++)
2031 {
2032 if (gdbarch_register_reggroup_p (gdbarch, regnum, float_reggroup))
2033 {
2034 printed_something = 1;
2035 gdbarch_print_registers_info (gdbarch, file, frame, regnum, 1);
2036 }
2037 }
2038 if (!printed_something)
2039 fprintf_filtered (file, "\
2040 No floating-point info available for this processor.\n");
2041 }
2042 }
2043
2044 static void
2045 float_info (char *args, int from_tty)
2046 {
2047 if (!target_has_registers)
2048 error (_("The program has no registers now."));
2049
2050 print_float_info (current_gdbarch, gdb_stdout,
2051 get_selected_frame (NULL), args);
2052 }
2053 \f
2054 static void
2055 unset_command (char *args, int from_tty)
2056 {
2057 printf_filtered (_("\
2058 \"unset\" must be followed by the name of an unset subcommand.\n"));
2059 help_list (unsetlist, "unset ", -1, gdb_stdout);
2060 }
2061
2062 void
2063 _initialize_infcmd (void)
2064 {
2065 struct cmd_list_element *c = NULL;
2066
2067 /* add the filename of the terminal connected to inferior I/O */
2068 add_setshow_filename_cmd ("inferior-tty", class_run,
2069 &inferior_io_terminal, _("\
2070 Set terminal for future runs of program being debugged."), _("\
2071 Show terminal for future runs of program being debugged."), _("\
2072 Usage: set inferior-tty /dev/pts/1"), NULL, NULL, &setlist, &showlist);
2073 add_com_alias ("tty", "set inferior-tty", class_alias, 0);
2074
2075 add_setshow_optional_filename_cmd ("args", class_run,
2076 &inferior_args, _("\
2077 Set argument list to give program being debugged when it is started."), _("\
2078 Show argument list to give program being debugged when it is started."), _("\
2079 Follow this command with any number of args, to be passed to the program."),
2080 notice_args_set,
2081 notice_args_read,
2082 &setlist, &showlist);
2083
2084 c = add_cmd ("environment", no_class, environment_info, _("\
2085 The environment to give the program, or one variable's value.\n\
2086 With an argument VAR, prints the value of environment variable VAR to\n\
2087 give the program being debugged. With no arguments, prints the entire\n\
2088 environment to be given to the program."), &showlist);
2089 set_cmd_completer (c, noop_completer);
2090
2091 add_prefix_cmd ("unset", no_class, unset_command,
2092 _("Complement to certain \"set\" commands."),
2093 &unsetlist, "unset ", 0, &cmdlist);
2094
2095 c = add_cmd ("environment", class_run, unset_environment_command, _("\
2096 Cancel environment variable VAR for the program.\n\
2097 This does not affect the program until the next \"run\" command."),
2098 &unsetlist);
2099 set_cmd_completer (c, noop_completer);
2100
2101 c = add_cmd ("environment", class_run, set_environment_command, _("\
2102 Set environment variable value to give the program.\n\
2103 Arguments are VAR VALUE where VAR is variable name and VALUE is value.\n\
2104 VALUES of environment variables are uninterpreted strings.\n\
2105 This does not affect the program until the next \"run\" command."),
2106 &setlist);
2107 set_cmd_completer (c, noop_completer);
2108
2109 c = add_com ("path", class_files, path_command, _("\
2110 Add directory DIR(s) to beginning of search path for object files.\n\
2111 $cwd in the path means the current working directory.\n\
2112 This path is equivalent to the $PATH shell variable. It is a list of\n\
2113 directories, separated by colons. These directories are searched to find\n\
2114 fully linked executable files and separately compiled object files as needed."));
2115 set_cmd_completer (c, filename_completer);
2116
2117 c = add_cmd ("paths", no_class, path_info, _("\
2118 Current search path for finding object files.\n\
2119 $cwd in the path means the current working directory.\n\
2120 This path is equivalent to the $PATH shell variable. It is a list of\n\
2121 directories, separated by colons. These directories are searched to find\n\
2122 fully linked executable files and separately compiled object files as needed."),
2123 &showlist);
2124 set_cmd_completer (c, noop_completer);
2125
2126 add_com ("attach", class_run, attach_command, _("\
2127 Attach to a process or file outside of GDB.\n\
2128 This command attaches to another target, of the same type as your last\n\
2129 \"target\" command (\"info files\" will show your target stack).\n\
2130 The command may take as argument a process id or a device file.\n\
2131 For a process id, you must have permission to send the process a signal,\n\
2132 and it must have the same effective uid as the debugger.\n\
2133 When using \"attach\" with a process id, the debugger finds the\n\
2134 program running in the process, looking first in the current working\n\
2135 directory, or (if not found there) using the source file search path\n\
2136 (see the \"directory\" command). You can also use the \"file\" command\n\
2137 to specify the program, and to load its symbol table."));
2138
2139 add_prefix_cmd ("detach", class_run, detach_command, _("\
2140 Detach a process or file previously attached.\n\
2141 If a process, it is no longer traced, and it continues its execution. If\n\
2142 you were debugging a file, the file is closed and gdb no longer accesses it."),
2143 &detachlist, "detach ", 0, &cmdlist);
2144
2145 add_com ("disconnect", class_run, disconnect_command, _("\
2146 Disconnect from a target.\n\
2147 The target will wait for another debugger to connect. Not available for\n\
2148 all targets."));
2149
2150 add_com ("signal", class_run, signal_command, _("\
2151 Continue program giving it signal specified by the argument.\n\
2152 An argument of \"0\" means continue program without giving it a signal."));
2153
2154 add_com ("stepi", class_run, stepi_command, _("\
2155 Step one instruction exactly.\n\
2156 Argument N means do this N times (or till program stops for another reason)."));
2157 add_com_alias ("si", "stepi", class_alias, 0);
2158
2159 add_com ("nexti", class_run, nexti_command, _("\
2160 Step one instruction, but proceed through subroutine calls.\n\
2161 Argument N means do this N times (or till program stops for another reason)."));
2162 add_com_alias ("ni", "nexti", class_alias, 0);
2163
2164 add_com ("finish", class_run, finish_command, _("\
2165 Execute until selected stack frame returns.\n\
2166 Upon return, the value returned is printed and put in the value history."));
2167
2168 add_com ("next", class_run, next_command, _("\
2169 Step program, proceeding through subroutine calls.\n\
2170 Like the \"step\" command as long as subroutine calls do not happen;\n\
2171 when they do, the call is treated as one instruction.\n\
2172 Argument N means do this N times (or till program stops for another reason)."));
2173 add_com_alias ("n", "next", class_run, 1);
2174 if (xdb_commands)
2175 add_com_alias ("S", "next", class_run, 1);
2176
2177 add_com ("step", class_run, step_command, _("\
2178 Step program until it reaches a different source line.\n\
2179 Argument N means do this N times (or till program stops for another reason)."));
2180 add_com_alias ("s", "step", class_run, 1);
2181
2182 c = add_com ("until", class_run, until_command, _("\
2183 Execute until the program reaches a source line greater than the current\n\
2184 or a specified location (same args as break command) within the current frame."));
2185 set_cmd_completer (c, location_completer);
2186 add_com_alias ("u", "until", class_run, 1);
2187
2188 c = add_com ("advance", class_run, advance_command, _("\
2189 Continue the program up to the given location (same form as args for break command).\n\
2190 Execution will also stop upon exit from the current stack frame."));
2191 set_cmd_completer (c, location_completer);
2192
2193 c = add_com ("jump", class_run, jump_command, _("\
2194 Continue program being debugged at specified line or address.\n\
2195 Give as argument either LINENUM or *ADDR, where ADDR is an expression\n\
2196 for an address to start at."));
2197 set_cmd_completer (c, location_completer);
2198
2199 if (xdb_commands)
2200 {
2201 c = add_com ("go", class_run, go_command, _("\
2202 Usage: go <location>\n\
2203 Continue program being debugged, stopping at specified line or \n\
2204 address.\n\
2205 Give as argument either LINENUM or *ADDR, where ADDR is an \n\
2206 expression for an address to start at.\n\
2207 This command is a combination of tbreak and jump."));
2208 set_cmd_completer (c, location_completer);
2209 }
2210
2211 if (xdb_commands)
2212 add_com_alias ("g", "go", class_run, 1);
2213
2214 add_com ("continue", class_run, continue_command, _("\
2215 Continue program being debugged, after signal or breakpoint.\n\
2216 If proceeding from breakpoint, a number N may be used as an argument,\n\
2217 which means to set the ignore count of that breakpoint to N - 1 (so that\n\
2218 the breakpoint won't break until the Nth time it is reached)."));
2219 add_com_alias ("c", "cont", class_run, 1);
2220 add_com_alias ("fg", "cont", class_run, 1);
2221
2222 c = add_com ("run", class_run, run_command, _("\
2223 Start debugged program. You may specify arguments to give it.\n\
2224 Args may include \"*\", or \"[...]\"; they are expanded using \"sh\".\n\
2225 Input and output redirection with \">\", \"<\", or \">>\" are also allowed.\n\n\
2226 With no arguments, uses arguments last specified (with \"run\" or \"set args\").\n\
2227 To cancel previous arguments and run with no arguments,\n\
2228 use \"set args\" without arguments."));
2229 set_cmd_completer (c, filename_completer);
2230 add_com_alias ("r", "run", class_run, 1);
2231 if (xdb_commands)
2232 add_com ("R", class_run, run_no_args_command,
2233 _("Start debugged program with no arguments."));
2234
2235 c = add_com ("start", class_run, start_command, _("\
2236 Run the debugged program until the beginning of the main procedure.\n\
2237 You may specify arguments to give to your program, just as with the\n\
2238 \"run\" command."));
2239 set_cmd_completer (c, filename_completer);
2240
2241 add_com ("interrupt", class_run, interrupt_target_command,
2242 _("Interrupt the execution of the debugged program."));
2243
2244 add_info ("registers", nofp_registers_info, _("\
2245 List of integer registers and their contents, for selected stack frame.\n\
2246 Register name as argument means describe only that register."));
2247 add_info_alias ("r", "registers", 1);
2248
2249 if (xdb_commands)
2250 add_com ("lr", class_info, nofp_registers_info, _("\
2251 List of integer registers and their contents, for selected stack frame.\n\
2252 Register name as argument means describe only that register."));
2253 add_info ("all-registers", all_registers_info, _("\
2254 List of all registers and their contents, for selected stack frame.\n\
2255 Register name as argument means describe only that register."));
2256
2257 add_info ("program", program_info,
2258 _("Execution status of the program."));
2259
2260 add_info ("float", float_info,
2261 _("Print the status of the floating point unit\n"));
2262
2263 add_info ("vector", vector_info,
2264 _("Print the status of the vector unit\n"));
2265
2266 inferior_environ = make_environ ();
2267 init_environ (inferior_environ);
2268 }