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. */
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 disable_longjmp_breakpoint_cleanup (void *ignore)
460 disable_longjmp_breakpoint ();
464 step_1 (skip_subroutines, single_inst, count_string)
465 int skip_subroutines;
469 register int count = 1;
470 struct frame_info *frame;
471 struct cleanup *cleanups = 0;
477 async_exec = strip_bg_char (&count_string);
479 /* If we get a request for running in the bg but the target
480 doesn't support it, error out. */
481 if (event_loop_p && async_exec && !target_can_async_p ())
482 error ("Asynchronous execution not supported on this target.");
484 /* If we don't get a request of running in the bg, then we need
485 to simulate synchronous (fg) execution. */
486 if (event_loop_p && !async_exec && target_can_async_p ())
488 /* Simulate synchronous execution */
489 async_disable_stdin ();
492 count = count_string ? parse_and_eval_address (count_string) : 1;
494 if (!single_inst || skip_subroutines) /* leave si command alone */
496 enable_longjmp_breakpoint ();
497 if (!event_loop_p || !target_can_async_p ())
498 cleanups = make_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/);
500 make_exec_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/);
503 /* In synchronous case, all is well, just use the regular for loop. */
504 if (!event_loop_p || !target_can_async_p ())
506 for (; count > 0; count--)
508 clear_proceed_status ();
510 frame = get_current_frame ();
511 if (!frame) /* Avoid coredump here. Why tho? */
512 error ("No current frame");
513 step_frame_address = FRAME_FP (frame);
514 step_sp = read_sp ();
518 find_pc_line_pc_range (stop_pc, &step_range_start, &step_range_end);
519 if (step_range_end == 0)
522 if (find_pc_partial_function (stop_pc, &name, &step_range_start,
523 &step_range_end) == 0)
524 error ("Cannot find bounds of current function");
526 target_terminal_ours ();
528 Single stepping until exit from function %s, \n\
529 which has no line number information.\n", name);
534 /* Say we are stepping, but stop after one insn whatever it does. */
535 step_range_start = step_range_end = 1;
536 if (!skip_subroutines)
538 Don't step over function calls, not even to functions lacking
543 if (skip_subroutines)
546 step_multi = (count > 1);
547 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
552 /* FIXME: On nexti, this may have already been done (when we hit the
553 step resume break, I think). Probably this should be moved to
554 wait_for_inferior (near the top). */
555 #if defined (SHIFT_INST_REGS)
560 if (!single_inst || skip_subroutines)
561 do_cleanups (cleanups);
564 /* In case of asynchronous target things get complicated, do only
565 one step for now, before returning control to the event loop. Let
566 the continuation figure out how many other steps we need to do,
567 and handle them one at the time, through step_once(). */
570 if (event_loop_p && target_can_async_p ())
571 step_once (skip_subroutines, single_inst, count);
575 /* Called after we are done with one step operation, to check whether
576 we need to step again, before we print the prompt and return control
577 to the user. If count is > 1, we will need to do one more call to
578 proceed(), via step_once(). Basically it is like step_once and
579 step_1_continuation are co-recursive. */
581 step_1_continuation (arg)
582 struct continuation_arg *arg;
585 int skip_subroutines;
588 skip_subroutines = arg->data.integer;
589 single_inst = arg->next->data.integer;
590 count = arg->next->next->data.integer;
594 /* FIXME: On nexti, this may have already been done (when we hit the
595 step resume break, I think). Probably this should be moved to
596 wait_for_inferior (near the top). */
597 #if defined (SHIFT_INST_REGS)
600 step_once (skip_subroutines, single_inst, count - 1);
603 if (!single_inst || skip_subroutines)
604 do_exec_cleanups (ALL_CLEANUPS);
607 /* Do just one step operation. If count >1 we will have to set up a
608 continuation to be done after the target stops (after this one
609 step). This is useful to implement the 'step n' kind of commands, in
610 case of asynchronous targets. We had to split step_1 into two parts,
611 one to be done before proceed() and one afterwards. This function is
612 called in case of step n with n>1, after the first step operation has
615 step_once (int skip_subroutines, int single_inst, int count)
617 struct continuation_arg *arg1;
618 struct continuation_arg *arg2;
619 struct continuation_arg *arg3;
620 struct frame_info *frame;
624 clear_proceed_status ();
626 frame = get_current_frame ();
627 if (!frame) /* Avoid coredump here. Why tho? */
628 error ("No current frame");
629 step_frame_address = FRAME_FP (frame);
630 step_sp = read_sp ();
634 find_pc_line_pc_range (stop_pc, &step_range_start, &step_range_end);
635 if (step_range_end == 0)
638 if (find_pc_partial_function (stop_pc, &name, &step_range_start,
639 &step_range_end) == 0)
640 error ("Cannot find bounds of current function");
642 target_terminal_ours ();
644 Single stepping until exit from function %s, \n\
645 which has no line number information.\n", name);
650 /* Say we are stepping, but stop after one insn whatever it does. */
651 step_range_start = step_range_end = 1;
652 if (!skip_subroutines)
654 Don't step over function calls, not even to functions lacking
659 if (skip_subroutines)
662 step_multi = (count > 1);
664 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
666 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
668 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
670 arg1->data.integer = skip_subroutines;
672 arg2->data.integer = single_inst;
674 arg3->data.integer = count;
675 add_intermediate_continuation (step_1_continuation, arg1);
676 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
681 /* Continue program at specified address. */
684 jump_command (arg, from_tty)
688 register CORE_ADDR addr;
689 struct symtabs_and_lines sals;
690 struct symtab_and_line sal;
697 /* Find out whether we must run in the background. */
699 async_exec = strip_bg_char (&arg);
701 /* If we must run in the background, but the target can't do it,
703 if (event_loop_p && async_exec && !target_can_async_p ())
704 error ("Asynchronous execution not supported on this target.");
706 /* If we are not asked to run in the bg, then prepare to run in the
707 foreground, synchronously. */
708 if (event_loop_p && !async_exec && target_can_async_p ())
710 /* Simulate synchronous execution */
711 async_disable_stdin ();
715 error_no_arg ("starting address");
717 sals = decode_line_spec_1 (arg, 1);
720 error ("Unreasonable jump request");
724 free ((PTR) sals.sals);
726 if (sal.symtab == 0 && sal.pc == 0)
727 error ("No source file has been specified.");
729 resolve_sal_pc (&sal); /* May error out */
731 /* See if we are trying to jump to another function. */
732 fn = get_frame_function (get_current_frame ());
733 sfn = find_pc_function (sal.pc);
734 if (fn != NULL && sfn != fn)
736 if (!query ("Line %d is not in `%s'. Jump anyway? ", sal.line,
737 SYMBOL_SOURCE_NAME (fn)))
739 error ("Not confirmed.");
746 fixup_symbol_section (sfn, 0);
747 if (section_is_overlay (SYMBOL_BFD_SECTION (sfn)) &&
748 !section_is_mapped (SYMBOL_BFD_SECTION (sfn)))
750 if (!query ("WARNING!!! Destination is in unmapped overlay! Jump anyway? "))
752 error ("Not confirmed.");
762 printf_filtered ("Continuing at ");
763 print_address_numeric (addr, 1, gdb_stdout);
764 printf_filtered (".\n");
767 clear_proceed_status ();
768 proceed (addr, TARGET_SIGNAL_0, 0);
772 /* Go to line or address in current procedure */
774 go_command (line_no, from_tty)
778 if (line_no == (char *) NULL || !*line_no)
779 printf_filtered (GO_USAGE);
782 tbreak_command (line_no, from_tty);
783 jump_command (line_no, from_tty);
788 /* Continue program giving it specified signal. */
791 signal_command (signum_exp, from_tty)
795 enum target_signal oursig;
797 dont_repeat (); /* Too dangerous. */
801 error_no_arg ("signal number");
803 /* It would be even slicker to make signal names be valid expressions,
804 (the type could be "enum $signal" or some such), then the user could
805 assign them to convenience variables. */
806 oursig = target_signal_from_name (signum_exp);
808 if (oursig == TARGET_SIGNAL_UNKNOWN)
810 /* No, try numeric. */
811 int num = parse_and_eval_address (signum_exp);
814 oursig = TARGET_SIGNAL_0;
816 oursig = target_signal_from_command (num);
821 if (oursig == TARGET_SIGNAL_0)
822 printf_filtered ("Continuing with no signal.\n");
824 printf_filtered ("Continuing with signal %s.\n",
825 target_signal_to_name (oursig));
828 clear_proceed_status ();
829 /* "signal 0" should not get stuck if we are stopped at a breakpoint.
830 FIXME: Neither should "signal foo" but when I tried passing
831 (CORE_ADDR)-1 unconditionally I got a testsuite failure which I haven't
832 tried to track down yet. */
833 proceed (oursig == TARGET_SIGNAL_0 ? (CORE_ADDR) -1 : stop_pc, oursig, 0);
836 /* Call breakpoint_auto_delete on the current contents of the bpstat
837 pointed to by arg (which is really a bpstat *). */
840 breakpoint_auto_delete_contents (arg)
843 breakpoint_auto_delete (*(bpstat *) arg);
847 /* Execute a "stack dummy", a piece of code stored in the stack
848 by the debugger to be executed in the inferior.
850 To call: first, do PUSH_DUMMY_FRAME.
851 Then push the contents of the dummy. It should end with a breakpoint insn.
852 Then call here, passing address at which to start the dummy.
854 The contents of all registers are saved before the dummy frame is popped
855 and copied into the buffer BUFFER.
857 The dummy's frame is automatically popped whenever that break is hit.
858 If that is the first time the program stops, run_stack_dummy
859 returns to its caller with that frame already gone and returns 0.
861 Otherwise, run_stack-dummy returns a non-zero value.
862 If the called function receives a random signal, we do not allow the user
863 to continue executing it as this may not work. The dummy frame is poped
865 If we hit a breakpoint, we leave the frame in place and return 2 (the frame
866 will eventually be popped when we do hit the dummy end breakpoint). */
869 run_stack_dummy (addr, buffer)
873 struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0);
876 /* Now proceed, having reached the desired place. */
877 clear_proceed_status ();
879 if (CALL_DUMMY_BREAKPOINT_OFFSET_P)
881 struct breakpoint *bpt;
882 struct symtab_and_line sal;
884 INIT_SAL (&sal); /* initialize to zeroes */
885 if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT)
887 sal.pc = CALL_DUMMY_ADDRESS ();
891 sal.pc = addr - CALL_DUMMY_START_OFFSET + CALL_DUMMY_BREAKPOINT_OFFSET;
893 sal.section = find_pc_overlay (sal.pc);
895 /* Set up a FRAME for the dummy frame so we can pass it to
896 set_momentary_breakpoint. We need to give the breakpoint a
897 frame in case there is only one copy of the dummy (e.g.
898 CALL_DUMMY_LOCATION == AFTER_TEXT_END). */
899 flush_cached_frames ();
900 set_current_frame (create_new_frame (read_fp (), sal.pc));
902 /* If defined, CALL_DUMMY_BREAKPOINT_OFFSET is where we need to put
903 a breakpoint instruction. If not, the call dummy already has the
904 breakpoint instruction in it.
906 addr is the address of the call dummy plus the CALL_DUMMY_START_OFFSET,
907 so we need to subtract the CALL_DUMMY_START_OFFSET. */
908 bpt = set_momentary_breakpoint (sal,
909 get_current_frame (),
911 bpt->disposition = del;
913 /* If all error()s out of proceed ended up calling normal_stop (and
914 perhaps they should; it already does in the special case of error
915 out of resume()), then we wouldn't need this. */
916 make_cleanup (breakpoint_auto_delete_contents, &stop_bpstat);
919 disable_watchpoints_before_interactive_call_start ();
920 proceed_to_finish = 1; /* We want stop_registers, please... */
922 if (target_can_async_p ())
923 saved_async = target_async_mask (0);
925 proceed (addr, TARGET_SIGNAL_0, 0);
928 target_async_mask (saved_async);
930 enable_watchpoints_after_interactive_call_stop ();
932 discard_cleanups (old_cleanups);
934 /* We can stop during an inferior call because a signal is received. */
935 if (stopped_by_random_signal)
938 /* We may also stop prematurely because we hit a breakpoint in the
940 if (!stop_stack_dummy)
943 /* On normal return, the stack dummy has been popped already. */
945 memcpy (buffer, stop_registers, REGISTER_BYTES);
949 /* Proceed until we reach a different source line with pc greater than
950 our current one or exit the function. We skip calls in both cases.
952 Note that eventually this command should probably be changed so
953 that only source lines are printed out when we hit the breakpoint
954 we set. This may involve changes to wait_for_inferior and the
955 proceed status code. */
959 until_next_command (from_tty)
962 struct frame_info *frame;
965 struct symtab_and_line sal;
967 clear_proceed_status ();
969 frame = get_current_frame ();
971 /* Step until either exited from this function or greater
972 than the current line (if in symbolic section) or pc (if
976 func = find_pc_function (pc);
980 struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (pc);
983 error ("Execution is not within a known function.");
985 step_range_start = SYMBOL_VALUE_ADDRESS (msymbol);
990 sal = find_pc_line (pc, 0);
992 step_range_start = BLOCK_START (SYMBOL_BLOCK_VALUE (func));
993 step_range_end = sal.end;
997 step_frame_address = FRAME_FP (frame);
998 step_sp = read_sp ();
1000 step_multi = 0; /* Only one call to proceed */
1002 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
1006 until_command (arg, from_tty)
1012 if (!target_has_execution)
1013 error ("The program is not running.");
1015 /* Find out whether we must run in the background. */
1017 async_exec = strip_bg_char (&arg);
1019 /* If we must run in the background, but the target can't do it,
1021 if (event_loop_p && async_exec && !target_can_async_p ())
1022 error ("Asynchronous execution not supported on this target.");
1024 /* If we are not asked to run in the bg, then prepare to run in the
1025 foreground, synchronously. */
1026 if (event_loop_p && !async_exec && target_can_async_p ())
1028 /* Simulate synchronous execution */
1029 async_disable_stdin ();
1033 until_break_command (arg, from_tty);
1035 until_next_command (from_tty);
1039 /* Print the result of a function at the end of a 'finish' command. */
1041 print_return_value (int structure_return, struct type *value_type)
1043 register value_ptr value;
1045 static struct ui_stream *stb = NULL;
1048 if (!structure_return)
1050 value = value_being_returned (value_type, stop_registers, structure_return);
1052 stb = ui_out_stream_new (uiout);
1053 ui_out_text (uiout, "Value returned is ");
1054 ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value));
1055 ui_out_text (uiout, "= ");
1056 value_print (value, stb->stream, 0, Val_no_prettyprint);
1057 ui_out_field_stream (uiout, "return-value", stb);
1058 ui_out_text (uiout, "\n");
1060 printf_filtered ("Value returned is $%d = ", record_latest_value (value));
1061 value_print (value, gdb_stdout, 0, Val_no_prettyprint);
1062 printf_filtered ("\n");
1067 /* We cannot determine the contents of the structure because
1068 it is on the stack, and we don't know where, since we did not
1069 initiate the call, as opposed to the call_function_by_hand case */
1070 #ifdef VALUE_RETURNED_FROM_STACK
1073 ui_out_text (uiout, "Value returned has type: ");
1074 ui_out_field_string (uiout, "return-type", TYPE_NAME (value_type));
1075 ui_out_text (uiout, ".");
1076 ui_out_text (uiout, " Cannot determine contents\n");
1078 printf_filtered ("Value returned has type: %s.", TYPE_NAME (value_type));
1079 printf_filtered (" Cannot determine contents\n");
1082 value = value_being_returned (value_type, stop_registers, structure_return);
1084 stb = ui_out_stream_new (uiout);
1085 ui_out_text (uiout, "Value returned is ");
1086 ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value));
1087 ui_out_text (uiout, "= ");
1088 value_print (value, stb->stream, 0, Val_no_prettyprint);
1089 ui_out_field_stream (uiout, "return-value", stb);
1090 ui_out_text (uiout, "\n");
1092 printf_filtered ("Value returned is $%d = ", record_latest_value (value));
1093 value_print (value, gdb_stdout, 0, Val_no_prettyprint);
1094 printf_filtered ("\n");
1100 /* Stuff that needs to be done by the finish command after the target
1101 has stopped. In asynchronous mode, we wait for the target to stop in
1102 the call to poll or select in the event loop, so it is impossible to
1103 do all the stuff as part of the finish_command function itself. The
1104 only chance we have to complete this command is in
1105 fetch_inferior_event, which is called by the event loop as soon as it
1106 detects that the target has stopped. This function is called via the
1107 cmd_continaution pointer. */
1109 finish_command_continuation (arg)
1110 struct continuation_arg *arg;
1112 register struct symbol *function;
1113 struct breakpoint *breakpoint;
1114 struct cleanup *cleanups;
1116 breakpoint = (struct breakpoint *) arg->data.pointer;
1117 function = (struct symbol *) arg->next->data.pointer;
1118 cleanups = (struct cleanup *) arg->next->next->data.pointer;
1120 if (bpstat_find_breakpoint (stop_bpstat, breakpoint) != NULL
1123 struct type *value_type;
1127 value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function));
1129 internal_error ("finish_command: function has no target type");
1131 if (TYPE_CODE (value_type) == TYPE_CODE_VOID)
1133 do_exec_cleanups (cleanups);
1137 funcaddr = BLOCK_START (SYMBOL_BLOCK_VALUE (function));
1139 struct_return = using_struct_return (value_of_variable (function, NULL),
1141 check_typedef (value_type),
1142 BLOCK_GCC_COMPILED (SYMBOL_BLOCK_VALUE (function)));
1144 print_return_value (struct_return, value_type);
1146 do_exec_cleanups (cleanups);
1149 /* "finish": Set a temporary breakpoint at the place
1150 the selected frame will return to, then continue. */
1153 finish_command (arg, from_tty)
1157 struct symtab_and_line sal;
1158 register struct frame_info *frame;
1159 register struct symbol *function;
1160 struct breakpoint *breakpoint;
1161 struct cleanup *old_chain;
1162 struct continuation_arg *arg1, *arg2, *arg3;
1166 /* Find out whether we must run in the background. */
1168 async_exec = strip_bg_char (&arg);
1170 /* If we must run in the background, but the target can't do it,
1172 if (event_loop_p && async_exec && !target_can_async_p ())
1173 error ("Asynchronous execution not supported on this target.");
1175 /* If we are not asked to run in the bg, then prepare to run in the
1176 foreground, synchronously. */
1177 if (event_loop_p && !async_exec && target_can_async_p ())
1179 /* Simulate synchronous execution */
1180 async_disable_stdin ();
1184 error ("The \"finish\" command does not take any arguments.");
1185 if (!target_has_execution)
1186 error ("The program is not running.");
1187 if (selected_frame == NULL)
1188 error ("No selected frame.");
1190 frame = get_prev_frame (selected_frame);
1192 error ("\"finish\" not meaningful in the outermost frame.");
1194 clear_proceed_status ();
1196 sal = find_pc_line (frame->pc, 0);
1199 breakpoint = set_momentary_breakpoint (sal, frame, bp_finish);
1201 if (!event_loop_p || !target_can_async_p ())
1202 old_chain = make_cleanup_delete_breakpoint (breakpoint);
1204 old_chain = make_exec_cleanup_delete_breakpoint (breakpoint);
1206 /* Find the function we will return from. */
1208 function = find_pc_function (selected_frame->pc);
1210 /* Print info on the selected frame, including level number
1214 printf_filtered ("Run till exit from ");
1215 print_stack_frame (selected_frame, selected_frame_level, 0);
1218 /* If running asynchronously and the target support asynchronous
1219 execution, set things up for the rest of the finish command to be
1220 completed later on, when gdb has detected that the target has
1221 stopped, in fetch_inferior_event. */
1222 if (event_loop_p && target_can_async_p ())
1225 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
1227 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
1229 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
1233 arg1->data.pointer = breakpoint;
1234 arg2->data.pointer = function;
1235 arg3->data.pointer = old_chain;
1236 add_continuation (finish_command_continuation, arg1);
1239 proceed_to_finish = 1; /* We want stop_registers, please... */
1240 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
1242 /* Do this only if not running asynchronously or if the target
1243 cannot do async execution. Otherwise, complete this command when
1244 the target actually stops, in fetch_inferior_event. */
1245 if (!event_loop_p || !target_can_async_p ())
1248 /* Did we stop at our breakpoint? */
1249 if (bpstat_find_breakpoint (stop_bpstat, breakpoint) != NULL
1252 struct type *value_type;
1256 value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function));
1258 internal_error ("finish_command: function has no target type");
1260 /* FIXME: Shouldn't we do the cleanups before returning? */
1261 if (TYPE_CODE (value_type) == TYPE_CODE_VOID)
1264 funcaddr = BLOCK_START (SYMBOL_BLOCK_VALUE (function));
1267 using_struct_return (value_of_variable (function, NULL),
1269 check_typedef (value_type),
1270 BLOCK_GCC_COMPILED (SYMBOL_BLOCK_VALUE (function)));
1272 print_return_value (struct_return, value_type);
1274 do_cleanups (old_chain);
1280 program_info (args, from_tty)
1284 bpstat bs = stop_bpstat;
1285 int num = bpstat_num (&bs);
1287 if (!target_has_execution)
1289 printf_filtered ("The program being debugged is not being run.\n");
1293 target_files_info ();
1294 printf_filtered ("Program stopped at %s.\n",
1295 local_hex_string ((unsigned long) stop_pc));
1297 printf_filtered ("It stopped after being stepped.\n");
1300 /* There may be several breakpoints in the same place, so this
1301 isn't as strange as it seems. */
1306 printf_filtered ("It stopped at a breakpoint that has ");
1307 printf_filtered ("since been deleted.\n");
1310 printf_filtered ("It stopped at breakpoint %d.\n", num);
1311 num = bpstat_num (&bs);
1314 else if (stop_signal != TARGET_SIGNAL_0)
1316 printf_filtered ("It stopped with signal %s, %s.\n",
1317 target_signal_to_name (stop_signal),
1318 target_signal_to_string (stop_signal));
1323 printf_filtered ("Type \"info stack\" or \"info registers\" ");
1324 printf_filtered ("for more information.\n");
1329 environment_info (var, from_tty)
1335 register char *val = get_in_environ (inferior_environ, var);
1338 puts_filtered (var);
1339 puts_filtered (" = ");
1340 puts_filtered (val);
1341 puts_filtered ("\n");
1345 puts_filtered ("Environment variable \"");
1346 puts_filtered (var);
1347 puts_filtered ("\" not defined.\n");
1352 register char **vector = environ_vector (inferior_environ);
1355 puts_filtered (*vector++);
1356 puts_filtered ("\n");
1362 set_environment_command (arg, from_tty)
1366 register char *p, *val, *var;
1370 error_no_arg ("environment variable and value");
1372 /* Find seperation between variable name and value */
1373 p = (char *) strchr (arg, '=');
1374 val = (char *) strchr (arg, ' ');
1376 if (p != 0 && val != 0)
1378 /* We have both a space and an equals. If the space is before the
1379 equals, walk forward over the spaces til we see a nonspace
1380 (possibly the equals). */
1385 /* Now if the = is after the char following the spaces,
1386 take the char following the spaces. */
1390 else if (val != 0 && p == 0)
1394 error_no_arg ("environment variable to set");
1396 if (p == 0 || p[1] == 0)
1400 p = arg + strlen (arg); /* So that savestring below will work */
1404 /* Not setting variable value to null */
1406 while (*val == ' ' || *val == '\t')
1410 while (p != arg && (p[-1] == ' ' || p[-1] == '\t'))
1413 var = savestring (arg, p - arg);
1416 printf_filtered ("Setting environment variable ");
1417 printf_filtered ("\"%s\" to null value.\n", var);
1418 set_in_environ (inferior_environ, var, "");
1421 set_in_environ (inferior_environ, var, val);
1426 unset_environment_command (var, from_tty)
1432 /* If there is no argument, delete all environment variables.
1433 Ask for confirmation if reading from the terminal. */
1434 if (!from_tty || query ("Delete all environment variables? "))
1436 free_environ (inferior_environ);
1437 inferior_environ = make_environ ();
1441 unset_in_environ (inferior_environ, var);
1444 /* Handle the execution path (PATH variable) */
1446 static const char path_var_name[] = "PATH";
1450 path_info (args, from_tty)
1454 puts_filtered ("Executable and object file path: ");
1455 puts_filtered (get_in_environ (inferior_environ, path_var_name));
1456 puts_filtered ("\n");
1459 /* Add zero or more directories to the front of the execution path. */
1462 path_command (dirname, from_tty)
1469 env = get_in_environ (inferior_environ, path_var_name);
1470 /* Can be null if path is not set */
1473 exec_path = strsave (env);
1474 mod_path (dirname, &exec_path);
1475 set_in_environ (inferior_environ, path_var_name, exec_path);
1478 path_info ((char *) NULL, from_tty);
1482 #ifdef REGISTER_NAMES
1483 char *gdb_register_names[] = REGISTER_NAMES;
1485 /* Print out the machine register regnum. If regnum is -1,
1486 print all registers (fpregs == 1) or all non-float registers
1489 For most machines, having all_registers_info() print the
1490 register(s) one per line is good enough. If a different format
1491 is required, (eg, for MIPS or Pyramid 90x, which both have
1492 lots of regs), or there is an existing convention for showing
1493 all the registers, define the macro DO_REGISTERS_INFO(regnum, fp)
1494 to provide that format. */
1496 #if !defined (DO_REGISTERS_INFO)
1498 #define DO_REGISTERS_INFO(regnum, fp) do_registers_info(regnum, fp)
1501 do_registers_info (regnum, fpregs)
1506 int numregs = ARCH_NUM_REGS;
1508 for (i = 0; i < numregs; i++)
1510 char raw_buffer[MAX_REGISTER_RAW_SIZE];
1511 char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
1513 /* Decide between printing all regs, nonfloat regs, or specific reg. */
1516 if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT && !fpregs)
1525 /* If the register name is empty, it is undefined for this
1526 processor, so don't display anything. */
1527 if (REGISTER_NAME (i) == NULL || *(REGISTER_NAME (i)) == '\0')
1530 fputs_filtered (REGISTER_NAME (i), gdb_stdout);
1531 print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), gdb_stdout);
1533 /* Get the data in raw format. */
1534 if (read_relative_register_raw_bytes (i, raw_buffer))
1536 printf_filtered ("*value not available*\n");
1540 /* Convert raw data to virtual format if necessary. */
1541 if (REGISTER_CONVERTIBLE (i))
1543 REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i),
1544 raw_buffer, virtual_buffer);
1548 memcpy (virtual_buffer, raw_buffer,
1549 REGISTER_VIRTUAL_SIZE (i));
1552 /* If virtual format is floating, print it that way, and in raw hex. */
1553 if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
1557 #ifdef INVALID_FLOAT
1558 if (INVALID_FLOAT (virtual_buffer, REGISTER_VIRTUAL_SIZE (i)))
1559 printf_filtered ("<invalid float>");
1562 val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
1563 gdb_stdout, 0, 1, 0, Val_pretty_default);
1565 printf_filtered ("\t(raw 0x");
1566 for (j = 0; j < REGISTER_RAW_SIZE (i); j++)
1568 register int idx = TARGET_BYTE_ORDER == BIG_ENDIAN ? j
1569 : REGISTER_RAW_SIZE (i) - 1 - j;
1570 printf_filtered ("%02x", (unsigned char) raw_buffer[idx]);
1572 printf_filtered (")");
1575 /* FIXME! val_print probably can handle all of these cases now... */
1577 /* Else if virtual format is too long for printf,
1578 print in hex a byte at a time. */
1579 else if (REGISTER_VIRTUAL_SIZE (i) > (int) sizeof (long))
1582 printf_filtered ("0x");
1583 for (j = 0; j < REGISTER_VIRTUAL_SIZE (i); j++)
1584 printf_filtered ("%02x", (unsigned char) virtual_buffer[j]);
1586 /* Else print as integer in hex and in decimal. */
1589 val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
1590 gdb_stdout, 'x', 1, 0, Val_pretty_default);
1591 printf_filtered ("\t");
1592 val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
1593 gdb_stdout, 0, 1, 0, Val_pretty_default);
1596 /* The SPARC wants to print even-numbered float regs as doubles
1597 in addition to printing them as floats. */
1598 #ifdef PRINT_REGISTER_HOOK
1599 PRINT_REGISTER_HOOK (i);
1602 printf_filtered ("\n");
1605 #endif /* no DO_REGISTERS_INFO. */
1608 registers_info (addr_exp, fpregs)
1612 int regnum, numregs;
1615 if (!target_has_registers)
1616 error ("The program has no registers now.");
1617 if (selected_frame == NULL)
1618 error ("No selected frame.");
1622 DO_REGISTERS_INFO (-1, fpregs);
1628 if (addr_exp[0] == '$')
1631 while (*end != '\0' && *end != ' ' && *end != '\t')
1633 numregs = ARCH_NUM_REGS;
1635 regnum = target_map_name_to_register (addr_exp, end - addr_exp);
1641 if (*addr_exp >= '0' && *addr_exp <= '9')
1642 regnum = atoi (addr_exp); /* Take a number */
1643 if (regnum >= numregs) /* Bad name, or bad number */
1644 error ("%.*s: invalid register", end - addr_exp, addr_exp);
1647 DO_REGISTERS_INFO (regnum, fpregs);
1650 while (*addr_exp == ' ' || *addr_exp == '\t')
1653 while (*addr_exp != '\0');
1657 all_registers_info (addr_exp, from_tty)
1661 registers_info (addr_exp, 1);
1665 nofp_registers_info (addr_exp, from_tty)
1669 registers_info (addr_exp, 0);
1675 * Should save/restore the tty state since it might be that the
1676 * program to be debugged was started on this tty and it wants
1677 * the tty in some state other than what we want. If it's running
1678 * on another terminal or without a terminal, then saving and
1679 * restoring the tty state is a harmless no-op.
1680 * This only needs to be done if we are attaching to a process.
1685 takes a program started up outside of gdb and ``attaches'' to it.
1686 This stops it cold in its tracks and allows us to start debugging it.
1687 and wait for the trace-trap that results from attaching. */
1690 attach_command (args, from_tty)
1695 extern int auto_solib_add;
1699 char *full_exec_path = NULL;
1701 dont_repeat (); /* Not for the faint of heart */
1703 if (target_has_execution)
1705 if (query ("A program is being debugged already. Kill it? "))
1708 error ("Not killed.");
1711 target_attach (args, from_tty);
1713 /* Set up the "saved terminal modes" of the inferior
1714 based on what modes we are starting it with. */
1715 target_terminal_init ();
1717 /* Install inferior's terminal modes. */
1718 target_terminal_inferior ();
1720 /* Set up execution context to know that we should return from
1721 wait_for_inferior as soon as the target reports a stop. */
1722 init_wait_for_inferior ();
1723 clear_proceed_status ();
1724 stop_soon_quietly = 1;
1726 /* No traps are generated when attaching to inferior under Mach 3
1728 #ifndef ATTACH_NO_WAIT
1729 wait_for_inferior ();
1733 * If no exec file is yet known, try to determine it from the
1736 exec_file = (char *) get_exec_file (0);
1739 exec_file = target_pid_to_exec_file (inferior_pid);
1742 /* It's possible we don't have a full path, but rather just a
1743 filename. Some targets, such as HP-UX, don't provide the
1746 Attempt to qualify the filename against the source path.
1747 (If that fails, we'll just fall back on the original
1748 filename. Not much more we can do...)
1750 if (!source_full_path_of (exec_file, &full_exec_path))
1751 full_exec_path = savestring (exec_file, strlen (exec_file));
1753 exec_file_attach (full_exec_path, from_tty);
1754 symbol_file_command (full_exec_path, from_tty);
1761 /* Add shared library symbols from the newly attached process, if any. */
1762 SOLIB_ADD ((char *) 0, from_tty, ¤t_target);
1763 re_enable_breakpoints_in_shlibs ();
1767 /* Take any necessary post-attaching actions for this platform.
1769 target_post_attach (inferior_pid);
1779 * takes a program previously attached to and detaches it.
1780 * The program resumes execution and will no longer stop
1781 * on signals, etc. We better not have left any breakpoints
1782 * in the program or it'll die when it hits one. For this
1783 * to work, it may be necessary for the process to have been
1784 * previously attached. It *might* work if the program was
1785 * started via the normal ptrace (PTRACE_TRACEME).
1789 detach_command (args, from_tty)
1793 dont_repeat (); /* Not for the faint of heart */
1794 target_detach (args, from_tty);
1795 #if defined(SOLIB_RESTART)
1802 /* Stop the execution of the target while running in async mode, in
1806 interrupt_target_command_wrapper (args, from_tty)
1810 interrupt_target_command (args, from_tty);
1814 interrupt_target_command (args, from_tty)
1818 if (event_loop_p && target_can_async_p ())
1820 dont_repeat (); /* Not for the faint of heart */
1827 float_info (addr_exp, from_tty)
1834 printf_filtered ("No floating point info available for this processor.\n");
1840 unset_command (args, from_tty)
1844 printf_filtered ("\"unset\" must be followed by the name of ");
1845 printf_filtered ("an unset subcommand.\n");
1846 help_list (unsetlist, "unset ", -1, gdb_stdout);
1850 _initialize_infcmd ()
1852 struct cmd_list_element *c;
1854 add_com ("tty", class_run, tty_command,
1855 "Set terminal for future runs of program being debugged.");
1858 (add_set_cmd ("args", class_run, var_string_noescape,
1859 (char *) &inferior_args,
1860 "Set argument list to give program being debugged when it is started.\n\
1861 Follow this command with any number of args, to be passed to the program.",
1866 ("environment", no_class, environment_info,
1867 "The environment to give the program, or one variable's value.\n\
1868 With an argument VAR, prints the value of environment variable VAR to\n\
1869 give the program being debugged. With no arguments, prints the entire\n\
1870 environment to be given to the program.", &showlist);
1871 c->completer = noop_completer;
1873 add_prefix_cmd ("unset", no_class, unset_command,
1874 "Complement to certain \"set\" commands",
1875 &unsetlist, "unset ", 0, &cmdlist);
1877 c = add_cmd ("environment", class_run, unset_environment_command,
1878 "Cancel environment variable VAR for the program.\n\
1879 This does not affect the program until the next \"run\" command.",
1881 c->completer = noop_completer;
1883 c = add_cmd ("environment", class_run, set_environment_command,
1884 "Set environment variable value to give the program.\n\
1885 Arguments are VAR VALUE where VAR is variable name and VALUE is value.\n\
1886 VALUES of environment variables are uninterpreted strings.\n\
1887 This does not affect the program until the next \"run\" command.",
1889 c->completer = noop_completer;
1891 add_com ("path", class_files, path_command,
1892 "Add directory DIR(s) to beginning of search path for object files.\n\
1893 $cwd in the path means the current working directory.\n\
1894 This path is equivalent to the $PATH shell variable. It is a list of\n\
1895 directories, separated by colons. These directories are searched to find\n\
1896 fully linked executable files and separately compiled object files as needed.");
1898 c = add_cmd ("paths", no_class, path_info,
1899 "Current search path for finding object files.\n\
1900 $cwd in the path means the current working directory.\n\
1901 This path is equivalent to the $PATH shell variable. It is a list of\n\
1902 directories, separated by colons. These directories are searched to find\n\
1903 fully linked executable files and separately compiled object files as needed.",
1905 c->completer = noop_completer;
1907 add_com ("attach", class_run, attach_command,
1908 "Attach to a process or file outside of GDB.\n\
1909 This command attaches to another target, of the same type as your last\n\
1910 \"target\" command (\"info files\" will show your target stack).\n\
1911 The command may take as argument a process id or a device file.\n\
1912 For a process id, you must have permission to send the process a signal,\n\
1913 and it must have the same effective uid as the debugger.\n\
1914 When using \"attach\" with a process id, the debugger finds the\n\
1915 program running in the process, looking first in the current working\n\
1916 directory, or (if not found there) using the source file search path\n\
1917 (see the \"directory\" command). You can also use the \"file\" command\n\
1918 to specify the program, and to load its symbol table.");
1920 add_com ("detach", class_run, detach_command,
1921 "Detach a process or file previously attached.\n\
1922 If a process, it is no longer traced, and it continues its execution. If\n\
1923 you were debugging a file, the file is closed and gdb no longer accesses it.");
1925 add_com ("signal", class_run, signal_command,
1926 "Continue program giving it signal specified by the argument.\n\
1927 An argument of \"0\" means continue program without giving it a signal.");
1929 add_com ("stepi", class_run, stepi_command,
1930 "Step one instruction exactly.\n\
1931 Argument N means do this N times (or till program stops for another reason).");
1932 add_com_alias ("si", "stepi", class_alias, 0);
1934 add_com ("nexti", class_run, nexti_command,
1935 "Step one instruction, but proceed through subroutine calls.\n\
1936 Argument N means do this N times (or till program stops for another reason).");
1937 add_com_alias ("ni", "nexti", class_alias, 0);
1939 add_com ("finish", class_run, finish_command,
1940 "Execute until selected stack frame returns.\n\
1941 Upon return, the value returned is printed and put in the value history.");
1943 add_com ("next", class_run, next_command,
1944 "Step program, proceeding through subroutine calls.\n\
1945 Like the \"step\" command as long as subroutine calls do not happen;\n\
1946 when they do, the call is treated as one instruction.\n\
1947 Argument N means do this N times (or till program stops for another reason).");
1948 add_com_alias ("n", "next", class_run, 1);
1950 add_com_alias ("S", "next", class_run, 1);
1952 add_com ("step", class_run, step_command,
1953 "Step program until it reaches a different source line.\n\
1954 Argument N means do this N times (or till program stops for another reason).");
1955 add_com_alias ("s", "step", class_run, 1);
1957 add_com ("until", class_run, until_command,
1958 "Execute until the program reaches a source line greater than the current\n\
1959 or a specified line or address or function (same args as break command).\n\
1960 Execution will also stop upon exit from the current stack frame.");
1961 add_com_alias ("u", "until", class_run, 1);
1963 add_com ("jump", class_run, jump_command,
1964 "Continue program being debugged at specified line or address.\n\
1965 Give as argument either LINENUM or *ADDR, where ADDR is an expression\n\
1966 for an address to start at.");
1969 add_com ("go", class_run, go_command,
1970 "Usage: go <location>\n\
1971 Continue program being debugged, stopping at specified line or \n\
1973 Give as argument either LINENUM or *ADDR, where ADDR is an \n\
1974 expression for an address to start at.\n\
1975 This command is a combination of tbreak and jump.");
1978 add_com_alias ("g", "go", class_run, 1);
1980 add_com ("continue", class_run, continue_command,
1981 "Continue program being debugged, after signal or breakpoint.\n\
1982 If proceeding from breakpoint, a number N may be used as an argument,\n\
1983 which means to set the ignore count of that breakpoint to N - 1 (so that\n\
1984 the breakpoint won't break until the Nth time it is reached).");
1985 add_com_alias ("c", "cont", class_run, 1);
1986 add_com_alias ("fg", "cont", class_run, 1);
1988 add_com ("run", class_run, run_command,
1989 "Start debugged program. You may specify arguments to give it.\n\
1990 Args may include \"*\", or \"[...]\"; they are expanded using \"sh\".\n\
1991 Input and output redirection with \">\", \"<\", or \">>\" are also allowed.\n\n\
1992 With no arguments, uses arguments last specified (with \"run\" or \"set args\").\n\
1993 To cancel previous arguments and run with no arguments,\n\
1994 use \"set args\" without arguments.");
1995 add_com_alias ("r", "run", class_run, 1);
1997 add_com ("R", class_run, run_no_args_command,
1998 "Start debugged program with no arguments.");
2000 add_com ("interrupt", class_run, interrupt_target_command,
2001 "Interrupt the execution of the debugged program.");
2003 add_info ("registers", 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_alias ("r", "registers", 1);
2009 add_com ("lr", class_info, nofp_registers_info,
2010 "List of integer registers and their contents, for selected stack frame.\n\
2011 Register name as argument means describe only that register.");
2012 add_info ("all-registers", all_registers_info,
2013 "List of all registers and their contents, for selected stack frame.\n\
2014 Register name as argument means describe only that register.");
2016 add_info ("program", program_info,
2017 "Execution status of the program.");
2019 add_info ("float", float_info,
2020 "Print the status of the floating point unit\n");
2022 inferior_args = savestring ("", 1); /* Initially no args */
2023 inferior_environ = make_environ ();
2024 init_environ (inferior_environ);