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 (char *, int);
47 void all_registers_info (char *, int);
49 void registers_info (char *, int);
51 /* Local functions: */
53 void continue_command (char *, int);
55 static void print_return_value (int struct_return, struct type *value_type);
57 static void finish_command_continuation (struct continuation_arg *);
59 static void until_next_command (int);
61 static void until_command (char *, int);
63 static void path_info (char *, int);
65 static void path_command (char *, int);
67 static void unset_command (char *, int);
69 static void float_info (char *, int);
71 static void detach_command (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 (int, int);
79 static void unset_environment_command (char *, int);
81 static void set_environment_command (char *, int);
83 static void environment_info (char *, int);
85 static void program_info (char *, int);
87 static void finish_command (char *, int);
89 static void signal_command (char *, int);
91 static void jump_command (char *, int);
93 static void step_1 (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 (char *, int);
99 void stepi_command (char *, int);
101 static void next_command (char *, int);
103 static void step_command (char *, int);
105 static void run_command (char *, int);
107 static void run_no_args_command (char *args, int from_tty);
109 static void go_command (char *line_no, int from_tty);
111 static int strip_bg_char (char **);
113 void _initialize_infcmd (void);
115 #define GO_USAGE "Usage: go <location>\n"
117 static void breakpoint_auto_delete_contents (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. */
208 strip_bg_char (char **args)
212 p = strchr (*args, '&');
216 if (p == (*args + strlen (*args) - 1))
218 if (strlen (*args) > 1)
222 while (*p == ' ' || *p == '\t');
235 tty_command (char *file, int from_tty)
238 error_no_arg ("terminal name for running target process");
240 inferior_io_terminal = savestring (file, strlen (file));
244 run_command (char *args, int from_tty)
250 if (inferior_pid != 0 && target_has_execution)
253 && !query ("The program being debugged has been started already.\n\
254 Start it from the beginning? "))
255 error ("Program not restarted.");
257 #if defined(SOLIB_RESTART)
260 init_wait_for_inferior ();
263 clear_breakpoint_hit_counts ();
265 exec_file = (char *) get_exec_file (0);
267 /* Purge old solib objfiles. */
268 objfile_purge_solibs ();
270 do_run_cleanups (NULL);
272 /* The exec file is re-read every time we do a generic_mourn_inferior, so
273 we just have to worry about the symbol file. */
276 /* We keep symbols from add-symbol-file, on the grounds that the
277 user might want to add some symbols before running the program
278 (right?). But sometimes (dynamic loading where the user manually
279 introduces the new symbols with add-symbol-file), the code which
280 the symbols describe does not persist between runs. Currently
281 the user has to manually nuke all symbols between runs if they
282 want them to go away (PR 2207). This is probably reasonable. */
286 if (event_loop_p && target_can_async_p ())
287 async_disable_stdin ();
292 int async_exec = strip_bg_char (&args);
294 /* If we get a request for running in the bg but the target
295 doesn't support it, error out. */
296 if (event_loop_p && async_exec && !target_can_async_p ())
297 error ("Asynchronous execution not supported on this target.");
299 /* If we don't get a request of running in the bg, then we need
300 to simulate synchronous (fg) execution. */
301 if (event_loop_p && !async_exec && target_can_async_p ())
303 /* Simulate synchronous execution */
304 async_disable_stdin ();
307 /* If there were other args, beside '&', process them. */
310 cmd = concat ("set args ", args, NULL);
311 make_cleanup (free, cmd);
312 execute_command (cmd, from_tty);
319 ui_out_field_string (uiout, NULL, "Starting program");
320 ui_out_text (uiout, ": ");
322 ui_out_field_string (uiout, "execfile", exec_file);
323 ui_out_spaces (uiout, 1);
324 ui_out_field_string (uiout, "infargs", inferior_args);
325 ui_out_text (uiout, "\n");
326 ui_out_flush (uiout);
328 puts_filtered ("Starting program: ");
330 puts_filtered (exec_file);
332 puts_filtered (inferior_args);
333 puts_filtered ("\n");
334 gdb_flush (gdb_stdout);
338 target_create_inferior (exec_file, inferior_args,
339 environ_vector (inferior_environ));
344 run_no_args_command (char *args, int from_tty)
346 execute_command ("set args", from_tty);
347 run_command ((char *) NULL, from_tty);
352 continue_command (char *proc_count_exp, int from_tty)
357 /* Find out whether we must run in the background. */
358 if (proc_count_exp != NULL)
359 async_exec = strip_bg_char (&proc_count_exp);
361 /* If we must run in the background, but the target can't do it,
363 if (event_loop_p && async_exec && !target_can_async_p ())
364 error ("Asynchronous execution not supported on this target.");
366 /* If we are not asked to run in the bg, then prepare to run in the
367 foreground, synchronously. */
368 if (event_loop_p && !async_exec && target_can_async_p ())
370 /* Simulate synchronous execution */
371 async_disable_stdin ();
374 /* If have argument (besides '&'), set proceed count of breakpoint
376 if (proc_count_exp != NULL)
378 bpstat bs = stop_bpstat;
379 int num = bpstat_num (&bs);
380 if (num == 0 && from_tty)
383 ("Not stopped at any breakpoint; argument ignored.\n");
387 set_ignore_count (num,
388 parse_and_eval_address (proc_count_exp) - 1,
390 /* set_ignore_count prints a message ending with a period.
391 So print two spaces before "Continuing.". */
393 printf_filtered (" ");
394 num = bpstat_num (&bs);
399 printf_filtered ("Continuing.\n");
401 clear_proceed_status ();
403 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
406 /* Step until outside of current statement. */
410 step_command (char *count_string, int from_tty)
412 step_1 (0, 0, count_string);
415 /* Likewise, but skip over subroutine calls as if single instructions. */
419 next_command (char *count_string, int from_tty)
421 step_1 (1, 0, count_string);
424 /* Likewise, but step only one instruction. */
428 stepi_command (char *count_string, int from_tty)
430 step_1 (0, 1, count_string);
435 nexti_command (char *count_string, int from_tty)
437 step_1 (1, 1, count_string);
441 disable_longjmp_breakpoint_cleanup (void *ignore)
443 disable_longjmp_breakpoint ();
447 step_1 (int skip_subroutines, int single_inst, char *count_string)
449 register int count = 1;
450 struct frame_info *frame;
451 struct cleanup *cleanups = 0;
457 async_exec = strip_bg_char (&count_string);
459 /* If we get a request for running in the bg but the target
460 doesn't support it, error out. */
461 if (event_loop_p && async_exec && !target_can_async_p ())
462 error ("Asynchronous execution not supported on this target.");
464 /* If we don't get a request of running in the bg, then we need
465 to simulate synchronous (fg) execution. */
466 if (event_loop_p && !async_exec && target_can_async_p ())
468 /* Simulate synchronous execution */
469 async_disable_stdin ();
472 count = count_string ? parse_and_eval_address (count_string) : 1;
474 if (!single_inst || skip_subroutines) /* leave si command alone */
476 enable_longjmp_breakpoint ();
477 if (!event_loop_p || !target_can_async_p ())
478 cleanups = make_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/);
480 make_exec_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/);
483 /* In synchronous case, all is well, just use the regular for loop. */
484 if (!event_loop_p || !target_can_async_p ())
486 for (; count > 0; count--)
488 clear_proceed_status ();
490 frame = get_current_frame ();
491 if (!frame) /* Avoid coredump here. Why tho? */
492 error ("No current frame");
493 step_frame_address = FRAME_FP (frame);
494 step_sp = read_sp ();
498 find_pc_line_pc_range (stop_pc, &step_range_start, &step_range_end);
499 if (step_range_end == 0)
502 if (find_pc_partial_function (stop_pc, &name, &step_range_start,
503 &step_range_end) == 0)
504 error ("Cannot find bounds of current function");
506 target_terminal_ours ();
508 Single stepping until exit from function %s, \n\
509 which has no line number information.\n", name);
514 /* Say we are stepping, but stop after one insn whatever it does. */
515 step_range_start = step_range_end = 1;
516 if (!skip_subroutines)
518 Don't step over function calls, not even to functions lacking
523 if (skip_subroutines)
526 step_multi = (count > 1);
527 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
532 /* FIXME: On nexti, this may have already been done (when we hit the
533 step resume break, I think). Probably this should be moved to
534 wait_for_inferior (near the top). */
535 #if defined (SHIFT_INST_REGS)
540 if (!single_inst || skip_subroutines)
541 do_cleanups (cleanups);
544 /* In case of asynchronous target things get complicated, do only
545 one step for now, before returning control to the event loop. Let
546 the continuation figure out how many other steps we need to do,
547 and handle them one at the time, through step_once(). */
550 if (event_loop_p && target_can_async_p ())
551 step_once (skip_subroutines, single_inst, count);
555 /* Called after we are done with one step operation, to check whether
556 we need to step again, before we print the prompt and return control
557 to the user. If count is > 1, we will need to do one more call to
558 proceed(), via step_once(). Basically it is like step_once and
559 step_1_continuation are co-recursive. */
561 step_1_continuation (struct continuation_arg *arg)
564 int skip_subroutines;
567 skip_subroutines = arg->data.integer;
568 single_inst = arg->next->data.integer;
569 count = arg->next->next->data.integer;
573 /* FIXME: On nexti, this may have already been done (when we hit the
574 step resume break, I think). Probably this should be moved to
575 wait_for_inferior (near the top). */
576 #if defined (SHIFT_INST_REGS)
579 step_once (skip_subroutines, single_inst, count - 1);
582 if (!single_inst || skip_subroutines)
583 do_exec_cleanups (ALL_CLEANUPS);
586 /* Do just one step operation. If count >1 we will have to set up a
587 continuation to be done after the target stops (after this one
588 step). This is useful to implement the 'step n' kind of commands, in
589 case of asynchronous targets. We had to split step_1 into two parts,
590 one to be done before proceed() and one afterwards. This function is
591 called in case of step n with n>1, after the first step operation has
594 step_once (int skip_subroutines, int single_inst, int count)
596 struct continuation_arg *arg1;
597 struct continuation_arg *arg2;
598 struct continuation_arg *arg3;
599 struct frame_info *frame;
603 clear_proceed_status ();
605 frame = get_current_frame ();
606 if (!frame) /* Avoid coredump here. Why tho? */
607 error ("No current frame");
608 step_frame_address = FRAME_FP (frame);
609 step_sp = read_sp ();
613 find_pc_line_pc_range (stop_pc, &step_range_start, &step_range_end);
614 if (step_range_end == 0)
617 if (find_pc_partial_function (stop_pc, &name, &step_range_start,
618 &step_range_end) == 0)
619 error ("Cannot find bounds of current function");
621 target_terminal_ours ();
623 Single stepping until exit from function %s, \n\
624 which has no line number information.\n", name);
629 /* Say we are stepping, but stop after one insn whatever it does. */
630 step_range_start = step_range_end = 1;
631 if (!skip_subroutines)
633 Don't step over function calls, not even to functions lacking
638 if (skip_subroutines)
641 step_multi = (count > 1);
643 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
645 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
647 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
649 arg1->data.integer = skip_subroutines;
651 arg2->data.integer = single_inst;
653 arg3->data.integer = count;
654 add_intermediate_continuation (step_1_continuation, arg1);
655 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
660 /* Continue program at specified address. */
663 jump_command (char *arg, int from_tty)
665 register CORE_ADDR addr;
666 struct symtabs_and_lines sals;
667 struct symtab_and_line sal;
674 /* Find out whether we must run in the background. */
676 async_exec = strip_bg_char (&arg);
678 /* If we must run in the background, but the target can't do it,
680 if (event_loop_p && async_exec && !target_can_async_p ())
681 error ("Asynchronous execution not supported on this target.");
683 /* If we are not asked to run in the bg, then prepare to run in the
684 foreground, synchronously. */
685 if (event_loop_p && !async_exec && target_can_async_p ())
687 /* Simulate synchronous execution */
688 async_disable_stdin ();
692 error_no_arg ("starting address");
694 sals = decode_line_spec_1 (arg, 1);
697 error ("Unreasonable jump request");
701 free ((PTR) sals.sals);
703 if (sal.symtab == 0 && sal.pc == 0)
704 error ("No source file has been specified.");
706 resolve_sal_pc (&sal); /* May error out */
708 /* See if we are trying to jump to another function. */
709 fn = get_frame_function (get_current_frame ());
710 sfn = find_pc_function (sal.pc);
711 if (fn != NULL && sfn != fn)
713 if (!query ("Line %d is not in `%s'. Jump anyway? ", sal.line,
714 SYMBOL_SOURCE_NAME (fn)))
716 error ("Not confirmed.");
723 fixup_symbol_section (sfn, 0);
724 if (section_is_overlay (SYMBOL_BFD_SECTION (sfn)) &&
725 !section_is_mapped (SYMBOL_BFD_SECTION (sfn)))
727 if (!query ("WARNING!!! Destination is in unmapped overlay! Jump anyway? "))
729 error ("Not confirmed.");
739 printf_filtered ("Continuing at ");
740 print_address_numeric (addr, 1, gdb_stdout);
741 printf_filtered (".\n");
744 clear_proceed_status ();
745 proceed (addr, TARGET_SIGNAL_0, 0);
749 /* Go to line or address in current procedure */
751 go_command (char *line_no, int from_tty)
753 if (line_no == (char *) NULL || !*line_no)
754 printf_filtered (GO_USAGE);
757 tbreak_command (line_no, from_tty);
758 jump_command (line_no, from_tty);
763 /* Continue program giving it specified signal. */
766 signal_command (char *signum_exp, int from_tty)
768 enum target_signal oursig;
770 dont_repeat (); /* Too dangerous. */
774 error_no_arg ("signal number");
776 /* It would be even slicker to make signal names be valid expressions,
777 (the type could be "enum $signal" or some such), then the user could
778 assign them to convenience variables. */
779 oursig = target_signal_from_name (signum_exp);
781 if (oursig == TARGET_SIGNAL_UNKNOWN)
783 /* No, try numeric. */
784 int num = parse_and_eval_address (signum_exp);
787 oursig = TARGET_SIGNAL_0;
789 oursig = target_signal_from_command (num);
794 if (oursig == TARGET_SIGNAL_0)
795 printf_filtered ("Continuing with no signal.\n");
797 printf_filtered ("Continuing with signal %s.\n",
798 target_signal_to_name (oursig));
801 clear_proceed_status ();
802 /* "signal 0" should not get stuck if we are stopped at a breakpoint.
803 FIXME: Neither should "signal foo" but when I tried passing
804 (CORE_ADDR)-1 unconditionally I got a testsuite failure which I haven't
805 tried to track down yet. */
806 proceed (oursig == TARGET_SIGNAL_0 ? (CORE_ADDR) -1 : stop_pc, oursig, 0);
809 /* Call breakpoint_auto_delete on the current contents of the bpstat
810 pointed to by arg (which is really a bpstat *). */
813 breakpoint_auto_delete_contents (PTR arg)
815 breakpoint_auto_delete (*(bpstat *) arg);
819 /* Execute a "stack dummy", a piece of code stored in the stack
820 by the debugger to be executed in the inferior.
822 To call: first, do PUSH_DUMMY_FRAME.
823 Then push the contents of the dummy. It should end with a breakpoint insn.
824 Then call here, passing address at which to start the dummy.
826 The contents of all registers are saved before the dummy frame is popped
827 and copied into the buffer BUFFER.
829 The dummy's frame is automatically popped whenever that break is hit.
830 If that is the first time the program stops, run_stack_dummy
831 returns to its caller with that frame already gone and returns 0.
833 Otherwise, run_stack-dummy returns a non-zero value.
834 If the called function receives a random signal, we do not allow the user
835 to continue executing it as this may not work. The dummy frame is poped
837 If we hit a breakpoint, we leave the frame in place and return 2 (the frame
838 will eventually be popped when we do hit the dummy end breakpoint). */
841 run_stack_dummy (CORE_ADDR addr, char *buffer)
843 struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0);
846 /* Now proceed, having reached the desired place. */
847 clear_proceed_status ();
849 if (CALL_DUMMY_BREAKPOINT_OFFSET_P)
851 struct breakpoint *bpt;
852 struct symtab_and_line sal;
854 INIT_SAL (&sal); /* initialize to zeroes */
855 if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT)
857 sal.pc = CALL_DUMMY_ADDRESS ();
861 sal.pc = addr - CALL_DUMMY_START_OFFSET + CALL_DUMMY_BREAKPOINT_OFFSET;
863 sal.section = find_pc_overlay (sal.pc);
865 /* Set up a FRAME for the dummy frame so we can pass it to
866 set_momentary_breakpoint. We need to give the breakpoint a
867 frame in case there is only one copy of the dummy (e.g.
868 CALL_DUMMY_LOCATION == AFTER_TEXT_END). */
869 flush_cached_frames ();
870 set_current_frame (create_new_frame (read_fp (), sal.pc));
872 /* If defined, CALL_DUMMY_BREAKPOINT_OFFSET is where we need to put
873 a breakpoint instruction. If not, the call dummy already has the
874 breakpoint instruction in it.
876 addr is the address of the call dummy plus the CALL_DUMMY_START_OFFSET,
877 so we need to subtract the CALL_DUMMY_START_OFFSET. */
878 bpt = set_momentary_breakpoint (sal,
879 get_current_frame (),
881 bpt->disposition = del;
883 /* If all error()s out of proceed ended up calling normal_stop (and
884 perhaps they should; it already does in the special case of error
885 out of resume()), then we wouldn't need this. */
886 make_cleanup (breakpoint_auto_delete_contents, &stop_bpstat);
889 disable_watchpoints_before_interactive_call_start ();
890 proceed_to_finish = 1; /* We want stop_registers, please... */
892 if (target_can_async_p ())
893 saved_async = target_async_mask (0);
895 proceed (addr, TARGET_SIGNAL_0, 0);
898 target_async_mask (saved_async);
900 enable_watchpoints_after_interactive_call_stop ();
902 discard_cleanups (old_cleanups);
904 /* We can stop during an inferior call because a signal is received. */
905 if (stopped_by_random_signal)
908 /* We may also stop prematurely because we hit a breakpoint in the
910 if (!stop_stack_dummy)
913 /* On normal return, the stack dummy has been popped already. */
915 memcpy (buffer, stop_registers, REGISTER_BYTES);
919 /* Proceed until we reach a different source line with pc greater than
920 our current one or exit the function. We skip calls in both cases.
922 Note that eventually this command should probably be changed so
923 that only source lines are printed out when we hit the breakpoint
924 we set. This may involve changes to wait_for_inferior and the
925 proceed status code. */
929 until_next_command (int from_tty)
931 struct frame_info *frame;
934 struct symtab_and_line sal;
936 clear_proceed_status ();
938 frame = get_current_frame ();
940 /* Step until either exited from this function or greater
941 than the current line (if in symbolic section) or pc (if
945 func = find_pc_function (pc);
949 struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (pc);
952 error ("Execution is not within a known function.");
954 step_range_start = SYMBOL_VALUE_ADDRESS (msymbol);
959 sal = find_pc_line (pc, 0);
961 step_range_start = BLOCK_START (SYMBOL_BLOCK_VALUE (func));
962 step_range_end = sal.end;
966 step_frame_address = FRAME_FP (frame);
967 step_sp = read_sp ();
969 step_multi = 0; /* Only one call to proceed */
971 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
975 until_command (char *arg, int from_tty)
979 if (!target_has_execution)
980 error ("The program is not running.");
982 /* Find out whether we must run in the background. */
984 async_exec = strip_bg_char (&arg);
986 /* If we must run in the background, but the target can't do it,
988 if (event_loop_p && async_exec && !target_can_async_p ())
989 error ("Asynchronous execution not supported on this target.");
991 /* If we are not asked to run in the bg, then prepare to run in the
992 foreground, synchronously. */
993 if (event_loop_p && !async_exec && target_can_async_p ())
995 /* Simulate synchronous execution */
996 async_disable_stdin ();
1000 until_break_command (arg, from_tty);
1002 until_next_command (from_tty);
1006 /* Print the result of a function at the end of a 'finish' command. */
1008 print_return_value (int structure_return, struct type *value_type)
1010 register value_ptr value;
1012 static struct ui_stream *stb = NULL;
1015 if (!structure_return)
1017 value = value_being_returned (value_type, stop_registers, structure_return);
1019 stb = ui_out_stream_new (uiout);
1020 ui_out_text (uiout, "Value returned is ");
1021 ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value));
1022 ui_out_text (uiout, "= ");
1023 value_print (value, stb->stream, 0, Val_no_prettyprint);
1024 ui_out_field_stream (uiout, "return-value", stb);
1025 ui_out_text (uiout, "\n");
1027 printf_filtered ("Value returned is $%d = ", record_latest_value (value));
1028 value_print (value, gdb_stdout, 0, Val_no_prettyprint);
1029 printf_filtered ("\n");
1034 /* We cannot determine the contents of the structure because
1035 it is on the stack, and we don't know where, since we did not
1036 initiate the call, as opposed to the call_function_by_hand case */
1037 #ifdef VALUE_RETURNED_FROM_STACK
1040 ui_out_text (uiout, "Value returned has type: ");
1041 ui_out_field_string (uiout, "return-type", TYPE_NAME (value_type));
1042 ui_out_text (uiout, ".");
1043 ui_out_text (uiout, " Cannot determine contents\n");
1045 printf_filtered ("Value returned has type: %s.", TYPE_NAME (value_type));
1046 printf_filtered (" Cannot determine contents\n");
1049 value = value_being_returned (value_type, stop_registers, structure_return);
1051 stb = ui_out_stream_new (uiout);
1052 ui_out_text (uiout, "Value returned is ");
1053 ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value));
1054 ui_out_text (uiout, "= ");
1055 value_print (value, stb->stream, 0, Val_no_prettyprint);
1056 ui_out_field_stream (uiout, "return-value", stb);
1057 ui_out_text (uiout, "\n");
1059 printf_filtered ("Value returned is $%d = ", record_latest_value (value));
1060 value_print (value, gdb_stdout, 0, Val_no_prettyprint);
1061 printf_filtered ("\n");
1067 /* Stuff that needs to be done by the finish command after the target
1068 has stopped. In asynchronous mode, we wait for the target to stop in
1069 the call to poll or select in the event loop, so it is impossible to
1070 do all the stuff as part of the finish_command function itself. The
1071 only chance we have to complete this command is in
1072 fetch_inferior_event, which is called by the event loop as soon as it
1073 detects that the target has stopped. This function is called via the
1074 cmd_continaution pointer. */
1076 finish_command_continuation (struct continuation_arg *arg)
1078 register struct symbol *function;
1079 struct breakpoint *breakpoint;
1080 struct cleanup *cleanups;
1082 breakpoint = (struct breakpoint *) arg->data.pointer;
1083 function = (struct symbol *) arg->next->data.pointer;
1084 cleanups = (struct cleanup *) arg->next->next->data.pointer;
1086 if (bpstat_find_breakpoint (stop_bpstat, breakpoint) != NULL
1089 struct type *value_type;
1093 value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function));
1095 internal_error ("finish_command: function has no target type");
1097 if (TYPE_CODE (value_type) == TYPE_CODE_VOID)
1099 do_exec_cleanups (cleanups);
1103 funcaddr = BLOCK_START (SYMBOL_BLOCK_VALUE (function));
1105 struct_return = using_struct_return (value_of_variable (function, NULL),
1107 check_typedef (value_type),
1108 BLOCK_GCC_COMPILED (SYMBOL_BLOCK_VALUE (function)));
1110 print_return_value (struct_return, value_type);
1112 do_exec_cleanups (cleanups);
1115 /* "finish": Set a temporary breakpoint at the place
1116 the selected frame will return to, then continue. */
1119 finish_command (char *arg, int from_tty)
1121 struct symtab_and_line sal;
1122 register struct frame_info *frame;
1123 register struct symbol *function;
1124 struct breakpoint *breakpoint;
1125 struct cleanup *old_chain;
1126 struct continuation_arg *arg1, *arg2, *arg3;
1130 /* Find out whether we must run in the background. */
1132 async_exec = strip_bg_char (&arg);
1134 /* If we must run in the background, but the target can't do it,
1136 if (event_loop_p && async_exec && !target_can_async_p ())
1137 error ("Asynchronous execution not supported on this target.");
1139 /* If we are not asked to run in the bg, then prepare to run in the
1140 foreground, synchronously. */
1141 if (event_loop_p && !async_exec && target_can_async_p ())
1143 /* Simulate synchronous execution */
1144 async_disable_stdin ();
1148 error ("The \"finish\" command does not take any arguments.");
1149 if (!target_has_execution)
1150 error ("The program is not running.");
1151 if (selected_frame == NULL)
1152 error ("No selected frame.");
1154 frame = get_prev_frame (selected_frame);
1156 error ("\"finish\" not meaningful in the outermost frame.");
1158 clear_proceed_status ();
1160 sal = find_pc_line (frame->pc, 0);
1163 breakpoint = set_momentary_breakpoint (sal, frame, bp_finish);
1165 if (!event_loop_p || !target_can_async_p ())
1166 old_chain = make_cleanup_delete_breakpoint (breakpoint);
1168 old_chain = make_exec_cleanup_delete_breakpoint (breakpoint);
1170 /* Find the function we will return from. */
1172 function = find_pc_function (selected_frame->pc);
1174 /* Print info on the selected frame, including level number
1178 printf_filtered ("Run till exit from ");
1179 print_stack_frame (selected_frame, selected_frame_level, 0);
1182 /* If running asynchronously and the target support asynchronous
1183 execution, set things up for the rest of the finish command to be
1184 completed later on, when gdb has detected that the target has
1185 stopped, in fetch_inferior_event. */
1186 if (event_loop_p && target_can_async_p ())
1189 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
1191 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
1193 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
1197 arg1->data.pointer = breakpoint;
1198 arg2->data.pointer = function;
1199 arg3->data.pointer = old_chain;
1200 add_continuation (finish_command_continuation, arg1);
1203 proceed_to_finish = 1; /* We want stop_registers, please... */
1204 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
1206 /* Do this only if not running asynchronously or if the target
1207 cannot do async execution. Otherwise, complete this command when
1208 the target actually stops, in fetch_inferior_event. */
1209 if (!event_loop_p || !target_can_async_p ())
1212 /* Did we stop at our breakpoint? */
1213 if (bpstat_find_breakpoint (stop_bpstat, breakpoint) != NULL
1216 struct type *value_type;
1220 value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function));
1222 internal_error ("finish_command: function has no target type");
1224 /* FIXME: Shouldn't we do the cleanups before returning? */
1225 if (TYPE_CODE (value_type) == TYPE_CODE_VOID)
1228 funcaddr = BLOCK_START (SYMBOL_BLOCK_VALUE (function));
1231 using_struct_return (value_of_variable (function, NULL),
1233 check_typedef (value_type),
1234 BLOCK_GCC_COMPILED (SYMBOL_BLOCK_VALUE (function)));
1236 print_return_value (struct_return, value_type);
1238 do_cleanups (old_chain);
1244 program_info (char *args, int from_tty)
1246 bpstat bs = stop_bpstat;
1247 int num = bpstat_num (&bs);
1249 if (!target_has_execution)
1251 printf_filtered ("The program being debugged is not being run.\n");
1255 target_files_info ();
1256 printf_filtered ("Program stopped at %s.\n",
1257 local_hex_string ((unsigned long) stop_pc));
1259 printf_filtered ("It stopped after being stepped.\n");
1262 /* There may be several breakpoints in the same place, so this
1263 isn't as strange as it seems. */
1268 printf_filtered ("It stopped at a breakpoint that has ");
1269 printf_filtered ("since been deleted.\n");
1272 printf_filtered ("It stopped at breakpoint %d.\n", num);
1273 num = bpstat_num (&bs);
1276 else if (stop_signal != TARGET_SIGNAL_0)
1278 printf_filtered ("It stopped with signal %s, %s.\n",
1279 target_signal_to_name (stop_signal),
1280 target_signal_to_string (stop_signal));
1285 printf_filtered ("Type \"info stack\" or \"info registers\" ");
1286 printf_filtered ("for more information.\n");
1291 environment_info (char *var, int from_tty)
1295 register char *val = get_in_environ (inferior_environ, var);
1298 puts_filtered (var);
1299 puts_filtered (" = ");
1300 puts_filtered (val);
1301 puts_filtered ("\n");
1305 puts_filtered ("Environment variable \"");
1306 puts_filtered (var);
1307 puts_filtered ("\" not defined.\n");
1312 register char **vector = environ_vector (inferior_environ);
1315 puts_filtered (*vector++);
1316 puts_filtered ("\n");
1322 set_environment_command (char *arg, int from_tty)
1324 register char *p, *val, *var;
1328 error_no_arg ("environment variable and value");
1330 /* Find seperation between variable name and value */
1331 p = (char *) strchr (arg, '=');
1332 val = (char *) strchr (arg, ' ');
1334 if (p != 0 && val != 0)
1336 /* We have both a space and an equals. If the space is before the
1337 equals, walk forward over the spaces til we see a nonspace
1338 (possibly the equals). */
1343 /* Now if the = is after the char following the spaces,
1344 take the char following the spaces. */
1348 else if (val != 0 && p == 0)
1352 error_no_arg ("environment variable to set");
1354 if (p == 0 || p[1] == 0)
1358 p = arg + strlen (arg); /* So that savestring below will work */
1362 /* Not setting variable value to null */
1364 while (*val == ' ' || *val == '\t')
1368 while (p != arg && (p[-1] == ' ' || p[-1] == '\t'))
1371 var = savestring (arg, p - arg);
1374 printf_filtered ("Setting environment variable ");
1375 printf_filtered ("\"%s\" to null value.\n", var);
1376 set_in_environ (inferior_environ, var, "");
1379 set_in_environ (inferior_environ, var, val);
1384 unset_environment_command (char *var, int from_tty)
1388 /* If there is no argument, delete all environment variables.
1389 Ask for confirmation if reading from the terminal. */
1390 if (!from_tty || query ("Delete all environment variables? "))
1392 free_environ (inferior_environ);
1393 inferior_environ = make_environ ();
1397 unset_in_environ (inferior_environ, var);
1400 /* Handle the execution path (PATH variable) */
1402 static const char path_var_name[] = "PATH";
1406 path_info (char *args, int from_tty)
1408 puts_filtered ("Executable and object file path: ");
1409 puts_filtered (get_in_environ (inferior_environ, path_var_name));
1410 puts_filtered ("\n");
1413 /* Add zero or more directories to the front of the execution path. */
1416 path_command (char *dirname, int from_tty)
1421 env = get_in_environ (inferior_environ, path_var_name);
1422 /* Can be null if path is not set */
1425 exec_path = strsave (env);
1426 mod_path (dirname, &exec_path);
1427 set_in_environ (inferior_environ, path_var_name, exec_path);
1430 path_info ((char *) NULL, from_tty);
1434 #ifdef REGISTER_NAMES
1435 char *gdb_register_names[] = REGISTER_NAMES;
1437 /* Print out the machine register regnum. If regnum is -1,
1438 print all registers (fpregs == 1) or all non-float registers
1441 For most machines, having all_registers_info() print the
1442 register(s) one per line is good enough. If a different format
1443 is required, (eg, for MIPS or Pyramid 90x, which both have
1444 lots of regs), or there is an existing convention for showing
1445 all the registers, define the macro DO_REGISTERS_INFO(regnum, fp)
1446 to provide that format. */
1448 #if !defined (DO_REGISTERS_INFO)
1450 #define DO_REGISTERS_INFO(regnum, fp) do_registers_info(regnum, fp)
1453 do_registers_info (int regnum, int fpregs)
1456 int numregs = ARCH_NUM_REGS;
1458 for (i = 0; i < numregs; i++)
1460 char raw_buffer[MAX_REGISTER_RAW_SIZE];
1461 char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
1463 /* Decide between printing all regs, nonfloat regs, or specific reg. */
1466 if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT && !fpregs)
1475 /* If the register name is empty, it is undefined for this
1476 processor, so don't display anything. */
1477 if (REGISTER_NAME (i) == NULL || *(REGISTER_NAME (i)) == '\0')
1480 fputs_filtered (REGISTER_NAME (i), gdb_stdout);
1481 print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), gdb_stdout);
1483 /* Get the data in raw format. */
1484 if (read_relative_register_raw_bytes (i, raw_buffer))
1486 printf_filtered ("*value not available*\n");
1490 /* Convert raw data to virtual format if necessary. */
1491 if (REGISTER_CONVERTIBLE (i))
1493 REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i),
1494 raw_buffer, virtual_buffer);
1498 memcpy (virtual_buffer, raw_buffer,
1499 REGISTER_VIRTUAL_SIZE (i));
1502 /* If virtual format is floating, print it that way, and in raw hex. */
1503 if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
1507 #ifdef INVALID_FLOAT
1508 if (INVALID_FLOAT (virtual_buffer, REGISTER_VIRTUAL_SIZE (i)))
1509 printf_filtered ("<invalid float>");
1512 val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
1513 gdb_stdout, 0, 1, 0, Val_pretty_default);
1515 printf_filtered ("\t(raw 0x");
1516 for (j = 0; j < REGISTER_RAW_SIZE (i); j++)
1518 register int idx = TARGET_BYTE_ORDER == BIG_ENDIAN ? j
1519 : REGISTER_RAW_SIZE (i) - 1 - j;
1520 printf_filtered ("%02x", (unsigned char) raw_buffer[idx]);
1522 printf_filtered (")");
1525 /* FIXME! val_print probably can handle all of these cases now... */
1527 /* Else if virtual format is too long for printf,
1528 print in hex a byte at a time. */
1529 else if (REGISTER_VIRTUAL_SIZE (i) > (int) sizeof (long))
1532 printf_filtered ("0x");
1533 for (j = 0; j < REGISTER_VIRTUAL_SIZE (i); j++)
1534 printf_filtered ("%02x", (unsigned char) virtual_buffer[j]);
1536 /* Else print as integer in hex and in decimal. */
1539 val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
1540 gdb_stdout, 'x', 1, 0, Val_pretty_default);
1541 printf_filtered ("\t");
1542 val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
1543 gdb_stdout, 0, 1, 0, Val_pretty_default);
1546 /* The SPARC wants to print even-numbered float regs as doubles
1547 in addition to printing them as floats. */
1548 #ifdef PRINT_REGISTER_HOOK
1549 PRINT_REGISTER_HOOK (i);
1552 printf_filtered ("\n");
1555 #endif /* no DO_REGISTERS_INFO. */
1558 registers_info (char *addr_exp, int fpregs)
1560 int regnum, numregs;
1563 if (!target_has_registers)
1564 error ("The program has no registers now.");
1565 if (selected_frame == NULL)
1566 error ("No selected frame.");
1570 DO_REGISTERS_INFO (-1, fpregs);
1576 if (addr_exp[0] == '$')
1579 while (*end != '\0' && *end != ' ' && *end != '\t')
1581 numregs = ARCH_NUM_REGS;
1583 regnum = target_map_name_to_register (addr_exp, end - addr_exp);
1589 if (*addr_exp >= '0' && *addr_exp <= '9')
1590 regnum = atoi (addr_exp); /* Take a number */
1591 if (regnum >= numregs) /* Bad name, or bad number */
1592 error ("%.*s: invalid register", end - addr_exp, addr_exp);
1595 DO_REGISTERS_INFO (regnum, fpregs);
1598 while (*addr_exp == ' ' || *addr_exp == '\t')
1601 while (*addr_exp != '\0');
1605 all_registers_info (char *addr_exp, int from_tty)
1607 registers_info (addr_exp, 1);
1611 nofp_registers_info (char *addr_exp, int from_tty)
1613 registers_info (addr_exp, 0);
1619 * Should save/restore the tty state since it might be that the
1620 * program to be debugged was started on this tty and it wants
1621 * the tty in some state other than what we want. If it's running
1622 * on another terminal or without a terminal, then saving and
1623 * restoring the tty state is a harmless no-op.
1624 * This only needs to be done if we are attaching to a process.
1629 takes a program started up outside of gdb and ``attaches'' to it.
1630 This stops it cold in its tracks and allows us to start debugging it.
1631 and wait for the trace-trap that results from attaching. */
1634 attach_command (char *args, int from_tty)
1637 extern int auto_solib_add;
1641 char *full_exec_path = NULL;
1643 dont_repeat (); /* Not for the faint of heart */
1645 if (target_has_execution)
1647 if (query ("A program is being debugged already. Kill it? "))
1650 error ("Not killed.");
1653 target_attach (args, from_tty);
1655 /* Set up the "saved terminal modes" of the inferior
1656 based on what modes we are starting it with. */
1657 target_terminal_init ();
1659 /* Install inferior's terminal modes. */
1660 target_terminal_inferior ();
1662 /* Set up execution context to know that we should return from
1663 wait_for_inferior as soon as the target reports a stop. */
1664 init_wait_for_inferior ();
1665 clear_proceed_status ();
1667 /* No traps are generated when attaching to inferior under Mach 3
1669 #ifndef ATTACH_NO_WAIT
1670 stop_soon_quietly = 1;
1671 wait_for_inferior ();
1675 * If no exec file is yet known, try to determine it from the
1678 exec_file = (char *) get_exec_file (0);
1681 exec_file = target_pid_to_exec_file (inferior_pid);
1684 /* It's possible we don't have a full path, but rather just a
1685 filename. Some targets, such as HP-UX, don't provide the
1688 Attempt to qualify the filename against the source path.
1689 (If that fails, we'll just fall back on the original
1690 filename. Not much more we can do...)
1692 if (!source_full_path_of (exec_file, &full_exec_path))
1693 full_exec_path = savestring (exec_file, strlen (exec_file));
1695 exec_file_attach (full_exec_path, from_tty);
1696 symbol_file_command (full_exec_path, from_tty);
1703 /* Add shared library symbols from the newly attached process, if any. */
1704 SOLIB_ADD ((char *) 0, from_tty, ¤t_target);
1705 re_enable_breakpoints_in_shlibs ();
1709 /* Take any necessary post-attaching actions for this platform.
1711 target_post_attach (inferior_pid);
1721 * takes a program previously attached to and detaches it.
1722 * The program resumes execution and will no longer stop
1723 * on signals, etc. We better not have left any breakpoints
1724 * in the program or it'll die when it hits one. For this
1725 * to work, it may be necessary for the process to have been
1726 * previously attached. It *might* work if the program was
1727 * started via the normal ptrace (PTRACE_TRACEME).
1731 detach_command (char *args, int from_tty)
1733 dont_repeat (); /* Not for the faint of heart */
1734 target_detach (args, from_tty);
1735 #if defined(SOLIB_RESTART)
1742 /* Stop the execution of the target while running in async mode, in
1746 interrupt_target_command_wrapper (char *args, int from_tty)
1748 interrupt_target_command (args, from_tty);
1752 interrupt_target_command (char *args, int from_tty)
1754 if (event_loop_p && target_can_async_p ())
1756 dont_repeat (); /* Not for the faint of heart */
1763 float_info (char *addr_exp, int from_tty)
1768 printf_filtered ("No floating point info available for this processor.\n");
1774 unset_command (char *args, int from_tty)
1776 printf_filtered ("\"unset\" must be followed by the name of ");
1777 printf_filtered ("an unset subcommand.\n");
1778 help_list (unsetlist, "unset ", -1, gdb_stdout);
1782 _initialize_infcmd (void)
1784 struct cmd_list_element *c;
1786 add_com ("tty", class_run, tty_command,
1787 "Set terminal for future runs of program being debugged.");
1790 (add_set_cmd ("args", class_run, var_string_noescape,
1791 (char *) &inferior_args,
1792 "Set argument list to give program being debugged when it is started.\n\
1793 Follow this command with any number of args, to be passed to the program.",
1798 ("environment", no_class, environment_info,
1799 "The environment to give the program, or one variable's value.\n\
1800 With an argument VAR, prints the value of environment variable VAR to\n\
1801 give the program being debugged. With no arguments, prints the entire\n\
1802 environment to be given to the program.", &showlist);
1803 c->completer = noop_completer;
1805 add_prefix_cmd ("unset", no_class, unset_command,
1806 "Complement to certain \"set\" commands",
1807 &unsetlist, "unset ", 0, &cmdlist);
1809 c = add_cmd ("environment", class_run, unset_environment_command,
1810 "Cancel environment variable VAR for the program.\n\
1811 This does not affect the program until the next \"run\" command.",
1813 c->completer = noop_completer;
1815 c = add_cmd ("environment", class_run, set_environment_command,
1816 "Set environment variable value to give the program.\n\
1817 Arguments are VAR VALUE where VAR is variable name and VALUE is value.\n\
1818 VALUES of environment variables are uninterpreted strings.\n\
1819 This does not affect the program until the next \"run\" command.",
1821 c->completer = noop_completer;
1823 add_com ("path", class_files, path_command,
1824 "Add directory DIR(s) to beginning of search path for object files.\n\
1825 $cwd in the path means the current working directory.\n\
1826 This path is equivalent to the $PATH shell variable. It is a list of\n\
1827 directories, separated by colons. These directories are searched to find\n\
1828 fully linked executable files and separately compiled object files as needed.");
1830 c = add_cmd ("paths", no_class, path_info,
1831 "Current search path for finding object files.\n\
1832 $cwd in the path means the current working directory.\n\
1833 This path is equivalent to the $PATH shell variable. It is a list of\n\
1834 directories, separated by colons. These directories are searched to find\n\
1835 fully linked executable files and separately compiled object files as needed.",
1837 c->completer = noop_completer;
1839 add_com ("attach", class_run, attach_command,
1840 "Attach to a process or file outside of GDB.\n\
1841 This command attaches to another target, of the same type as your last\n\
1842 \"target\" command (\"info files\" will show your target stack).\n\
1843 The command may take as argument a process id or a device file.\n\
1844 For a process id, you must have permission to send the process a signal,\n\
1845 and it must have the same effective uid as the debugger.\n\
1846 When using \"attach\" with a process id, the debugger finds the\n\
1847 program running in the process, looking first in the current working\n\
1848 directory, or (if not found there) using the source file search path\n\
1849 (see the \"directory\" command). You can also use the \"file\" command\n\
1850 to specify the program, and to load its symbol table.");
1852 add_com ("detach", class_run, detach_command,
1853 "Detach a process or file previously attached.\n\
1854 If a process, it is no longer traced, and it continues its execution. If\n\
1855 you were debugging a file, the file is closed and gdb no longer accesses it.");
1857 add_com ("signal", class_run, signal_command,
1858 "Continue program giving it signal specified by the argument.\n\
1859 An argument of \"0\" means continue program without giving it a signal.");
1861 add_com ("stepi", class_run, stepi_command,
1862 "Step one instruction exactly.\n\
1863 Argument N means do this N times (or till program stops for another reason).");
1864 add_com_alias ("si", "stepi", class_alias, 0);
1866 add_com ("nexti", class_run, nexti_command,
1867 "Step one instruction, but proceed through subroutine calls.\n\
1868 Argument N means do this N times (or till program stops for another reason).");
1869 add_com_alias ("ni", "nexti", class_alias, 0);
1871 add_com ("finish", class_run, finish_command,
1872 "Execute until selected stack frame returns.\n\
1873 Upon return, the value returned is printed and put in the value history.");
1875 add_com ("next", class_run, next_command,
1876 "Step program, proceeding through subroutine calls.\n\
1877 Like the \"step\" command as long as subroutine calls do not happen;\n\
1878 when they do, the call is treated as one instruction.\n\
1879 Argument N means do this N times (or till program stops for another reason).");
1880 add_com_alias ("n", "next", class_run, 1);
1882 add_com_alias ("S", "next", class_run, 1);
1884 add_com ("step", class_run, step_command,
1885 "Step program until it reaches a different source line.\n\
1886 Argument N means do this N times (or till program stops for another reason).");
1887 add_com_alias ("s", "step", class_run, 1);
1889 add_com ("until", class_run, until_command,
1890 "Execute until the program reaches a source line greater than the current\n\
1891 or a specified line or address or function (same args as break command).\n\
1892 Execution will also stop upon exit from the current stack frame.");
1893 add_com_alias ("u", "until", class_run, 1);
1895 add_com ("jump", class_run, jump_command,
1896 "Continue program being debugged at specified line or address.\n\
1897 Give as argument either LINENUM or *ADDR, where ADDR is an expression\n\
1898 for an address to start at.");
1901 add_com ("go", class_run, go_command,
1902 "Usage: go <location>\n\
1903 Continue program being debugged, stopping at specified line or \n\
1905 Give as argument either LINENUM or *ADDR, where ADDR is an \n\
1906 expression for an address to start at.\n\
1907 This command is a combination of tbreak and jump.");
1910 add_com_alias ("g", "go", class_run, 1);
1912 add_com ("continue", class_run, continue_command,
1913 "Continue program being debugged, after signal or breakpoint.\n\
1914 If proceeding from breakpoint, a number N may be used as an argument,\n\
1915 which means to set the ignore count of that breakpoint to N - 1 (so that\n\
1916 the breakpoint won't break until the Nth time it is reached).");
1917 add_com_alias ("c", "cont", class_run, 1);
1918 add_com_alias ("fg", "cont", class_run, 1);
1920 add_com ("run", class_run, run_command,
1921 "Start debugged program. You may specify arguments to give it.\n\
1922 Args may include \"*\", or \"[...]\"; they are expanded using \"sh\".\n\
1923 Input and output redirection with \">\", \"<\", or \">>\" are also allowed.\n\n\
1924 With no arguments, uses arguments last specified (with \"run\" or \"set args\").\n\
1925 To cancel previous arguments and run with no arguments,\n\
1926 use \"set args\" without arguments.");
1927 add_com_alias ("r", "run", class_run, 1);
1929 add_com ("R", class_run, run_no_args_command,
1930 "Start debugged program with no arguments.");
1932 add_com ("interrupt", class_run, interrupt_target_command,
1933 "Interrupt the execution of the debugged program.");
1935 add_info ("registers", nofp_registers_info,
1936 "List of integer registers and their contents, for selected stack frame.\n\
1937 Register name as argument means describe only that register.");
1938 add_info_alias ("r", "registers", 1);
1941 add_com ("lr", class_info, nofp_registers_info,
1942 "List of integer registers and their contents, for selected stack frame.\n\
1943 Register name as argument means describe only that register.");
1944 add_info ("all-registers", all_registers_info,
1945 "List of all registers and their contents, for selected stack frame.\n\
1946 Register name as argument means describe only that register.");
1948 add_info ("program", program_info,
1949 "Execution status of the program.");
1951 add_info ("float", float_info,
1952 "Print the status of the floating point unit\n");
1954 inferior_args = savestring ("", 1); /* Initially no args */
1955 inferior_environ = make_environ ();
1956 init_environ (inferior_environ);