1 /* Memory-access and commands for "inferior" process, for GDB.
2 Copyright 1986, 87, 88, 89, 91, 92, 95, 96, 1998, 1999
3 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
24 #include "gdb_string.h"
40 #include "event-top.h"
41 #include "parser-defs.h"
43 /* Functions exported for general use: */
45 void nofp_registers_info PARAMS ((char *, int));
47 void all_registers_info PARAMS ((char *, int));
49 void registers_info PARAMS ((char *, int));
51 /* Local functions: */
53 void continue_command PARAMS ((char *, int));
55 static void print_return_value (int struct_return, struct type *value_type);
57 static void finish_command_continuation PARAMS ((struct continuation_arg *));
59 static void until_next_command PARAMS ((int));
61 static void until_command PARAMS ((char *, int));
63 static void path_info PARAMS ((char *, int));
65 static void path_command PARAMS ((char *, int));
67 static void unset_command PARAMS ((char *, int));
69 static void float_info PARAMS ((char *, int));
71 static void detach_command PARAMS ((char *, int));
73 static void interrupt_target_command (char *args, int from_tty);
75 #if !defined (DO_REGISTERS_INFO)
76 static void do_registers_info PARAMS ((int, int));
79 static void unset_environment_command PARAMS ((char *, int));
81 static void set_environment_command PARAMS ((char *, int));
83 static void environment_info PARAMS ((char *, int));
85 static void program_info PARAMS ((char *, int));
87 static void finish_command PARAMS ((char *, int));
89 static void signal_command PARAMS ((char *, int));
91 static void jump_command PARAMS ((char *, int));
93 static void step_1 PARAMS ((int, int, char *));
94 static void step_once (int skip_subroutines, int single_inst, int count);
95 static void step_1_continuation (struct continuation_arg *arg);
97 void nexti_command PARAMS ((char *, int));
99 void stepi_command PARAMS ((char *, int));
101 static void next_command PARAMS ((char *, int));
103 static void step_command PARAMS ((char *, int));
105 static void run_command PARAMS ((char *, int));
107 static void run_no_args_command PARAMS ((char *args, int from_tty));
109 static void go_command PARAMS ((char *line_no, int from_tty));
111 static int strip_bg_char PARAMS ((char **));
113 void _initialize_infcmd PARAMS ((void));
115 #define GO_USAGE "Usage: go <location>\n"
117 static void breakpoint_auto_delete_contents PARAMS ((PTR));
119 #define ERROR_NO_INFERIOR \
120 if (!target_has_execution) error ("The program is not being run.");
122 /* String containing arguments to give to the program, separated by spaces.
123 Empty string (pointer to '\0') means no args. */
125 static char *inferior_args;
127 /* File name for default use for standard in/out in the inferior. */
129 char *inferior_io_terminal;
131 /* Pid of our debugged inferior, or 0 if no inferior now.
132 Since various parts of infrun.c test this to see whether there is a program
133 being debugged it should be nonzero (currently 3 is used) for remote
138 /* Last signal that the inferior received (why it stopped). */
140 enum target_signal stop_signal;
142 /* Address at which inferior stopped. */
146 /* Chain containing status of breakpoint(s) that we have stopped at. */
150 /* Flag indicating that a command has proceeded the inferior past the
151 current breakpoint. */
153 int breakpoint_proceeded;
155 /* Nonzero if stopped due to a step command. */
159 /* Nonzero if stopped due to completion of a stack dummy routine. */
161 int stop_stack_dummy;
163 /* Nonzero if stopped due to a random (unexpected) signal in inferior
166 int stopped_by_random_signal;
168 /* Range to single step within.
169 If this is nonzero, respond to a single-step signal
170 by continuing to step if the pc is in this range. */
172 CORE_ADDR step_range_start; /* Inclusive */
173 CORE_ADDR step_range_end; /* Exclusive */
175 /* Stack frame address as of when stepping command was issued.
176 This is how we know when we step into a subroutine call,
177 and how to set the frame for the breakpoint used to step out. */
179 CORE_ADDR step_frame_address;
181 /* Our notion of the current stack pointer. */
185 /* 1 means step over all subroutine calls.
186 0 means don't step over calls (used by stepi).
187 -1 means step over calls to undebuggable functions. */
191 /* If stepping, nonzero means step count is > 1
192 so don't print frame next time inferior stops
193 if it stops due to stepping. */
197 /* Environment to use for running inferior,
198 in format described in environ.h. */
200 struct environ *inferior_environ;
203 /* This function detects whether or not a '&' character (indicating
204 background execution) has been added as *the last* of the arguments ARGS
205 of a command. If it has, it removes it and returns 1. Otherwise it
206 does nothing and returns 0. */
213 p = strchr (*args, '&');
217 if (p == (*args + strlen (*args) - 1))
219 if (strlen (*args) > 1)
223 while (*p == ' ' || *p == '\t');
236 tty_command (file, from_tty)
241 error_no_arg ("terminal name for running target process");
243 inferior_io_terminal = savestring (file, strlen (file));
247 run_command (args, from_tty)
255 if (inferior_pid != 0 && target_has_execution)
258 && !query ("The program being debugged has been started already.\n\
259 Start it from the beginning? "))
260 error ("Program not restarted.");
262 #if defined(SOLIB_RESTART)
265 init_wait_for_inferior ();
268 clear_breakpoint_hit_counts ();
270 exec_file = (char *) get_exec_file (0);
272 /* Purge old solib objfiles. */
273 objfile_purge_solibs ();
275 do_run_cleanups (NULL);
277 /* The exec file is re-read every time we do a generic_mourn_inferior, so
278 we just have to worry about the symbol file. */
281 /* We keep symbols from add-symbol-file, on the grounds that the
282 user might want to add some symbols before running the program
283 (right?). But sometimes (dynamic loading where the user manually
284 introduces the new symbols with add-symbol-file), the code which
285 the symbols describe does not persist between runs. Currently
286 the user has to manually nuke all symbols between runs if they
287 want them to go away (PR 2207). This is probably reasonable. */
291 if (event_loop_p && target_can_async_p ())
292 async_disable_stdin ();
297 int async_exec = strip_bg_char (&args);
299 /* If we get a request for running in the bg but the target
300 doesn't support it, error out. */
301 if (event_loop_p && async_exec && !target_can_async_p ())
302 error ("Asynchronous execution not supported on this target.");
304 /* If we don't get a request of running in the bg, then we need
305 to simulate synchronous (fg) execution. */
306 if (event_loop_p && !async_exec && target_can_async_p ())
308 /* Simulate synchronous execution */
309 async_disable_stdin ();
312 /* If there were other args, beside '&', process them. */
315 cmd = concat ("set args ", args, NULL);
316 make_cleanup (free, cmd);
317 execute_command (cmd, from_tty);
324 ui_out_field_string (uiout, NULL, "Starting program");
325 ui_out_text (uiout, ": ");
327 ui_out_field_string (uiout, "execfile", exec_file);
328 ui_out_spaces (uiout, 1);
329 ui_out_field_string (uiout, "infargs", inferior_args);
330 ui_out_text (uiout, "\n");
331 ui_out_flush (uiout);
333 puts_filtered ("Starting program: ");
335 puts_filtered (exec_file);
337 puts_filtered (inferior_args);
338 puts_filtered ("\n");
339 gdb_flush (gdb_stdout);
343 target_create_inferior (exec_file, inferior_args,
344 environ_vector (inferior_environ));
349 run_no_args_command (args, from_tty)
353 execute_command ("set args", from_tty);
354 run_command ((char *) NULL, from_tty);
359 continue_command (proc_count_exp, from_tty)
360 char *proc_count_exp;
366 /* Find out whether we must run in the background. */
367 if (proc_count_exp != NULL)
368 async_exec = strip_bg_char (&proc_count_exp);
370 /* If we must run in the background, but the target can't do it,
372 if (event_loop_p && async_exec && !target_can_async_p ())
373 error ("Asynchronous execution not supported on this target.");
375 /* If we are not asked to run in the bg, then prepare to run in the
376 foreground, synchronously. */
377 if (event_loop_p && !async_exec && target_can_async_p ())
379 /* Simulate synchronous execution */
380 async_disable_stdin ();
383 /* If have argument (besides '&'), set proceed count of breakpoint
385 if (proc_count_exp != NULL)
387 bpstat bs = stop_bpstat;
388 int num = bpstat_num (&bs);
389 if (num == 0 && from_tty)
392 ("Not stopped at any breakpoint; argument ignored.\n");
396 set_ignore_count (num,
397 parse_and_eval_address (proc_count_exp) - 1,
399 /* set_ignore_count prints a message ending with a period.
400 So print two spaces before "Continuing.". */
402 printf_filtered (" ");
403 num = bpstat_num (&bs);
408 printf_filtered ("Continuing.\n");
410 clear_proceed_status ();
412 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
415 /* Step until outside of current statement. */
419 step_command (count_string, from_tty)
423 step_1 (0, 0, count_string);
426 /* Likewise, but skip over subroutine calls as if single instructions. */
430 next_command (count_string, from_tty)
434 step_1 (1, 0, count_string);
437 /* Likewise, but step only one instruction. */
441 stepi_command (count_string, from_tty)
445 step_1 (0, 1, count_string);
450 nexti_command (count_string, from_tty)
454 step_1 (1, 1, count_string);
458 step_1 (skip_subroutines, single_inst, count_string)
459 int skip_subroutines;
463 register int count = 1;
464 struct frame_info *frame;
465 struct cleanup *cleanups = 0;
471 async_exec = strip_bg_char (&count_string);
473 /* If we get a request for running in the bg but the target
474 doesn't support it, error out. */
475 if (event_loop_p && async_exec && !target_can_async_p ())
476 error ("Asynchronous execution not supported on this target.");
478 /* If we don't get a request of running in the bg, then we need
479 to simulate synchronous (fg) execution. */
480 if (event_loop_p && !async_exec && target_can_async_p ())
482 /* Simulate synchronous execution */
483 async_disable_stdin ();
486 count = count_string ? parse_and_eval_address (count_string) : 1;
488 if (!single_inst || skip_subroutines) /* leave si command alone */
490 enable_longjmp_breakpoint ();
491 if (!event_loop_p || !target_can_async_p ())
492 cleanups = make_cleanup ((make_cleanup_func) disable_longjmp_breakpoint,
495 make_exec_cleanup ((make_cleanup_func) disable_longjmp_breakpoint, 0);
498 /* In synchronous case, all is well, just use the regular for loop. */
499 if (!event_loop_p || !target_can_async_p ())
501 for (; count > 0; count--)
503 clear_proceed_status ();
505 frame = get_current_frame ();
506 if (!frame) /* Avoid coredump here. Why tho? */
507 error ("No current frame");
508 step_frame_address = FRAME_FP (frame);
509 step_sp = read_sp ();
513 find_pc_line_pc_range (stop_pc, &step_range_start, &step_range_end);
514 if (step_range_end == 0)
517 if (find_pc_partial_function (stop_pc, &name, &step_range_start,
518 &step_range_end) == 0)
519 error ("Cannot find bounds of current function");
521 target_terminal_ours ();
523 Single stepping until exit from function %s, \n\
524 which has no line number information.\n", name);
529 /* Say we are stepping, but stop after one insn whatever it does. */
530 step_range_start = step_range_end = 1;
531 if (!skip_subroutines)
533 Don't step over function calls, not even to functions lacking
538 if (skip_subroutines)
541 step_multi = (count > 1);
542 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
547 /* FIXME: On nexti, this may have already been done (when we hit the
548 step resume break, I think). Probably this should be moved to
549 wait_for_inferior (near the top). */
550 #if defined (SHIFT_INST_REGS)
555 if (!single_inst || skip_subroutines)
556 do_cleanups (cleanups);
559 /* In case of asynchronous target things get complicated, do only
560 one step for now, before returning control to the event loop. Let
561 the continuation figure out how many other steps we need to do,
562 and handle them one at the time, through step_once(). */
565 if (event_loop_p && target_can_async_p ())
566 step_once (skip_subroutines, single_inst, count);
570 /* Called after we are done with one step operation, to check whether
571 we need to step again, before we print the prompt and return control
572 to the user. If count is > 1, we will need to do one more call to
573 proceed(), via step_once(). Basically it is like step_once and
574 step_1_continuation are co-recursive. */
576 step_1_continuation (arg)
577 struct continuation_arg *arg;
580 int skip_subroutines;
583 skip_subroutines = (int) arg->data;
584 single_inst = (int) (arg->next)->data;
585 count = (int) ((arg->next)->next)->data;
589 /* FIXME: On nexti, this may have already been done (when we hit the
590 step resume break, I think). Probably this should be moved to
591 wait_for_inferior (near the top). */
592 #if defined (SHIFT_INST_REGS)
595 step_once (skip_subroutines, single_inst, count - 1);
598 if (!single_inst || skip_subroutines)
599 do_exec_cleanups (ALL_CLEANUPS);
602 /* Do just one step operation. If count >1 we will have to set up a
603 continuation to be done after the target stops (after this one
604 step). This is useful to implement the 'step n' kind of commands, in
605 case of asynchronous targets. We had to split step_1 into two parts,
606 one to be done before proceed() and one afterwards. This function is
607 called in case of step n with n>1, after the first step operation has
610 step_once (int skip_subroutines, int single_inst, int count)
612 struct continuation_arg *arg1;
613 struct continuation_arg *arg2;
614 struct continuation_arg *arg3;
615 struct frame_info *frame;
619 clear_proceed_status ();
621 frame = get_current_frame ();
622 if (!frame) /* Avoid coredump here. Why tho? */
623 error ("No current frame");
624 step_frame_address = FRAME_FP (frame);
625 step_sp = read_sp ();
629 find_pc_line_pc_range (stop_pc, &step_range_start, &step_range_end);
630 if (step_range_end == 0)
633 if (find_pc_partial_function (stop_pc, &name, &step_range_start,
634 &step_range_end) == 0)
635 error ("Cannot find bounds of current function");
637 target_terminal_ours ();
639 Single stepping until exit from function %s, \n\
640 which has no line number information.\n", name);
645 /* Say we are stepping, but stop after one insn whatever it does. */
646 step_range_start = step_range_end = 1;
647 if (!skip_subroutines)
649 Don't step over function calls, not even to functions lacking
654 if (skip_subroutines)
657 step_multi = (count > 1);
659 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
661 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
663 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
665 arg1->data = (PTR) skip_subroutines;
667 arg2->data = (PTR) single_inst;
669 arg3->data = (PTR) count;
670 add_intermediate_continuation (step_1_continuation, arg1);
671 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
676 /* Continue program at specified address. */
679 jump_command (arg, from_tty)
683 register CORE_ADDR addr;
684 struct symtabs_and_lines sals;
685 struct symtab_and_line sal;
692 /* Find out whether we must run in the background. */
694 async_exec = strip_bg_char (&arg);
696 /* If we must run in the background, but the target can't do it,
698 if (event_loop_p && async_exec && !target_can_async_p ())
699 error ("Asynchronous execution not supported on this target.");
701 /* If we are not asked to run in the bg, then prepare to run in the
702 foreground, synchronously. */
703 if (event_loop_p && !async_exec && target_can_async_p ())
705 /* Simulate synchronous execution */
706 async_disable_stdin ();
710 error_no_arg ("starting address");
712 sals = decode_line_spec_1 (arg, 1);
715 error ("Unreasonable jump request");
719 free ((PTR) sals.sals);
721 if (sal.symtab == 0 && sal.pc == 0)
722 error ("No source file has been specified.");
724 resolve_sal_pc (&sal); /* May error out */
726 /* See if we are trying to jump to another function. */
727 fn = get_frame_function (get_current_frame ());
728 sfn = find_pc_function (sal.pc);
729 if (fn != NULL && sfn != fn)
731 if (!query ("Line %d is not in `%s'. Jump anyway? ", sal.line,
732 SYMBOL_SOURCE_NAME (fn)))
734 error ("Not confirmed.");
741 fixup_symbol_section (sfn, 0);
742 if (section_is_overlay (SYMBOL_BFD_SECTION (sfn)) &&
743 !section_is_mapped (SYMBOL_BFD_SECTION (sfn)))
745 if (!query ("WARNING!!! Destination is in unmapped overlay! Jump anyway? "))
747 error ("Not confirmed.");
757 printf_filtered ("Continuing at ");
758 print_address_numeric (addr, 1, gdb_stdout);
759 printf_filtered (".\n");
762 clear_proceed_status ();
763 proceed (addr, TARGET_SIGNAL_0, 0);
767 /* Go to line or address in current procedure */
769 go_command (line_no, from_tty)
773 if (line_no == (char *) NULL || !*line_no)
774 printf_filtered (GO_USAGE);
777 tbreak_command (line_no, from_tty);
778 jump_command (line_no, from_tty);
783 /* Continue program giving it specified signal. */
786 signal_command (signum_exp, from_tty)
790 enum target_signal oursig;
792 dont_repeat (); /* Too dangerous. */
796 error_no_arg ("signal number");
798 /* It would be even slicker to make signal names be valid expressions,
799 (the type could be "enum $signal" or some such), then the user could
800 assign them to convenience variables. */
801 oursig = target_signal_from_name (signum_exp);
803 if (oursig == TARGET_SIGNAL_UNKNOWN)
805 /* No, try numeric. */
806 int num = parse_and_eval_address (signum_exp);
809 oursig = TARGET_SIGNAL_0;
811 oursig = target_signal_from_command (num);
816 if (oursig == TARGET_SIGNAL_0)
817 printf_filtered ("Continuing with no signal.\n");
819 printf_filtered ("Continuing with signal %s.\n",
820 target_signal_to_name (oursig));
823 clear_proceed_status ();
824 /* "signal 0" should not get stuck if we are stopped at a breakpoint.
825 FIXME: Neither should "signal foo" but when I tried passing
826 (CORE_ADDR)-1 unconditionally I got a testsuite failure which I haven't
827 tried to track down yet. */
828 proceed (oursig == TARGET_SIGNAL_0 ? (CORE_ADDR) -1 : stop_pc, oursig, 0);
831 /* Call breakpoint_auto_delete on the current contents of the bpstat
832 pointed to by arg (which is really a bpstat *). */
835 breakpoint_auto_delete_contents (arg)
838 breakpoint_auto_delete (*(bpstat *) arg);
842 /* Execute a "stack dummy", a piece of code stored in the stack
843 by the debugger to be executed in the inferior.
845 To call: first, do PUSH_DUMMY_FRAME.
846 Then push the contents of the dummy. It should end with a breakpoint insn.
847 Then call here, passing address at which to start the dummy.
849 The contents of all registers are saved before the dummy frame is popped
850 and copied into the buffer BUFFER.
852 The dummy's frame is automatically popped whenever that break is hit.
853 If that is the first time the program stops, run_stack_dummy
854 returns to its caller with that frame already gone and returns 0.
856 Otherwise, run_stack-dummy returns a non-zero value.
857 If the called function receives a random signal, we do not allow the user
858 to continue executing it as this may not work. The dummy frame is poped
860 If we hit a breakpoint, we leave the frame in place and return 2 (the frame
861 will eventually be popped when we do hit the dummy end breakpoint). */
864 run_stack_dummy (addr, buffer)
868 struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0);
871 /* Now proceed, having reached the desired place. */
872 clear_proceed_status ();
874 if (CALL_DUMMY_BREAKPOINT_OFFSET_P)
876 struct breakpoint *bpt;
877 struct symtab_and_line sal;
879 INIT_SAL (&sal); /* initialize to zeroes */
880 if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT)
882 sal.pc = CALL_DUMMY_ADDRESS ();
886 sal.pc = addr - CALL_DUMMY_START_OFFSET + CALL_DUMMY_BREAKPOINT_OFFSET;
888 sal.section = find_pc_overlay (sal.pc);
890 /* Set up a FRAME for the dummy frame so we can pass it to
891 set_momentary_breakpoint. We need to give the breakpoint a
892 frame in case there is only one copy of the dummy (e.g.
893 CALL_DUMMY_LOCATION == AFTER_TEXT_END). */
894 flush_cached_frames ();
895 set_current_frame (create_new_frame (read_fp (), sal.pc));
897 /* If defined, CALL_DUMMY_BREAKPOINT_OFFSET is where we need to put
898 a breakpoint instruction. If not, the call dummy already has the
899 breakpoint instruction in it.
901 addr is the address of the call dummy plus the CALL_DUMMY_START_OFFSET,
902 so we need to subtract the CALL_DUMMY_START_OFFSET. */
903 bpt = set_momentary_breakpoint (sal,
904 get_current_frame (),
906 bpt->disposition = del;
908 /* If all error()s out of proceed ended up calling normal_stop (and
909 perhaps they should; it already does in the special case of error
910 out of resume()), then we wouldn't need this. */
911 make_cleanup (breakpoint_auto_delete_contents, &stop_bpstat);
914 disable_watchpoints_before_interactive_call_start ();
915 proceed_to_finish = 1; /* We want stop_registers, please... */
917 if (target_can_async_p ())
918 saved_async = target_async_mask (0);
920 proceed (addr, TARGET_SIGNAL_0, 0);
923 target_async_mask (saved_async);
925 enable_watchpoints_after_interactive_call_stop ();
927 discard_cleanups (old_cleanups);
929 /* We can stop during an inferior call because a signal is received. */
930 if (stopped_by_random_signal)
933 /* We may also stop prematurely because we hit a breakpoint in the
935 if (!stop_stack_dummy)
938 /* On normal return, the stack dummy has been popped already. */
940 memcpy (buffer, stop_registers, REGISTER_BYTES);
944 /* Proceed until we reach a different source line with pc greater than
945 our current one or exit the function. We skip calls in both cases.
947 Note that eventually this command should probably be changed so
948 that only source lines are printed out when we hit the breakpoint
949 we set. This may involve changes to wait_for_inferior and the
950 proceed status code. */
954 until_next_command (from_tty)
957 struct frame_info *frame;
960 struct symtab_and_line sal;
962 clear_proceed_status ();
964 frame = get_current_frame ();
966 /* Step until either exited from this function or greater
967 than the current line (if in symbolic section) or pc (if
971 func = find_pc_function (pc);
975 struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (pc);
978 error ("Execution is not within a known function.");
980 step_range_start = SYMBOL_VALUE_ADDRESS (msymbol);
985 sal = find_pc_line (pc, 0);
987 step_range_start = BLOCK_START (SYMBOL_BLOCK_VALUE (func));
988 step_range_end = sal.end;
992 step_frame_address = FRAME_FP (frame);
993 step_sp = read_sp ();
995 step_multi = 0; /* Only one call to proceed */
997 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
1001 until_command (arg, from_tty)
1007 if (!target_has_execution)
1008 error ("The program is not running.");
1010 /* Find out whether we must run in the background. */
1012 async_exec = strip_bg_char (&arg);
1014 /* If we must run in the background, but the target can't do it,
1016 if (event_loop_p && async_exec && !target_can_async_p ())
1017 error ("Asynchronous execution not supported on this target.");
1019 /* If we are not asked to run in the bg, then prepare to run in the
1020 foreground, synchronously. */
1021 if (event_loop_p && !async_exec && target_can_async_p ())
1023 /* Simulate synchronous execution */
1024 async_disable_stdin ();
1028 until_break_command (arg, from_tty);
1030 until_next_command (from_tty);
1034 /* Print the result of a function at the end of a 'finish' command. */
1036 print_return_value (int structure_return, struct type *value_type)
1038 register value_ptr value;
1040 static struct ui_stream *stb = NULL;
1043 if (!structure_return)
1045 value = value_being_returned (value_type, stop_registers, structure_return);
1047 stb = ui_out_stream_new (uiout);
1048 ui_out_text (uiout, "Value returned is ");
1049 ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value));
1050 ui_out_text (uiout, "= ");
1051 value_print (value, stb->stream, 0, Val_no_prettyprint);
1052 ui_out_field_stream (uiout, "return-value", stb);
1053 ui_out_text (uiout, "\n");
1055 printf_filtered ("Value returned is $%d = ", record_latest_value (value));
1056 value_print (value, gdb_stdout, 0, Val_no_prettyprint);
1057 printf_filtered ("\n");
1062 /* We cannot determine the contents of the structure because
1063 it is on the stack, and we don't know where, since we did not
1064 initiate the call, as opposed to the call_function_by_hand case */
1065 #ifdef VALUE_RETURNED_FROM_STACK
1068 ui_out_text (uiout, "Value returned has type: ");
1069 ui_out_field_string (uiout, "return-type", TYPE_NAME (value_type));
1070 ui_out_text (uiout, ".");
1071 ui_out_text (uiout, " Cannot determine contents\n");
1073 printf_filtered ("Value returned has type: %s.", TYPE_NAME (value_type));
1074 printf_filtered (" Cannot determine contents\n");
1077 value = value_being_returned (value_type, stop_registers, structure_return);
1079 stb = ui_out_stream_new (uiout);
1080 ui_out_text (uiout, "Value returned is ");
1081 ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value));
1082 ui_out_text (uiout, "= ");
1083 value_print (value, stb->stream, 0, Val_no_prettyprint);
1084 ui_out_field_stream (uiout, "return-value", stb);
1085 ui_out_text (uiout, "\n");
1087 printf_filtered ("Value returned is $%d = ", record_latest_value (value));
1088 value_print (value, gdb_stdout, 0, Val_no_prettyprint);
1089 printf_filtered ("\n");
1095 /* Stuff that needs to be done by the finish command after the target
1096 has stopped. In asynchronous mode, we wait for the target to stop in
1097 the call to poll or select in the event loop, so it is impossible to
1098 do all the stuff as part of the finish_command function itself. The
1099 only chance we have to complete this command is in
1100 fetch_inferior_event, which is called by the event loop as soon as it
1101 detects that the target has stopped. This function is called via the
1102 cmd_continaution pointer. */
1104 finish_command_continuation (arg)
1105 struct continuation_arg *arg;
1107 register struct symbol *function;
1108 struct breakpoint *breakpoint;
1109 struct cleanup *cleanups;
1111 breakpoint = (struct breakpoint *) arg->data;
1112 function = (struct symbol *) (arg->next)->data;
1113 cleanups = (struct cleanup *) (arg->next->next)->data;
1115 if (bpstat_find_breakpoint (stop_bpstat, breakpoint) != NULL
1118 struct type *value_type;
1122 value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function));
1124 internal_error ("finish_command: function has no target type");
1126 if (TYPE_CODE (value_type) == TYPE_CODE_VOID)
1128 do_exec_cleanups (cleanups);
1132 funcaddr = BLOCK_START (SYMBOL_BLOCK_VALUE (function));
1134 struct_return = using_struct_return (value_of_variable (function, NULL),
1136 check_typedef (value_type),
1137 BLOCK_GCC_COMPILED (SYMBOL_BLOCK_VALUE (function)));
1139 print_return_value (struct_return, value_type);
1141 do_exec_cleanups (cleanups);
1144 /* "finish": Set a temporary breakpoint at the place
1145 the selected frame will return to, then continue. */
1148 finish_command (arg, from_tty)
1152 struct symtab_and_line sal;
1153 register struct frame_info *frame;
1154 register struct symbol *function;
1155 struct breakpoint *breakpoint;
1156 struct cleanup *old_chain;
1157 struct continuation_arg *arg1, *arg2, *arg3;
1161 /* Find out whether we must run in the background. */
1163 async_exec = strip_bg_char (&arg);
1165 /* If we must run in the background, but the target can't do it,
1167 if (event_loop_p && async_exec && !target_can_async_p ())
1168 error ("Asynchronous execution not supported on this target.");
1170 /* If we are not asked to run in the bg, then prepare to run in the
1171 foreground, synchronously. */
1172 if (event_loop_p && !async_exec && target_can_async_p ())
1174 /* Simulate synchronous execution */
1175 async_disable_stdin ();
1179 error ("The \"finish\" command does not take any arguments.");
1180 if (!target_has_execution)
1181 error ("The program is not running.");
1182 if (selected_frame == NULL)
1183 error ("No selected frame.");
1185 frame = get_prev_frame (selected_frame);
1187 error ("\"finish\" not meaningful in the outermost frame.");
1189 clear_proceed_status ();
1191 sal = find_pc_line (frame->pc, 0);
1194 breakpoint = set_momentary_breakpoint (sal, frame, bp_finish);
1196 if (!event_loop_p || !target_can_async_p ())
1197 old_chain = make_cleanup ((make_cleanup_func) delete_breakpoint, breakpoint);
1199 old_chain = make_exec_cleanup ((make_cleanup_func) delete_breakpoint, breakpoint);
1201 /* Find the function we will return from. */
1203 function = find_pc_function (selected_frame->pc);
1205 /* Print info on the selected frame, including level number
1209 printf_filtered ("Run till exit from ");
1210 print_stack_frame (selected_frame, selected_frame_level, 0);
1213 /* If running asynchronously and the target support asynchronous
1214 execution, set things up for the rest of the finish command to be
1215 completed later on, when gdb has detected that the target has
1216 stopped, in fetch_inferior_event. */
1217 if (event_loop_p && target_can_async_p ())
1220 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
1222 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
1224 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
1228 arg1->data = (PTR) breakpoint;
1229 arg2->data = (PTR) function;
1230 arg3->data = (PTR) old_chain;
1231 add_continuation (finish_command_continuation, arg1);
1234 proceed_to_finish = 1; /* We want stop_registers, please... */
1235 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
1237 /* Do this only if not running asynchronously or if the target
1238 cannot do async execution. Otherwise, complete this command when
1239 the target actually stops, in fetch_inferior_event. */
1240 if (!event_loop_p || !target_can_async_p ())
1243 /* Did we stop at our breakpoint? */
1244 if (bpstat_find_breakpoint (stop_bpstat, breakpoint) != NULL
1247 struct type *value_type;
1251 value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function));
1253 internal_error ("finish_command: function has no target type");
1255 /* FIXME: Shouldn't we do the cleanups before returning? */
1256 if (TYPE_CODE (value_type) == TYPE_CODE_VOID)
1259 funcaddr = BLOCK_START (SYMBOL_BLOCK_VALUE (function));
1262 using_struct_return (value_of_variable (function, NULL),
1264 check_typedef (value_type),
1265 BLOCK_GCC_COMPILED (SYMBOL_BLOCK_VALUE (function)));
1267 print_return_value (struct_return, value_type);
1269 do_cleanups (old_chain);
1275 program_info (args, from_tty)
1279 bpstat bs = stop_bpstat;
1280 int num = bpstat_num (&bs);
1282 if (!target_has_execution)
1284 printf_filtered ("The program being debugged is not being run.\n");
1288 target_files_info ();
1289 printf_filtered ("Program stopped at %s.\n",
1290 local_hex_string ((unsigned long) stop_pc));
1292 printf_filtered ("It stopped after being stepped.\n");
1295 /* There may be several breakpoints in the same place, so this
1296 isn't as strange as it seems. */
1301 printf_filtered ("It stopped at a breakpoint that has ");
1302 printf_filtered ("since been deleted.\n");
1305 printf_filtered ("It stopped at breakpoint %d.\n", num);
1306 num = bpstat_num (&bs);
1309 else if (stop_signal != TARGET_SIGNAL_0)
1311 printf_filtered ("It stopped with signal %s, %s.\n",
1312 target_signal_to_name (stop_signal),
1313 target_signal_to_string (stop_signal));
1318 printf_filtered ("Type \"info stack\" or \"info registers\" ");
1319 printf_filtered ("for more information.\n");
1324 environment_info (var, from_tty)
1330 register char *val = get_in_environ (inferior_environ, var);
1333 puts_filtered (var);
1334 puts_filtered (" = ");
1335 puts_filtered (val);
1336 puts_filtered ("\n");
1340 puts_filtered ("Environment variable \"");
1341 puts_filtered (var);
1342 puts_filtered ("\" not defined.\n");
1347 register char **vector = environ_vector (inferior_environ);
1350 puts_filtered (*vector++);
1351 puts_filtered ("\n");
1357 set_environment_command (arg, from_tty)
1361 register char *p, *val, *var;
1365 error_no_arg ("environment variable and value");
1367 /* Find seperation between variable name and value */
1368 p = (char *) strchr (arg, '=');
1369 val = (char *) strchr (arg, ' ');
1371 if (p != 0 && val != 0)
1373 /* We have both a space and an equals. If the space is before the
1374 equals, walk forward over the spaces til we see a nonspace
1375 (possibly the equals). */
1380 /* Now if the = is after the char following the spaces,
1381 take the char following the spaces. */
1385 else if (val != 0 && p == 0)
1389 error_no_arg ("environment variable to set");
1391 if (p == 0 || p[1] == 0)
1395 p = arg + strlen (arg); /* So that savestring below will work */
1399 /* Not setting variable value to null */
1401 while (*val == ' ' || *val == '\t')
1405 while (p != arg && (p[-1] == ' ' || p[-1] == '\t'))
1408 var = savestring (arg, p - arg);
1411 printf_filtered ("Setting environment variable ");
1412 printf_filtered ("\"%s\" to null value.\n", var);
1413 set_in_environ (inferior_environ, var, "");
1416 set_in_environ (inferior_environ, var, val);
1421 unset_environment_command (var, from_tty)
1427 /* If there is no argument, delete all environment variables.
1428 Ask for confirmation if reading from the terminal. */
1429 if (!from_tty || query ("Delete all environment variables? "))
1431 free_environ (inferior_environ);
1432 inferior_environ = make_environ ();
1436 unset_in_environ (inferior_environ, var);
1439 /* Handle the execution path (PATH variable) */
1441 static const char path_var_name[] = "PATH";
1445 path_info (args, from_tty)
1449 puts_filtered ("Executable and object file path: ");
1450 puts_filtered (get_in_environ (inferior_environ, path_var_name));
1451 puts_filtered ("\n");
1454 /* Add zero or more directories to the front of the execution path. */
1457 path_command (dirname, from_tty)
1464 env = get_in_environ (inferior_environ, path_var_name);
1465 /* Can be null if path is not set */
1468 exec_path = strsave (env);
1469 mod_path (dirname, &exec_path);
1470 set_in_environ (inferior_environ, path_var_name, exec_path);
1473 path_info ((char *) NULL, from_tty);
1477 #ifdef REGISTER_NAMES
1478 char *gdb_register_names[] = REGISTER_NAMES;
1480 /* Print out the machine register regnum. If regnum is -1,
1481 print all registers (fpregs == 1) or all non-float registers
1484 For most machines, having all_registers_info() print the
1485 register(s) one per line is good enough. If a different format
1486 is required, (eg, for MIPS or Pyramid 90x, which both have
1487 lots of regs), or there is an existing convention for showing
1488 all the registers, define the macro DO_REGISTERS_INFO(regnum, fp)
1489 to provide that format. */
1491 #if !defined (DO_REGISTERS_INFO)
1493 #define DO_REGISTERS_INFO(regnum, fp) do_registers_info(regnum, fp)
1496 do_registers_info (regnum, fpregs)
1501 int numregs = ARCH_NUM_REGS;
1503 for (i = 0; i < numregs; i++)
1505 char raw_buffer[MAX_REGISTER_RAW_SIZE];
1506 char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
1508 /* Decide between printing all regs, nonfloat regs, or specific reg. */
1511 if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT && !fpregs)
1520 /* If the register name is empty, it is undefined for this
1521 processor, so don't display anything. */
1522 if (REGISTER_NAME (i) == NULL || *(REGISTER_NAME (i)) == '\0')
1525 fputs_filtered (REGISTER_NAME (i), gdb_stdout);
1526 print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), gdb_stdout);
1528 /* Get the data in raw format. */
1529 if (read_relative_register_raw_bytes (i, raw_buffer))
1531 printf_filtered ("*value not available*\n");
1535 /* Convert raw data to virtual format if necessary. */
1536 if (REGISTER_CONVERTIBLE (i))
1538 REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i),
1539 raw_buffer, virtual_buffer);
1543 memcpy (virtual_buffer, raw_buffer,
1544 REGISTER_VIRTUAL_SIZE (i));
1547 /* If virtual format is floating, print it that way, and in raw hex. */
1548 if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
1552 #ifdef INVALID_FLOAT
1553 if (INVALID_FLOAT (virtual_buffer, REGISTER_VIRTUAL_SIZE (i)))
1554 printf_filtered ("<invalid float>");
1557 val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
1558 gdb_stdout, 0, 1, 0, Val_pretty_default);
1560 printf_filtered ("\t(raw 0x");
1561 for (j = 0; j < REGISTER_RAW_SIZE (i); j++)
1563 register int idx = TARGET_BYTE_ORDER == BIG_ENDIAN ? j
1564 : REGISTER_RAW_SIZE (i) - 1 - j;
1565 printf_filtered ("%02x", (unsigned char) raw_buffer[idx]);
1567 printf_filtered (")");
1570 /* FIXME! val_print probably can handle all of these cases now... */
1572 /* Else if virtual format is too long for printf,
1573 print in hex a byte at a time. */
1574 else if (REGISTER_VIRTUAL_SIZE (i) > (int) sizeof (long))
1577 printf_filtered ("0x");
1578 for (j = 0; j < REGISTER_VIRTUAL_SIZE (i); j++)
1579 printf_filtered ("%02x", (unsigned char) virtual_buffer[j]);
1581 /* Else print as integer in hex and in decimal. */
1584 val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
1585 gdb_stdout, 'x', 1, 0, Val_pretty_default);
1586 printf_filtered ("\t");
1587 val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
1588 gdb_stdout, 0, 1, 0, Val_pretty_default);
1591 /* The SPARC wants to print even-numbered float regs as doubles
1592 in addition to printing them as floats. */
1593 #ifdef PRINT_REGISTER_HOOK
1594 PRINT_REGISTER_HOOK (i);
1597 printf_filtered ("\n");
1600 #endif /* no DO_REGISTERS_INFO. */
1603 registers_info (addr_exp, fpregs)
1607 int regnum, numregs;
1610 if (!target_has_registers)
1611 error ("The program has no registers now.");
1612 if (selected_frame == NULL)
1613 error ("No selected frame.");
1617 DO_REGISTERS_INFO (-1, fpregs);
1623 if (addr_exp[0] == '$')
1626 while (*end != '\0' && *end != ' ' && *end != '\t')
1628 numregs = ARCH_NUM_REGS;
1630 regnum = target_map_name_to_register (addr_exp, end - addr_exp);
1636 if (*addr_exp >= '0' && *addr_exp <= '9')
1637 regnum = atoi (addr_exp); /* Take a number */
1638 if (regnum >= numregs) /* Bad name, or bad number */
1639 error ("%.*s: invalid register", end - addr_exp, addr_exp);
1642 DO_REGISTERS_INFO (regnum, fpregs);
1645 while (*addr_exp == ' ' || *addr_exp == '\t')
1648 while (*addr_exp != '\0');
1652 all_registers_info (addr_exp, from_tty)
1656 registers_info (addr_exp, 1);
1660 nofp_registers_info (addr_exp, from_tty)
1664 registers_info (addr_exp, 0);
1670 * Should save/restore the tty state since it might be that the
1671 * program to be debugged was started on this tty and it wants
1672 * the tty in some state other than what we want. If it's running
1673 * on another terminal or without a terminal, then saving and
1674 * restoring the tty state is a harmless no-op.
1675 * This only needs to be done if we are attaching to a process.
1680 takes a program started up outside of gdb and ``attaches'' to it.
1681 This stops it cold in its tracks and allows us to start debugging it.
1682 and wait for the trace-trap that results from attaching. */
1685 attach_command (args, from_tty)
1690 extern int auto_solib_add;
1694 char *full_exec_path = NULL;
1696 dont_repeat (); /* Not for the faint of heart */
1698 if (target_has_execution)
1700 if (query ("A program is being debugged already. Kill it? "))
1703 error ("Not killed.");
1706 target_attach (args, from_tty);
1708 /* Set up the "saved terminal modes" of the inferior
1709 based on what modes we are starting it with. */
1710 target_terminal_init ();
1712 /* Install inferior's terminal modes. */
1713 target_terminal_inferior ();
1715 /* Set up execution context to know that we should return from
1716 wait_for_inferior as soon as the target reports a stop. */
1717 init_wait_for_inferior ();
1718 clear_proceed_status ();
1719 stop_soon_quietly = 1;
1721 /* No traps are generated when attaching to inferior under Mach 3
1723 #ifndef ATTACH_NO_WAIT
1724 wait_for_inferior ();
1728 * If no exec file is yet known, try to determine it from the
1731 exec_file = (char *) get_exec_file (0);
1734 exec_file = target_pid_to_exec_file (inferior_pid);
1737 /* It's possible we don't have a full path, but rather just a
1738 filename. Some targets, such as HP-UX, don't provide the
1741 Attempt to qualify the filename against the source path.
1742 (If that fails, we'll just fall back on the original
1743 filename. Not much more we can do...)
1745 if (!source_full_path_of (exec_file, &full_exec_path))
1746 full_exec_path = savestring (exec_file, strlen (exec_file));
1748 exec_file_attach (full_exec_path, from_tty);
1749 symbol_file_command (full_exec_path, from_tty);
1756 /* Add shared library symbols from the newly attached process, if any. */
1757 SOLIB_ADD ((char *) 0, from_tty, ¤t_target);
1758 re_enable_breakpoints_in_shlibs ();
1762 /* Take any necessary post-attaching actions for this platform.
1764 target_post_attach (inferior_pid);
1774 * takes a program previously attached to and detaches it.
1775 * The program resumes execution and will no longer stop
1776 * on signals, etc. We better not have left any breakpoints
1777 * in the program or it'll die when it hits one. For this
1778 * to work, it may be necessary for the process to have been
1779 * previously attached. It *might* work if the program was
1780 * started via the normal ptrace (PTRACE_TRACEME).
1784 detach_command (args, from_tty)
1788 dont_repeat (); /* Not for the faint of heart */
1789 target_detach (args, from_tty);
1790 #if defined(SOLIB_RESTART)
1797 /* Stop the execution of the target while running in async mode, in
1801 interrupt_target_command_wrapper (args, from_tty)
1805 interrupt_target_command (args, from_tty);
1809 interrupt_target_command (args, from_tty)
1813 if (event_loop_p && target_can_async_p ())
1815 dont_repeat (); /* Not for the faint of heart */
1822 float_info (addr_exp, from_tty)
1829 printf_filtered ("No floating point info available for this processor.\n");
1835 unset_command (args, from_tty)
1839 printf_filtered ("\"unset\" must be followed by the name of ");
1840 printf_filtered ("an unset subcommand.\n");
1841 help_list (unsetlist, "unset ", -1, gdb_stdout);
1845 _initialize_infcmd ()
1847 struct cmd_list_element *c;
1849 add_com ("tty", class_run, tty_command,
1850 "Set terminal for future runs of program being debugged.");
1853 (add_set_cmd ("args", class_run, var_string_noescape,
1854 (char *) &inferior_args,
1855 "Set argument list to give program being debugged when it is started.\n\
1856 Follow this command with any number of args, to be passed to the program.",
1861 ("environment", no_class, environment_info,
1862 "The environment to give the program, or one variable's value.\n\
1863 With an argument VAR, prints the value of environment variable VAR to\n\
1864 give the program being debugged. With no arguments, prints the entire\n\
1865 environment to be given to the program.", &showlist);
1866 c->completer = noop_completer;
1868 add_prefix_cmd ("unset", no_class, unset_command,
1869 "Complement to certain \"set\" commands",
1870 &unsetlist, "unset ", 0, &cmdlist);
1872 c = add_cmd ("environment", class_run, unset_environment_command,
1873 "Cancel environment variable VAR for the program.\n\
1874 This does not affect the program until the next \"run\" command.",
1876 c->completer = noop_completer;
1878 c = add_cmd ("environment", class_run, set_environment_command,
1879 "Set environment variable value to give the program.\n\
1880 Arguments are VAR VALUE where VAR is variable name and VALUE is value.\n\
1881 VALUES of environment variables are uninterpreted strings.\n\
1882 This does not affect the program until the next \"run\" command.",
1884 c->completer = noop_completer;
1886 add_com ("path", class_files, path_command,
1887 "Add directory DIR(s) to beginning of search path for object files.\n\
1888 $cwd in the path means the current working directory.\n\
1889 This path is equivalent to the $PATH shell variable. It is a list of\n\
1890 directories, separated by colons. These directories are searched to find\n\
1891 fully linked executable files and separately compiled object files as needed.");
1893 c = add_cmd ("paths", no_class, path_info,
1894 "Current search path for finding object files.\n\
1895 $cwd in the path means the current working directory.\n\
1896 This path is equivalent to the $PATH shell variable. It is a list of\n\
1897 directories, separated by colons. These directories are searched to find\n\
1898 fully linked executable files and separately compiled object files as needed.",
1900 c->completer = noop_completer;
1902 add_com ("attach", class_run, attach_command,
1903 "Attach to a process or file outside of GDB.\n\
1904 This command attaches to another target, of the same type as your last\n\
1905 \"target\" command (\"info files\" will show your target stack).\n\
1906 The command may take as argument a process id or a device file.\n\
1907 For a process id, you must have permission to send the process a signal,\n\
1908 and it must have the same effective uid as the debugger.\n\
1909 When using \"attach\" with a process id, the debugger finds the\n\
1910 program running in the process, looking first in the current working\n\
1911 directory, or (if not found there) using the source file search path\n\
1912 (see the \"directory\" command). You can also use the \"file\" command\n\
1913 to specify the program, and to load its symbol table.");
1915 add_com ("detach", class_run, detach_command,
1916 "Detach a process or file previously attached.\n\
1917 If a process, it is no longer traced, and it continues its execution. If\n\
1918 you were debugging a file, the file is closed and gdb no longer accesses it.");
1920 add_com ("signal", class_run, signal_command,
1921 "Continue program giving it signal specified by the argument.\n\
1922 An argument of \"0\" means continue program without giving it a signal.");
1924 add_com ("stepi", class_run, stepi_command,
1925 "Step one instruction exactly.\n\
1926 Argument N means do this N times (or till program stops for another reason).");
1927 add_com_alias ("si", "stepi", class_alias, 0);
1929 add_com ("nexti", class_run, nexti_command,
1930 "Step one instruction, but proceed through subroutine calls.\n\
1931 Argument N means do this N times (or till program stops for another reason).");
1932 add_com_alias ("ni", "nexti", class_alias, 0);
1934 add_com ("finish", class_run, finish_command,
1935 "Execute until selected stack frame returns.\n\
1936 Upon return, the value returned is printed and put in the value history.");
1938 add_com ("next", class_run, next_command,
1939 "Step program, proceeding through subroutine calls.\n\
1940 Like the \"step\" command as long as subroutine calls do not happen;\n\
1941 when they do, the call is treated as one instruction.\n\
1942 Argument N means do this N times (or till program stops for another reason).");
1943 add_com_alias ("n", "next", class_run, 1);
1945 add_com_alias ("S", "next", class_run, 1);
1947 add_com ("step", class_run, step_command,
1948 "Step program until it reaches a different source line.\n\
1949 Argument N means do this N times (or till program stops for another reason).");
1950 add_com_alias ("s", "step", class_run, 1);
1952 add_com ("until", class_run, until_command,
1953 "Execute until the program reaches a source line greater than the current\n\
1954 or a specified line or address or function (same args as break command).\n\
1955 Execution will also stop upon exit from the current stack frame.");
1956 add_com_alias ("u", "until", class_run, 1);
1958 add_com ("jump", class_run, jump_command,
1959 "Continue program being debugged at specified line or address.\n\
1960 Give as argument either LINENUM or *ADDR, where ADDR is an expression\n\
1961 for an address to start at.");
1964 add_com ("go", class_run, go_command,
1965 "Usage: go <location>\n\
1966 Continue program being debugged, stopping at specified line or \n\
1968 Give as argument either LINENUM or *ADDR, where ADDR is an \n\
1969 expression for an address to start at.\n\
1970 This command is a combination of tbreak and jump.");
1973 add_com_alias ("g", "go", class_run, 1);
1975 add_com ("continue", class_run, continue_command,
1976 "Continue program being debugged, after signal or breakpoint.\n\
1977 If proceeding from breakpoint, a number N may be used as an argument,\n\
1978 which means to set the ignore count of that breakpoint to N - 1 (so that\n\
1979 the breakpoint won't break until the Nth time it is reached).");
1980 add_com_alias ("c", "cont", class_run, 1);
1981 add_com_alias ("fg", "cont", class_run, 1);
1983 add_com ("run", class_run, run_command,
1984 "Start debugged program. You may specify arguments to give it.\n\
1985 Args may include \"*\", or \"[...]\"; they are expanded using \"sh\".\n\
1986 Input and output redirection with \">\", \"<\", or \">>\" are also allowed.\n\n\
1987 With no arguments, uses arguments last specified (with \"run\" or \"set args\").\n\
1988 To cancel previous arguments and run with no arguments,\n\
1989 use \"set args\" without arguments.");
1990 add_com_alias ("r", "run", class_run, 1);
1992 add_com ("R", class_run, run_no_args_command,
1993 "Start debugged program with no arguments.");
1995 add_com ("interrupt", class_run, interrupt_target_command,
1996 "Interrupt the execution of the debugged program.");
1998 add_info ("registers", nofp_registers_info,
1999 "List of integer registers and their contents, for selected stack frame.\n\
2000 Register name as argument means describe only that register.");
2003 add_com ("lr", class_info, nofp_registers_info,
2004 "List of integer registers and their contents, for selected stack frame.\n\
2005 Register name as argument means describe only that register.");
2006 add_info ("all-registers", all_registers_info,
2007 "List of all registers and their contents, for selected stack frame.\n\
2008 Register name as argument means describe only that register.");
2010 add_info ("program", program_info,
2011 "Execution status of the program.");
2013 add_info ("float", float_info,
2014 "Print the status of the floating point unit\n");
2016 inferior_args = savestring ("", 1); /* Initially no args */
2017 inferior_environ = make_environ ();
2018 init_environ (inferior_environ);