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 static void unset_environment_command (char *, int);
77 static void set_environment_command (char *, int);
79 static void environment_info (char *, int);
81 static void program_info (char *, int);
83 static void finish_command (char *, int);
85 static void signal_command (char *, int);
87 static void jump_command (char *, int);
89 static void step_1 (int, int, char *);
90 static void step_once (int skip_subroutines, int single_inst, int count);
91 static void step_1_continuation (struct continuation_arg *arg);
93 void nexti_command (char *, int);
95 void stepi_command (char *, int);
97 static void next_command (char *, int);
99 static void step_command (char *, int);
101 static void run_command (char *, int);
103 static void run_no_args_command (char *args, int from_tty);
105 static void go_command (char *line_no, int from_tty);
107 static int strip_bg_char (char **);
109 void _initialize_infcmd (void);
111 #define GO_USAGE "Usage: go <location>\n"
113 static void breakpoint_auto_delete_contents (PTR);
115 #define ERROR_NO_INFERIOR \
116 if (!target_has_execution) error ("The program is not being run.");
118 /* String containing arguments to give to the program, separated by spaces.
119 Empty string (pointer to '\0') means no args. */
121 static char *inferior_args;
123 /* File name for default use for standard in/out in the inferior. */
125 char *inferior_io_terminal;
127 /* Pid of our debugged inferior, or 0 if no inferior now.
128 Since various parts of infrun.c test this to see whether there is a program
129 being debugged it should be nonzero (currently 3 is used) for remote
134 /* Last signal that the inferior received (why it stopped). */
136 enum target_signal stop_signal;
138 /* Address at which inferior stopped. */
142 /* Chain containing status of breakpoint(s) that we have stopped at. */
146 /* Flag indicating that a command has proceeded the inferior past the
147 current breakpoint. */
149 int breakpoint_proceeded;
151 /* Nonzero if stopped due to a step command. */
155 /* Nonzero if stopped due to completion of a stack dummy routine. */
157 int stop_stack_dummy;
159 /* Nonzero if stopped due to a random (unexpected) signal in inferior
162 int stopped_by_random_signal;
164 /* Range to single step within.
165 If this is nonzero, respond to a single-step signal
166 by continuing to step if the pc is in this range. */
168 CORE_ADDR step_range_start; /* Inclusive */
169 CORE_ADDR step_range_end; /* Exclusive */
171 /* Stack frame address as of when stepping command was issued.
172 This is how we know when we step into a subroutine call,
173 and how to set the frame for the breakpoint used to step out. */
175 CORE_ADDR step_frame_address;
177 /* Our notion of the current stack pointer. */
181 /* 1 means step over all subroutine calls.
182 0 means don't step over calls (used by stepi).
183 -1 means step over calls to undebuggable functions. */
187 /* If stepping, nonzero means step count is > 1
188 so don't print frame next time inferior stops
189 if it stops due to stepping. */
193 /* Environment to use for running inferior,
194 in format described in environ.h. */
196 struct environ *inferior_environ;
199 /* This function detects whether or not a '&' character (indicating
200 background execution) has been added as *the last* of the arguments ARGS
201 of a command. If it has, it removes it and returns 1. Otherwise it
202 does nothing and returns 0. */
204 strip_bg_char (char **args)
208 p = strchr (*args, '&');
212 if (p == (*args + strlen (*args) - 1))
214 if (strlen (*args) > 1)
218 while (*p == ' ' || *p == '\t');
231 tty_command (char *file, int from_tty)
234 error_no_arg ("terminal name for running target process");
236 inferior_io_terminal = savestring (file, strlen (file));
240 run_command (char *args, int from_tty)
246 if (inferior_pid != 0 && target_has_execution)
249 && !query ("The program being debugged has been started already.\n\
250 Start it from the beginning? "))
251 error ("Program not restarted.");
253 #if defined(SOLIB_RESTART)
256 init_wait_for_inferior ();
259 clear_breakpoint_hit_counts ();
261 exec_file = (char *) get_exec_file (0);
263 /* Purge old solib objfiles. */
264 objfile_purge_solibs ();
266 do_run_cleanups (NULL);
268 /* The exec file is re-read every time we do a generic_mourn_inferior, so
269 we just have to worry about the symbol file. */
272 /* We keep symbols from add-symbol-file, on the grounds that the
273 user might want to add some symbols before running the program
274 (right?). But sometimes (dynamic loading where the user manually
275 introduces the new symbols with add-symbol-file), the code which
276 the symbols describe does not persist between runs. Currently
277 the user has to manually nuke all symbols between runs if they
278 want them to go away (PR 2207). This is probably reasonable. */
282 if (event_loop_p && target_can_async_p ())
283 async_disable_stdin ();
288 int async_exec = strip_bg_char (&args);
290 /* If we get a request for running in the bg but the target
291 doesn't support it, error out. */
292 if (event_loop_p && async_exec && !target_can_async_p ())
293 error ("Asynchronous execution not supported on this target.");
295 /* If we don't get a request of running in the bg, then we need
296 to simulate synchronous (fg) execution. */
297 if (event_loop_p && !async_exec && target_can_async_p ())
299 /* Simulate synchronous execution */
300 async_disable_stdin ();
303 /* If there were other args, beside '&', process them. */
306 cmd = concat ("set args ", args, NULL);
307 make_cleanup (free, cmd);
308 execute_command (cmd, from_tty);
315 ui_out_field_string (uiout, NULL, "Starting program");
316 ui_out_text (uiout, ": ");
318 ui_out_field_string (uiout, "execfile", exec_file);
319 ui_out_spaces (uiout, 1);
320 ui_out_field_string (uiout, "infargs", inferior_args);
321 ui_out_text (uiout, "\n");
322 ui_out_flush (uiout);
324 puts_filtered ("Starting program: ");
326 puts_filtered (exec_file);
328 puts_filtered (inferior_args);
329 puts_filtered ("\n");
330 gdb_flush (gdb_stdout);
334 target_create_inferior (exec_file, inferior_args,
335 environ_vector (inferior_environ));
340 run_no_args_command (char *args, int from_tty)
342 execute_command ("set args", from_tty);
343 run_command ((char *) NULL, from_tty);
348 continue_command (char *proc_count_exp, int from_tty)
353 /* Find out whether we must run in the background. */
354 if (proc_count_exp != NULL)
355 async_exec = strip_bg_char (&proc_count_exp);
357 /* If we must run in the background, but the target can't do it,
359 if (event_loop_p && async_exec && !target_can_async_p ())
360 error ("Asynchronous execution not supported on this target.");
362 /* If we are not asked to run in the bg, then prepare to run in the
363 foreground, synchronously. */
364 if (event_loop_p && !async_exec && target_can_async_p ())
366 /* Simulate synchronous execution */
367 async_disable_stdin ();
370 /* If have argument (besides '&'), set proceed count of breakpoint
372 if (proc_count_exp != NULL)
374 bpstat bs = stop_bpstat;
375 int num = bpstat_num (&bs);
376 if (num == 0 && from_tty)
379 ("Not stopped at any breakpoint; argument ignored.\n");
383 set_ignore_count (num,
384 parse_and_eval_long (proc_count_exp) - 1,
386 /* set_ignore_count prints a message ending with a period.
387 So print two spaces before "Continuing.". */
389 printf_filtered (" ");
390 num = bpstat_num (&bs);
395 printf_filtered ("Continuing.\n");
397 clear_proceed_status ();
399 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
402 /* Step until outside of current statement. */
406 step_command (char *count_string, int from_tty)
408 step_1 (0, 0, count_string);
411 /* Likewise, but skip over subroutine calls as if single instructions. */
415 next_command (char *count_string, int from_tty)
417 step_1 (1, 0, count_string);
420 /* Likewise, but step only one instruction. */
424 stepi_command (char *count_string, int from_tty)
426 step_1 (0, 1, count_string);
431 nexti_command (char *count_string, int from_tty)
433 step_1 (1, 1, count_string);
437 disable_longjmp_breakpoint_cleanup (void *ignore)
439 disable_longjmp_breakpoint ();
443 step_1 (int skip_subroutines, int single_inst, char *count_string)
445 register int count = 1;
446 struct frame_info *frame;
447 struct cleanup *cleanups = 0;
453 async_exec = strip_bg_char (&count_string);
455 /* If we get a request for running in the bg but the target
456 doesn't support it, error out. */
457 if (event_loop_p && async_exec && !target_can_async_p ())
458 error ("Asynchronous execution not supported on this target.");
460 /* If we don't get a request of running in the bg, then we need
461 to simulate synchronous (fg) execution. */
462 if (event_loop_p && !async_exec && target_can_async_p ())
464 /* Simulate synchronous execution */
465 async_disable_stdin ();
468 count = count_string ? parse_and_eval_long (count_string) : 1;
470 if (!single_inst || skip_subroutines) /* leave si command alone */
472 enable_longjmp_breakpoint ();
473 if (!event_loop_p || !target_can_async_p ())
474 cleanups = make_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/);
476 make_exec_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/);
479 /* In synchronous case, all is well, just use the regular for loop. */
480 if (!event_loop_p || !target_can_async_p ())
482 for (; count > 0; count--)
484 clear_proceed_status ();
486 frame = get_current_frame ();
487 if (!frame) /* Avoid coredump here. Why tho? */
488 error ("No current frame");
489 step_frame_address = FRAME_FP (frame);
490 step_sp = read_sp ();
494 find_pc_line_pc_range (stop_pc, &step_range_start, &step_range_end);
495 if (step_range_end == 0)
498 if (find_pc_partial_function (stop_pc, &name, &step_range_start,
499 &step_range_end) == 0)
500 error ("Cannot find bounds of current function");
502 target_terminal_ours ();
504 Single stepping until exit from function %s, \n\
505 which has no line number information.\n", name);
510 /* Say we are stepping, but stop after one insn whatever it does. */
511 step_range_start = step_range_end = 1;
512 if (!skip_subroutines)
514 Don't step over function calls, not even to functions lacking
519 if (skip_subroutines)
522 step_multi = (count > 1);
523 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
528 /* FIXME: On nexti, this may have already been done (when we hit the
529 step resume break, I think). Probably this should be moved to
530 wait_for_inferior (near the top). */
531 #if defined (SHIFT_INST_REGS)
536 if (!single_inst || skip_subroutines)
537 do_cleanups (cleanups);
540 /* In case of asynchronous target things get complicated, do only
541 one step for now, before returning control to the event loop. Let
542 the continuation figure out how many other steps we need to do,
543 and handle them one at the time, through step_once(). */
546 if (event_loop_p && target_can_async_p ())
547 step_once (skip_subroutines, single_inst, count);
551 /* Called after we are done with one step operation, to check whether
552 we need to step again, before we print the prompt and return control
553 to the user. If count is > 1, we will need to do one more call to
554 proceed(), via step_once(). Basically it is like step_once and
555 step_1_continuation are co-recursive. */
557 step_1_continuation (struct continuation_arg *arg)
560 int skip_subroutines;
563 skip_subroutines = arg->data.integer;
564 single_inst = arg->next->data.integer;
565 count = arg->next->next->data.integer;
569 /* FIXME: On nexti, this may have already been done (when we hit the
570 step resume break, I think). Probably this should be moved to
571 wait_for_inferior (near the top). */
572 #if defined (SHIFT_INST_REGS)
575 step_once (skip_subroutines, single_inst, count - 1);
578 if (!single_inst || skip_subroutines)
579 do_exec_cleanups (ALL_CLEANUPS);
582 /* Do just one step operation. If count >1 we will have to set up a
583 continuation to be done after the target stops (after this one
584 step). This is useful to implement the 'step n' kind of commands, in
585 case of asynchronous targets. We had to split step_1 into two parts,
586 one to be done before proceed() and one afterwards. This function is
587 called in case of step n with n>1, after the first step operation has
590 step_once (int skip_subroutines, int single_inst, int count)
592 struct continuation_arg *arg1;
593 struct continuation_arg *arg2;
594 struct continuation_arg *arg3;
595 struct frame_info *frame;
599 clear_proceed_status ();
601 frame = get_current_frame ();
602 if (!frame) /* Avoid coredump here. Why tho? */
603 error ("No current frame");
604 step_frame_address = FRAME_FP (frame);
605 step_sp = read_sp ();
609 find_pc_line_pc_range (stop_pc, &step_range_start, &step_range_end);
610 if (step_range_end == 0)
613 if (find_pc_partial_function (stop_pc, &name, &step_range_start,
614 &step_range_end) == 0)
615 error ("Cannot find bounds of current function");
617 target_terminal_ours ();
619 Single stepping until exit from function %s, \n\
620 which has no line number information.\n", name);
625 /* Say we are stepping, but stop after one insn whatever it does. */
626 step_range_start = step_range_end = 1;
627 if (!skip_subroutines)
629 Don't step over function calls, not even to functions lacking
634 if (skip_subroutines)
637 step_multi = (count > 1);
639 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
641 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
643 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
645 arg1->data.integer = skip_subroutines;
647 arg2->data.integer = single_inst;
649 arg3->data.integer = count;
650 add_intermediate_continuation (step_1_continuation, arg1);
651 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
656 /* Continue program at specified address. */
659 jump_command (char *arg, int from_tty)
661 register CORE_ADDR addr;
662 struct symtabs_and_lines sals;
663 struct symtab_and_line sal;
670 /* Find out whether we must run in the background. */
672 async_exec = strip_bg_char (&arg);
674 /* If we must run in the background, but the target can't do it,
676 if (event_loop_p && async_exec && !target_can_async_p ())
677 error ("Asynchronous execution not supported on this target.");
679 /* If we are not asked to run in the bg, then prepare to run in the
680 foreground, synchronously. */
681 if (event_loop_p && !async_exec && target_can_async_p ())
683 /* Simulate synchronous execution */
684 async_disable_stdin ();
688 error_no_arg ("starting address");
690 sals = decode_line_spec_1 (arg, 1);
693 error ("Unreasonable jump request");
697 free ((PTR) sals.sals);
699 if (sal.symtab == 0 && sal.pc == 0)
700 error ("No source file has been specified.");
702 resolve_sal_pc (&sal); /* May error out */
704 /* See if we are trying to jump to another function. */
705 fn = get_frame_function (get_current_frame ());
706 sfn = find_pc_function (sal.pc);
707 if (fn != NULL && sfn != fn)
709 if (!query ("Line %d is not in `%s'. Jump anyway? ", sal.line,
710 SYMBOL_SOURCE_NAME (fn)))
712 error ("Not confirmed.");
719 fixup_symbol_section (sfn, 0);
720 if (section_is_overlay (SYMBOL_BFD_SECTION (sfn)) &&
721 !section_is_mapped (SYMBOL_BFD_SECTION (sfn)))
723 if (!query ("WARNING!!! Destination is in unmapped overlay! Jump anyway? "))
725 error ("Not confirmed.");
735 printf_filtered ("Continuing at ");
736 print_address_numeric (addr, 1, gdb_stdout);
737 printf_filtered (".\n");
740 clear_proceed_status ();
741 proceed (addr, TARGET_SIGNAL_0, 0);
745 /* Go to line or address in current procedure */
747 go_command (char *line_no, int from_tty)
749 if (line_no == (char *) NULL || !*line_no)
750 printf_filtered (GO_USAGE);
753 tbreak_command (line_no, from_tty);
754 jump_command (line_no, from_tty);
759 /* Continue program giving it specified signal. */
762 signal_command (char *signum_exp, int from_tty)
764 enum target_signal oursig;
766 dont_repeat (); /* Too dangerous. */
770 error_no_arg ("signal number");
772 /* It would be even slicker to make signal names be valid expressions,
773 (the type could be "enum $signal" or some such), then the user could
774 assign them to convenience variables. */
775 oursig = target_signal_from_name (signum_exp);
777 if (oursig == TARGET_SIGNAL_UNKNOWN)
779 /* No, try numeric. */
780 int num = parse_and_eval_long (signum_exp);
783 oursig = TARGET_SIGNAL_0;
785 oursig = target_signal_from_command (num);
790 if (oursig == TARGET_SIGNAL_0)
791 printf_filtered ("Continuing with no signal.\n");
793 printf_filtered ("Continuing with signal %s.\n",
794 target_signal_to_name (oursig));
797 clear_proceed_status ();
798 /* "signal 0" should not get stuck if we are stopped at a breakpoint.
799 FIXME: Neither should "signal foo" but when I tried passing
800 (CORE_ADDR)-1 unconditionally I got a testsuite failure which I haven't
801 tried to track down yet. */
802 proceed (oursig == TARGET_SIGNAL_0 ? (CORE_ADDR) -1 : stop_pc, oursig, 0);
805 /* Call breakpoint_auto_delete on the current contents of the bpstat
806 pointed to by arg (which is really a bpstat *). */
809 breakpoint_auto_delete_contents (PTR arg)
811 breakpoint_auto_delete (*(bpstat *) arg);
815 /* Execute a "stack dummy", a piece of code stored in the stack
816 by the debugger to be executed in the inferior.
818 To call: first, do PUSH_DUMMY_FRAME.
819 Then push the contents of the dummy. It should end with a breakpoint insn.
820 Then call here, passing address at which to start the dummy.
822 The contents of all registers are saved before the dummy frame is popped
823 and copied into the buffer BUFFER.
825 The dummy's frame is automatically popped whenever that break is hit.
826 If that is the first time the program stops, run_stack_dummy
827 returns to its caller with that frame already gone and returns 0.
829 Otherwise, run_stack-dummy returns a non-zero value.
830 If the called function receives a random signal, we do not allow the user
831 to continue executing it as this may not work. The dummy frame is poped
833 If we hit a breakpoint, we leave the frame in place and return 2 (the frame
834 will eventually be popped when we do hit the dummy end breakpoint). */
837 run_stack_dummy (CORE_ADDR addr, char *buffer)
839 struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0);
842 /* Now proceed, having reached the desired place. */
843 clear_proceed_status ();
845 if (CALL_DUMMY_BREAKPOINT_OFFSET_P)
847 struct breakpoint *bpt;
848 struct symtab_and_line sal;
850 INIT_SAL (&sal); /* initialize to zeroes */
851 if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT)
853 sal.pc = CALL_DUMMY_ADDRESS ();
857 sal.pc = addr - CALL_DUMMY_START_OFFSET + CALL_DUMMY_BREAKPOINT_OFFSET;
859 sal.section = find_pc_overlay (sal.pc);
861 /* Set up a FRAME for the dummy frame so we can pass it to
862 set_momentary_breakpoint. We need to give the breakpoint a
863 frame in case there is only one copy of the dummy (e.g.
864 CALL_DUMMY_LOCATION == AFTER_TEXT_END). */
865 flush_cached_frames ();
866 set_current_frame (create_new_frame (read_fp (), sal.pc));
868 /* If defined, CALL_DUMMY_BREAKPOINT_OFFSET is where we need to put
869 a breakpoint instruction. If not, the call dummy already has the
870 breakpoint instruction in it.
872 addr is the address of the call dummy plus the CALL_DUMMY_START_OFFSET,
873 so we need to subtract the CALL_DUMMY_START_OFFSET. */
874 bpt = set_momentary_breakpoint (sal,
875 get_current_frame (),
877 bpt->disposition = del;
879 /* If all error()s out of proceed ended up calling normal_stop (and
880 perhaps they should; it already does in the special case of error
881 out of resume()), then we wouldn't need this. */
882 make_cleanup (breakpoint_auto_delete_contents, &stop_bpstat);
885 disable_watchpoints_before_interactive_call_start ();
886 proceed_to_finish = 1; /* We want stop_registers, please... */
888 if (target_can_async_p ())
889 saved_async = target_async_mask (0);
891 proceed (addr, TARGET_SIGNAL_0, 0);
894 target_async_mask (saved_async);
896 enable_watchpoints_after_interactive_call_stop ();
898 discard_cleanups (old_cleanups);
900 /* We can stop during an inferior call because a signal is received. */
901 if (stopped_by_random_signal)
904 /* We may also stop prematurely because we hit a breakpoint in the
906 if (!stop_stack_dummy)
909 /* On normal return, the stack dummy has been popped already. */
911 memcpy (buffer, stop_registers, REGISTER_BYTES);
915 /* Proceed until we reach a different source line with pc greater than
916 our current one or exit the function. We skip calls in both cases.
918 Note that eventually this command should probably be changed so
919 that only source lines are printed out when we hit the breakpoint
920 we set. This may involve changes to wait_for_inferior and the
921 proceed status code. */
925 until_next_command (int from_tty)
927 struct frame_info *frame;
930 struct symtab_and_line sal;
932 clear_proceed_status ();
934 frame = get_current_frame ();
936 /* Step until either exited from this function or greater
937 than the current line (if in symbolic section) or pc (if
941 func = find_pc_function (pc);
945 struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (pc);
948 error ("Execution is not within a known function.");
950 step_range_start = SYMBOL_VALUE_ADDRESS (msymbol);
955 sal = find_pc_line (pc, 0);
957 step_range_start = BLOCK_START (SYMBOL_BLOCK_VALUE (func));
958 step_range_end = sal.end;
962 step_frame_address = FRAME_FP (frame);
963 step_sp = read_sp ();
965 step_multi = 0; /* Only one call to proceed */
967 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
971 until_command (char *arg, int from_tty)
975 if (!target_has_execution)
976 error ("The program is not running.");
978 /* Find out whether we must run in the background. */
980 async_exec = strip_bg_char (&arg);
982 /* If we must run in the background, but the target can't do it,
984 if (event_loop_p && async_exec && !target_can_async_p ())
985 error ("Asynchronous execution not supported on this target.");
987 /* If we are not asked to run in the bg, then prepare to run in the
988 foreground, synchronously. */
989 if (event_loop_p && !async_exec && target_can_async_p ())
991 /* Simulate synchronous execution */
992 async_disable_stdin ();
996 until_break_command (arg, from_tty);
998 until_next_command (from_tty);
1002 /* Print the result of a function at the end of a 'finish' command. */
1004 print_return_value (int structure_return, struct type *value_type)
1006 register value_ptr value;
1008 static struct ui_stream *stb = NULL;
1011 if (!structure_return)
1013 value = value_being_returned (value_type, stop_registers, structure_return);
1015 stb = ui_out_stream_new (uiout);
1016 ui_out_text (uiout, "Value returned is ");
1017 ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value));
1018 ui_out_text (uiout, "= ");
1019 value_print (value, stb->stream, 0, Val_no_prettyprint);
1020 ui_out_field_stream (uiout, "return-value", stb);
1021 ui_out_text (uiout, "\n");
1023 printf_filtered ("Value returned is $%d = ", record_latest_value (value));
1024 value_print (value, gdb_stdout, 0, Val_no_prettyprint);
1025 printf_filtered ("\n");
1030 /* We cannot determine the contents of the structure because
1031 it is on the stack, and we don't know where, since we did not
1032 initiate the call, as opposed to the call_function_by_hand case */
1033 #ifdef VALUE_RETURNED_FROM_STACK
1036 ui_out_text (uiout, "Value returned has type: ");
1037 ui_out_field_string (uiout, "return-type", TYPE_NAME (value_type));
1038 ui_out_text (uiout, ".");
1039 ui_out_text (uiout, " Cannot determine contents\n");
1041 printf_filtered ("Value returned has type: %s.", TYPE_NAME (value_type));
1042 printf_filtered (" Cannot determine contents\n");
1045 value = value_being_returned (value_type, stop_registers, structure_return);
1047 stb = ui_out_stream_new (uiout);
1048 ui_out_text (uiout, "Value returned is ");
1049 ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value));
1050 ui_out_text (uiout, "= ");
1051 value_print (value, stb->stream, 0, Val_no_prettyprint);
1052 ui_out_field_stream (uiout, "return-value", stb);
1053 ui_out_text (uiout, "\n");
1055 printf_filtered ("Value returned is $%d = ", record_latest_value (value));
1056 value_print (value, gdb_stdout, 0, Val_no_prettyprint);
1057 printf_filtered ("\n");
1063 /* Stuff that needs to be done by the finish command after the target
1064 has stopped. In asynchronous mode, we wait for the target to stop in
1065 the call to poll or select in the event loop, so it is impossible to
1066 do all the stuff as part of the finish_command function itself. The
1067 only chance we have to complete this command is in
1068 fetch_inferior_event, which is called by the event loop as soon as it
1069 detects that the target has stopped. This function is called via the
1070 cmd_continuation pointer. */
1072 finish_command_continuation (struct continuation_arg *arg)
1074 register struct symbol *function;
1075 struct breakpoint *breakpoint;
1076 struct cleanup *cleanups;
1078 breakpoint = (struct breakpoint *) arg->data.pointer;
1079 function = (struct symbol *) arg->next->data.pointer;
1080 cleanups = (struct cleanup *) arg->next->next->data.pointer;
1082 if (bpstat_find_breakpoint (stop_bpstat, breakpoint) != NULL
1085 struct type *value_type;
1089 value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function));
1091 internal_error ("finish_command: function has no target type");
1093 if (TYPE_CODE (value_type) == TYPE_CODE_VOID)
1095 do_exec_cleanups (cleanups);
1099 funcaddr = BLOCK_START (SYMBOL_BLOCK_VALUE (function));
1101 struct_return = using_struct_return (value_of_variable (function, NULL),
1103 check_typedef (value_type),
1104 BLOCK_GCC_COMPILED (SYMBOL_BLOCK_VALUE (function)));
1106 print_return_value (struct_return, value_type);
1108 do_exec_cleanups (cleanups);
1111 /* "finish": Set a temporary breakpoint at the place
1112 the selected frame will return to, then continue. */
1115 finish_command (char *arg, int from_tty)
1117 struct symtab_and_line sal;
1118 register struct frame_info *frame;
1119 register struct symbol *function;
1120 struct breakpoint *breakpoint;
1121 struct cleanup *old_chain;
1122 struct continuation_arg *arg1, *arg2, *arg3;
1126 /* Find out whether we must run in the background. */
1128 async_exec = strip_bg_char (&arg);
1130 /* If we must run in the background, but the target can't do it,
1132 if (event_loop_p && async_exec && !target_can_async_p ())
1133 error ("Asynchronous execution not supported on this target.");
1135 /* If we are not asked to run in the bg, then prepare to run in the
1136 foreground, synchronously. */
1137 if (event_loop_p && !async_exec && target_can_async_p ())
1139 /* Simulate synchronous execution */
1140 async_disable_stdin ();
1144 error ("The \"finish\" command does not take any arguments.");
1145 if (!target_has_execution)
1146 error ("The program is not running.");
1147 if (selected_frame == NULL)
1148 error ("No selected frame.");
1150 frame = get_prev_frame (selected_frame);
1152 error ("\"finish\" not meaningful in the outermost frame.");
1154 clear_proceed_status ();
1156 sal = find_pc_line (frame->pc, 0);
1159 breakpoint = set_momentary_breakpoint (sal, frame, bp_finish);
1161 if (!event_loop_p || !target_can_async_p ())
1162 old_chain = make_cleanup_delete_breakpoint (breakpoint);
1164 old_chain = make_exec_cleanup_delete_breakpoint (breakpoint);
1166 /* Find the function we will return from. */
1168 function = find_pc_function (selected_frame->pc);
1170 /* Print info on the selected frame, including level number
1174 printf_filtered ("Run till exit from ");
1175 print_stack_frame (selected_frame, selected_frame_level, 0);
1178 /* If running asynchronously and the target support asynchronous
1179 execution, set things up for the rest of the finish command to be
1180 completed later on, when gdb has detected that the target has
1181 stopped, in fetch_inferior_event. */
1182 if (event_loop_p && target_can_async_p ())
1185 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
1187 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
1189 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
1193 arg1->data.pointer = breakpoint;
1194 arg2->data.pointer = function;
1195 arg3->data.pointer = old_chain;
1196 add_continuation (finish_command_continuation, arg1);
1199 proceed_to_finish = 1; /* We want stop_registers, please... */
1200 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
1202 /* Do this only if not running asynchronously or if the target
1203 cannot do async execution. Otherwise, complete this command when
1204 the target actually stops, in fetch_inferior_event. */
1205 if (!event_loop_p || !target_can_async_p ())
1208 /* Did we stop at our breakpoint? */
1209 if (bpstat_find_breakpoint (stop_bpstat, breakpoint) != NULL
1212 struct type *value_type;
1216 value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function));
1218 internal_error ("finish_command: function has no target type");
1220 /* FIXME: Shouldn't we do the cleanups before returning? */
1221 if (TYPE_CODE (value_type) == TYPE_CODE_VOID)
1224 funcaddr = BLOCK_START (SYMBOL_BLOCK_VALUE (function));
1227 using_struct_return (value_of_variable (function, NULL),
1229 check_typedef (value_type),
1230 BLOCK_GCC_COMPILED (SYMBOL_BLOCK_VALUE (function)));
1232 print_return_value (struct_return, value_type);
1234 do_cleanups (old_chain);
1240 program_info (char *args, int from_tty)
1242 bpstat bs = stop_bpstat;
1243 int num = bpstat_num (&bs);
1245 if (!target_has_execution)
1247 printf_filtered ("The program being debugged is not being run.\n");
1251 target_files_info ();
1252 printf_filtered ("Program stopped at %s.\n",
1253 local_hex_string ((unsigned long) stop_pc));
1255 printf_filtered ("It stopped after being stepped.\n");
1258 /* There may be several breakpoints in the same place, so this
1259 isn't as strange as it seems. */
1264 printf_filtered ("It stopped at a breakpoint that has ");
1265 printf_filtered ("since been deleted.\n");
1268 printf_filtered ("It stopped at breakpoint %d.\n", num);
1269 num = bpstat_num (&bs);
1272 else if (stop_signal != TARGET_SIGNAL_0)
1274 printf_filtered ("It stopped with signal %s, %s.\n",
1275 target_signal_to_name (stop_signal),
1276 target_signal_to_string (stop_signal));
1281 printf_filtered ("Type \"info stack\" or \"info registers\" ");
1282 printf_filtered ("for more information.\n");
1287 environment_info (char *var, int from_tty)
1291 register char *val = get_in_environ (inferior_environ, var);
1294 puts_filtered (var);
1295 puts_filtered (" = ");
1296 puts_filtered (val);
1297 puts_filtered ("\n");
1301 puts_filtered ("Environment variable \"");
1302 puts_filtered (var);
1303 puts_filtered ("\" not defined.\n");
1308 register char **vector = environ_vector (inferior_environ);
1311 puts_filtered (*vector++);
1312 puts_filtered ("\n");
1318 set_environment_command (char *arg, int from_tty)
1320 register char *p, *val, *var;
1324 error_no_arg ("environment variable and value");
1326 /* Find seperation between variable name and value */
1327 p = (char *) strchr (arg, '=');
1328 val = (char *) strchr (arg, ' ');
1330 if (p != 0 && val != 0)
1332 /* We have both a space and an equals. If the space is before the
1333 equals, walk forward over the spaces til we see a nonspace
1334 (possibly the equals). */
1339 /* Now if the = is after the char following the spaces,
1340 take the char following the spaces. */
1344 else if (val != 0 && p == 0)
1348 error_no_arg ("environment variable to set");
1350 if (p == 0 || p[1] == 0)
1354 p = arg + strlen (arg); /* So that savestring below will work */
1358 /* Not setting variable value to null */
1360 while (*val == ' ' || *val == '\t')
1364 while (p != arg && (p[-1] == ' ' || p[-1] == '\t'))
1367 var = savestring (arg, p - arg);
1370 printf_filtered ("Setting environment variable ");
1371 printf_filtered ("\"%s\" to null value.\n", var);
1372 set_in_environ (inferior_environ, var, "");
1375 set_in_environ (inferior_environ, var, val);
1380 unset_environment_command (char *var, int from_tty)
1384 /* If there is no argument, delete all environment variables.
1385 Ask for confirmation if reading from the terminal. */
1386 if (!from_tty || query ("Delete all environment variables? "))
1388 free_environ (inferior_environ);
1389 inferior_environ = make_environ ();
1393 unset_in_environ (inferior_environ, var);
1396 /* Handle the execution path (PATH variable) */
1398 static const char path_var_name[] = "PATH";
1402 path_info (char *args, int from_tty)
1404 puts_filtered ("Executable and object file path: ");
1405 puts_filtered (get_in_environ (inferior_environ, path_var_name));
1406 puts_filtered ("\n");
1409 /* Add zero or more directories to the front of the execution path. */
1412 path_command (char *dirname, int from_tty)
1417 env = get_in_environ (inferior_environ, path_var_name);
1418 /* Can be null if path is not set */
1421 exec_path = strsave (env);
1422 mod_path (dirname, &exec_path);
1423 set_in_environ (inferior_environ, path_var_name, exec_path);
1426 path_info ((char *) NULL, from_tty);
1430 #ifdef REGISTER_NAMES
1431 char *gdb_register_names[] = REGISTER_NAMES;
1433 /* Print out the machine register regnum. If regnum is -1,
1434 print all registers (fpregs == 1) or all non-float registers
1437 For most machines, having all_registers_info() print the
1438 register(s) one per line is good enough. If a different format
1439 is required, (eg, for MIPS or Pyramid 90x, which both have
1440 lots of regs), or there is an existing convention for showing
1441 all the registers, define the macro DO_REGISTERS_INFO(regnum, fp)
1442 to provide that format. */
1445 do_registers_info (int regnum, int fpregs)
1448 int numregs = ARCH_NUM_REGS;
1450 for (i = 0; i < numregs; i++)
1452 char raw_buffer[MAX_REGISTER_RAW_SIZE];
1453 char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
1455 /* Decide between printing all regs, nonfloat regs, or specific reg. */
1458 if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT && !fpregs)
1467 /* If the register name is empty, it is undefined for this
1468 processor, so don't display anything. */
1469 if (REGISTER_NAME (i) == NULL || *(REGISTER_NAME (i)) == '\0')
1472 fputs_filtered (REGISTER_NAME (i), gdb_stdout);
1473 print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), gdb_stdout);
1475 /* Get the data in raw format. */
1476 if (read_relative_register_raw_bytes (i, raw_buffer))
1478 printf_filtered ("*value not available*\n");
1482 /* Convert raw data to virtual format if necessary. */
1483 if (REGISTER_CONVERTIBLE (i))
1485 REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i),
1486 raw_buffer, virtual_buffer);
1490 memcpy (virtual_buffer, raw_buffer,
1491 REGISTER_VIRTUAL_SIZE (i));
1494 /* If virtual format is floating, print it that way, and in raw hex. */
1495 if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
1499 #ifdef INVALID_FLOAT
1500 if (INVALID_FLOAT (virtual_buffer, REGISTER_VIRTUAL_SIZE (i)))
1501 printf_filtered ("<invalid float>");
1504 val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
1505 gdb_stdout, 0, 1, 0, Val_pretty_default);
1507 printf_filtered ("\t(raw 0x");
1508 for (j = 0; j < REGISTER_RAW_SIZE (i); j++)
1510 register int idx = TARGET_BYTE_ORDER == BIG_ENDIAN ? j
1511 : REGISTER_RAW_SIZE (i) - 1 - j;
1512 printf_filtered ("%02x", (unsigned char) raw_buffer[idx]);
1514 printf_filtered (")");
1517 /* FIXME! val_print probably can handle all of these cases now... */
1519 /* Else if virtual format is too long for printf,
1520 print in hex a byte at a time. */
1521 else if (REGISTER_VIRTUAL_SIZE (i) > (int) sizeof (long))
1524 printf_filtered ("0x");
1525 for (j = 0; j < REGISTER_VIRTUAL_SIZE (i); j++)
1526 printf_filtered ("%02x", (unsigned char) virtual_buffer[j]);
1528 /* Else print as integer in hex and in decimal. */
1531 val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
1532 gdb_stdout, 'x', 1, 0, Val_pretty_default);
1533 printf_filtered ("\t");
1534 val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
1535 gdb_stdout, 0, 1, 0, Val_pretty_default);
1538 /* The SPARC wants to print even-numbered float regs as doubles
1539 in addition to printing them as floats. */
1540 #ifdef PRINT_REGISTER_HOOK
1541 PRINT_REGISTER_HOOK (i);
1544 printf_filtered ("\n");
1549 registers_info (char *addr_exp, int fpregs)
1551 int regnum, numregs;
1554 if (!target_has_registers)
1555 error ("The program has no registers now.");
1556 if (selected_frame == NULL)
1557 error ("No selected frame.");
1561 DO_REGISTERS_INFO (-1, fpregs);
1567 if (addr_exp[0] == '$')
1570 while (*end != '\0' && *end != ' ' && *end != '\t')
1572 numregs = ARCH_NUM_REGS;
1574 regnum = target_map_name_to_register (addr_exp, end - addr_exp);
1580 if (*addr_exp >= '0' && *addr_exp <= '9')
1581 regnum = atoi (addr_exp); /* Take a number */
1582 if (regnum >= numregs) /* Bad name, or bad number */
1583 error ("%.*s: invalid register", end - addr_exp, addr_exp);
1586 DO_REGISTERS_INFO (regnum, fpregs);
1589 while (*addr_exp == ' ' || *addr_exp == '\t')
1592 while (*addr_exp != '\0');
1596 all_registers_info (char *addr_exp, int from_tty)
1598 registers_info (addr_exp, 1);
1602 nofp_registers_info (char *addr_exp, int from_tty)
1604 registers_info (addr_exp, 0);
1610 * Should save/restore the tty state since it might be that the
1611 * program to be debugged was started on this tty and it wants
1612 * the tty in some state other than what we want. If it's running
1613 * on another terminal or without a terminal, then saving and
1614 * restoring the tty state is a harmless no-op.
1615 * This only needs to be done if we are attaching to a process.
1620 takes a program started up outside of gdb and ``attaches'' to it.
1621 This stops it cold in its tracks and allows us to start debugging it.
1622 and wait for the trace-trap that results from attaching. */
1625 attach_command (char *args, int from_tty)
1628 extern int auto_solib_add;
1632 char *full_exec_path = NULL;
1634 dont_repeat (); /* Not for the faint of heart */
1636 if (target_has_execution)
1638 if (query ("A program is being debugged already. Kill it? "))
1641 error ("Not killed.");
1644 target_attach (args, from_tty);
1646 /* Set up the "saved terminal modes" of the inferior
1647 based on what modes we are starting it with. */
1648 target_terminal_init ();
1650 /* Install inferior's terminal modes. */
1651 target_terminal_inferior ();
1653 /* Set up execution context to know that we should return from
1654 wait_for_inferior as soon as the target reports a stop. */
1655 init_wait_for_inferior ();
1656 clear_proceed_status ();
1658 /* No traps are generated when attaching to inferior under Mach 3
1660 #ifndef ATTACH_NO_WAIT
1661 stop_soon_quietly = 1;
1662 wait_for_inferior ();
1666 * If no exec file is yet known, try to determine it from the
1669 exec_file = (char *) get_exec_file (0);
1672 exec_file = target_pid_to_exec_file (inferior_pid);
1675 /* It's possible we don't have a full path, but rather just a
1676 filename. Some targets, such as HP-UX, don't provide the
1679 Attempt to qualify the filename against the source path.
1680 (If that fails, we'll just fall back on the original
1681 filename. Not much more we can do...)
1683 if (!source_full_path_of (exec_file, &full_exec_path))
1684 full_exec_path = savestring (exec_file, strlen (exec_file));
1686 exec_file_attach (full_exec_path, from_tty);
1687 symbol_file_command (full_exec_path, from_tty);
1694 /* Add shared library symbols from the newly attached process, if any. */
1695 SOLIB_ADD ((char *) 0, from_tty, ¤t_target);
1696 re_enable_breakpoints_in_shlibs ();
1700 /* Take any necessary post-attaching actions for this platform.
1702 target_post_attach (inferior_pid);
1712 * takes a program previously attached to and detaches it.
1713 * The program resumes execution and will no longer stop
1714 * on signals, etc. We better not have left any breakpoints
1715 * in the program or it'll die when it hits one. For this
1716 * to work, it may be necessary for the process to have been
1717 * previously attached. It *might* work if the program was
1718 * started via the normal ptrace (PTRACE_TRACEME).
1722 detach_command (char *args, int from_tty)
1724 dont_repeat (); /* Not for the faint of heart */
1725 target_detach (args, from_tty);
1726 #if defined(SOLIB_RESTART)
1733 /* Stop the execution of the target while running in async mode, in
1737 interrupt_target_command_wrapper (char *args, int from_tty)
1739 interrupt_target_command (args, from_tty);
1743 interrupt_target_command (char *args, int from_tty)
1745 if (event_loop_p && target_can_async_p ())
1747 dont_repeat (); /* Not for the faint of heart */
1754 float_info (char *addr_exp, int from_tty)
1759 printf_filtered ("No floating point info available for this processor.\n");
1765 unset_command (char *args, int from_tty)
1767 printf_filtered ("\"unset\" must be followed by the name of ");
1768 printf_filtered ("an unset subcommand.\n");
1769 help_list (unsetlist, "unset ", -1, gdb_stdout);
1773 _initialize_infcmd (void)
1775 struct cmd_list_element *c;
1777 add_com ("tty", class_run, tty_command,
1778 "Set terminal for future runs of program being debugged.");
1781 (add_set_cmd ("args", class_run, var_string_noescape,
1782 (char *) &inferior_args,
1783 "Set argument list to give program being debugged when it is started.\n\
1784 Follow this command with any number of args, to be passed to the program.",
1789 ("environment", no_class, environment_info,
1790 "The environment to give the program, or one variable's value.\n\
1791 With an argument VAR, prints the value of environment variable VAR to\n\
1792 give the program being debugged. With no arguments, prints the entire\n\
1793 environment to be given to the program.", &showlist);
1794 c->completer = noop_completer;
1796 add_prefix_cmd ("unset", no_class, unset_command,
1797 "Complement to certain \"set\" commands",
1798 &unsetlist, "unset ", 0, &cmdlist);
1800 c = add_cmd ("environment", class_run, unset_environment_command,
1801 "Cancel environment variable VAR for the program.\n\
1802 This does not affect the program until the next \"run\" command.",
1804 c->completer = noop_completer;
1806 c = add_cmd ("environment", class_run, set_environment_command,
1807 "Set environment variable value to give the program.\n\
1808 Arguments are VAR VALUE where VAR is variable name and VALUE is value.\n\
1809 VALUES of environment variables are uninterpreted strings.\n\
1810 This does not affect the program until the next \"run\" command.",
1812 c->completer = noop_completer;
1814 add_com ("path", class_files, path_command,
1815 "Add directory DIR(s) to beginning of search path for object files.\n\
1816 $cwd in the path means the current working directory.\n\
1817 This path is equivalent to the $PATH shell variable. It is a list of\n\
1818 directories, separated by colons. These directories are searched to find\n\
1819 fully linked executable files and separately compiled object files as needed.");
1821 c = add_cmd ("paths", no_class, path_info,
1822 "Current search path for finding object files.\n\
1823 $cwd in the path means the current working directory.\n\
1824 This path is equivalent to the $PATH shell variable. It is a list of\n\
1825 directories, separated by colons. These directories are searched to find\n\
1826 fully linked executable files and separately compiled object files as needed.",
1828 c->completer = noop_completer;
1830 add_com ("attach", class_run, attach_command,
1831 "Attach to a process or file outside of GDB.\n\
1832 This command attaches to another target, of the same type as your last\n\
1833 \"target\" command (\"info files\" will show your target stack).\n\
1834 The command may take as argument a process id or a device file.\n\
1835 For a process id, you must have permission to send the process a signal,\n\
1836 and it must have the same effective uid as the debugger.\n\
1837 When using \"attach\" with a process id, the debugger finds the\n\
1838 program running in the process, looking first in the current working\n\
1839 directory, or (if not found there) using the source file search path\n\
1840 (see the \"directory\" command). You can also use the \"file\" command\n\
1841 to specify the program, and to load its symbol table.");
1843 add_com ("detach", class_run, detach_command,
1844 "Detach a process or file previously attached.\n\
1845 If a process, it is no longer traced, and it continues its execution. If\n\
1846 you were debugging a file, the file is closed and gdb no longer accesses it.");
1848 add_com ("signal", class_run, signal_command,
1849 "Continue program giving it signal specified by the argument.\n\
1850 An argument of \"0\" means continue program without giving it a signal.");
1852 add_com ("stepi", class_run, stepi_command,
1853 "Step one instruction exactly.\n\
1854 Argument N means do this N times (or till program stops for another reason).");
1855 add_com_alias ("si", "stepi", class_alias, 0);
1857 add_com ("nexti", class_run, nexti_command,
1858 "Step one instruction, but proceed through subroutine calls.\n\
1859 Argument N means do this N times (or till program stops for another reason).");
1860 add_com_alias ("ni", "nexti", class_alias, 0);
1862 add_com ("finish", class_run, finish_command,
1863 "Execute until selected stack frame returns.\n\
1864 Upon return, the value returned is printed and put in the value history.");
1866 add_com ("next", class_run, next_command,
1867 "Step program, proceeding through subroutine calls.\n\
1868 Like the \"step\" command as long as subroutine calls do not happen;\n\
1869 when they do, the call is treated as one instruction.\n\
1870 Argument N means do this N times (or till program stops for another reason).");
1871 add_com_alias ("n", "next", class_run, 1);
1873 add_com_alias ("S", "next", class_run, 1);
1875 add_com ("step", class_run, step_command,
1876 "Step program until it reaches a different source line.\n\
1877 Argument N means do this N times (or till program stops for another reason).");
1878 add_com_alias ("s", "step", class_run, 1);
1880 add_com ("until", class_run, until_command,
1881 "Execute until the program reaches a source line greater than the current\n\
1882 or a specified line or address or function (same args as break command).\n\
1883 Execution will also stop upon exit from the current stack frame.");
1884 add_com_alias ("u", "until", class_run, 1);
1886 add_com ("jump", class_run, jump_command,
1887 "Continue program being debugged at specified line or address.\n\
1888 Give as argument either LINENUM or *ADDR, where ADDR is an expression\n\
1889 for an address to start at.");
1892 add_com ("go", class_run, go_command,
1893 "Usage: go <location>\n\
1894 Continue program being debugged, stopping at specified line or \n\
1896 Give as argument either LINENUM or *ADDR, where ADDR is an \n\
1897 expression for an address to start at.\n\
1898 This command is a combination of tbreak and jump.");
1901 add_com_alias ("g", "go", class_run, 1);
1903 add_com ("continue", class_run, continue_command,
1904 "Continue program being debugged, after signal or breakpoint.\n\
1905 If proceeding from breakpoint, a number N may be used as an argument,\n\
1906 which means to set the ignore count of that breakpoint to N - 1 (so that\n\
1907 the breakpoint won't break until the Nth time it is reached).");
1908 add_com_alias ("c", "cont", class_run, 1);
1909 add_com_alias ("fg", "cont", class_run, 1);
1911 add_com ("run", class_run, run_command,
1912 "Start debugged program. You may specify arguments to give it.\n\
1913 Args may include \"*\", or \"[...]\"; they are expanded using \"sh\".\n\
1914 Input and output redirection with \">\", \"<\", or \">>\" are also allowed.\n\n\
1915 With no arguments, uses arguments last specified (with \"run\" or \"set args\").\n\
1916 To cancel previous arguments and run with no arguments,\n\
1917 use \"set args\" without arguments.");
1918 add_com_alias ("r", "run", class_run, 1);
1920 add_com ("R", class_run, run_no_args_command,
1921 "Start debugged program with no arguments.");
1923 add_com ("interrupt", class_run, interrupt_target_command,
1924 "Interrupt the execution of the debugged program.");
1926 add_info ("registers", nofp_registers_info,
1927 "List of integer registers and their contents, for selected stack frame.\n\
1928 Register name as argument means describe only that register.");
1929 add_info_alias ("r", "registers", 1);
1932 add_com ("lr", class_info, nofp_registers_info,
1933 "List of integer registers and their contents, for selected stack frame.\n\
1934 Register name as argument means describe only that register.");
1935 add_info ("all-registers", all_registers_info,
1936 "List of all registers and their contents, for selected stack frame.\n\
1937 Register name as argument means describe only that register.");
1939 add_info ("program", program_info,
1940 "Execution status of the program.");
1942 add_info ("float", float_info,
1943 "Print the status of the floating point unit\n");
1945 inferior_args = savestring ("", 1); /* Initially no args */
1946 inferior_environ = make_environ ();
1947 init_environ (inferior_environ);