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"
37 #include "event-top.h"
38 #include "parser-defs.h"
40 /* Functions exported for general use: */
42 void nofp_registers_info
PARAMS ((char *, int));
44 void all_registers_info
PARAMS ((char *, int));
46 void registers_info
PARAMS ((char *, int));
48 /* Local functions: */
50 void continue_command
PARAMS ((char *, int));
52 static void print_return_value (int struct_return
, struct type
*value_type
);
54 static void finish_command_continuation
PARAMS ((struct continuation_arg
*));
56 static void until_next_command
PARAMS ((int));
58 static void until_command
PARAMS ((char *, int));
60 static void path_info
PARAMS ((char *, int));
62 static void path_command
PARAMS ((char *, int));
64 static void unset_command
PARAMS ((char *, int));
66 static void float_info
PARAMS ((char *, int));
68 static void detach_command
PARAMS ((char *, int));
70 static void interrupt_target_command (char *args
, int from_tty
);
72 #if !defined (DO_REGISTERS_INFO)
73 static void do_registers_info
PARAMS ((int, int));
76 static void unset_environment_command
PARAMS ((char *, int));
78 static void set_environment_command
PARAMS ((char *, int));
80 static void environment_info
PARAMS ((char *, int));
82 static void program_info
PARAMS ((char *, int));
84 static void finish_command
PARAMS ((char *, int));
86 static void signal_command
PARAMS ((char *, int));
88 static void jump_command
PARAMS ((char *, int));
90 static void step_1
PARAMS ((int, int, char *));
91 static void step_once (int skip_subroutines
, int single_inst
, int count
);
92 static void step_1_continuation (struct continuation_arg
*arg
);
94 void nexti_command
PARAMS ((char *, int));
96 void stepi_command
PARAMS ((char *, int));
98 static void next_command
PARAMS ((char *, int));
100 static void step_command
PARAMS ((char *, int));
102 static void run_command
PARAMS ((char *, int));
104 static void run_no_args_command
PARAMS ((char *args
, int from_tty
));
106 static void go_command
PARAMS ((char *line_no
, int from_tty
));
108 static int strip_bg_char
PARAMS ((char **));
110 void _initialize_infcmd
PARAMS ((void));
112 #define GO_USAGE "Usage: go <location>\n"
114 static void breakpoint_auto_delete_contents
PARAMS ((PTR
));
116 #define ERROR_NO_INFERIOR \
117 if (!target_has_execution) error ("The program is not being run.");
119 /* String containing arguments to give to the program, separated by spaces.
120 Empty string (pointer to '\0') means no args. */
122 static char *inferior_args
;
124 /* File name for default use for standard in/out in the inferior. */
126 char *inferior_io_terminal
;
128 /* Pid of our debugged inferior, or 0 if no inferior now.
129 Since various parts of infrun.c test this to see whether there is a program
130 being debugged it should be nonzero (currently 3 is used) for remote
135 /* Last signal that the inferior received (why it stopped). */
137 enum target_signal stop_signal
;
139 /* Address at which inferior stopped. */
143 /* Chain containing status of breakpoint(s) that we have stopped at. */
147 /* Flag indicating that a command has proceeded the inferior past the
148 current breakpoint. */
150 int breakpoint_proceeded
;
152 /* Nonzero if stopped due to a step command. */
156 /* Nonzero if stopped due to completion of a stack dummy routine. */
158 int stop_stack_dummy
;
160 /* Nonzero if stopped due to a random (unexpected) signal in inferior
163 int stopped_by_random_signal
;
165 /* Range to single step within.
166 If this is nonzero, respond to a single-step signal
167 by continuing to step if the pc is in this range. */
169 CORE_ADDR step_range_start
; /* Inclusive */
170 CORE_ADDR step_range_end
; /* Exclusive */
172 /* Stack frame address as of when stepping command was issued.
173 This is how we know when we step into a subroutine call,
174 and how to set the frame for the breakpoint used to step out. */
176 CORE_ADDR step_frame_address
;
178 /* Our notion of the current stack pointer. */
182 /* 1 means step over all subroutine calls.
183 0 means don't step over calls (used by stepi).
184 -1 means step over calls to undebuggable functions. */
188 /* If stepping, nonzero means step count is > 1
189 so don't print frame next time inferior stops
190 if it stops due to stepping. */
194 /* Environment to use for running inferior,
195 in format described in environ.h. */
197 struct environ
*inferior_environ
;
200 /* This function detects whether or not a '&' character (indicating
201 background execution) has been added as *the last* of the arguments ARGS
202 of a command. If it has, it removes it and returns 1. Otherwise it
203 does nothing and returns 0. */
210 p
= strchr (*args
, '&');
214 if (p
== (*args
+ strlen (*args
) - 1))
216 if (strlen (*args
) > 1)
220 while (*p
== ' ' || *p
== '\t');
233 tty_command (file
, from_tty
)
238 error_no_arg ("terminal name for running target process");
240 inferior_io_terminal
= savestring (file
, strlen (file
));
244 run_command (args
, from_tty
)
252 if (inferior_pid
!= 0 && target_has_execution
)
255 && !query ("The program being debugged has been started already.\n\
256 Start it from the beginning? "))
257 error ("Program not restarted.");
259 #if defined(SOLIB_RESTART)
262 init_wait_for_inferior ();
265 clear_breakpoint_hit_counts ();
267 exec_file
= (char *) get_exec_file (0);
269 /* Purge old solib objfiles. */
270 objfile_purge_solibs ();
272 do_run_cleanups (NULL
);
274 /* The exec file is re-read every time we do a generic_mourn_inferior, so
275 we just have to worry about the symbol file. */
278 /* We keep symbols from add-symbol-file, on the grounds that the
279 user might want to add some symbols before running the program
280 (right?). But sometimes (dynamic loading where the user manually
281 introduces the new symbols with add-symbol-file), the code which
282 the symbols describe does not persist between runs. Currently
283 the user has to manually nuke all symbols between runs if they
284 want them to go away (PR 2207). This is probably reasonable. */
288 if (event_loop_p
&& target_can_async_p ())
289 async_disable_stdin ();
294 int async_exec
= strip_bg_char (&args
);
296 /* If we get a request for running in the bg but the target
297 doesn't support it, error out. */
298 if (event_loop_p
&& async_exec
&& !target_can_async_p ())
299 error ("Asynchronous execution not supported on this target.");
301 /* If we don't get a request of running in the bg, then we need
302 to simulate synchronous (fg) execution. */
303 if (event_loop_p
&& !async_exec
&& target_can_async_p ())
305 /* Simulate synchronous execution */
306 async_disable_stdin ();
309 /* If there were other args, beside '&', process them. */
312 cmd
= concat ("set args ", args
, NULL
);
313 make_cleanup (free
, cmd
);
314 execute_command (cmd
, from_tty
);
320 puts_filtered ("Starting program: ");
322 puts_filtered (exec_file
);
324 puts_filtered (inferior_args
);
325 puts_filtered ("\n");
326 gdb_flush (gdb_stdout
);
329 target_create_inferior (exec_file
, inferior_args
,
330 environ_vector (inferior_environ
));
335 run_no_args_command (args
, from_tty
)
339 execute_command ("set args", from_tty
);
340 run_command ((char *) NULL
, from_tty
);
345 continue_command (proc_count_exp
, from_tty
)
346 char *proc_count_exp
;
352 /* Find out whether we must run in the background. */
353 if (proc_count_exp
!= NULL
)
354 async_exec
= strip_bg_char (&proc_count_exp
);
356 /* If we must run in the background, but the target can't do it,
358 if (event_loop_p
&& async_exec
&& !target_can_async_p ())
359 error ("Asynchronous execution not supported on this target.");
361 /* If we are not asked to run in the bg, then prepare to run in the
362 foreground, synchronously. */
363 if (event_loop_p
&& !async_exec
&& target_can_async_p ())
365 /* Simulate synchronous execution */
366 async_disable_stdin ();
369 /* If have argument (besides '&'), set proceed count of breakpoint
371 if (proc_count_exp
!= NULL
)
373 bpstat bs
= stop_bpstat
;
374 int num
= bpstat_num (&bs
);
375 if (num
== 0 && from_tty
)
378 ("Not stopped at any breakpoint; argument ignored.\n");
382 set_ignore_count (num
,
383 parse_and_eval_address (proc_count_exp
) - 1,
385 /* set_ignore_count prints a message ending with a period.
386 So print two spaces before "Continuing.". */
388 printf_filtered (" ");
389 num
= bpstat_num (&bs
);
394 printf_filtered ("Continuing.\n");
396 clear_proceed_status ();
398 proceed ((CORE_ADDR
) -1, TARGET_SIGNAL_DEFAULT
, 0);
401 /* Step until outside of current statement. */
405 step_command (count_string
, from_tty
)
409 step_1 (0, 0, count_string
);
412 /* Likewise, but skip over subroutine calls as if single instructions. */
416 next_command (count_string
, from_tty
)
420 step_1 (1, 0, count_string
);
423 /* Likewise, but step only one instruction. */
427 stepi_command (count_string
, from_tty
)
431 step_1 (0, 1, count_string
);
436 nexti_command (count_string
, from_tty
)
440 step_1 (1, 1, count_string
);
444 step_1 (skip_subroutines
, single_inst
, count_string
)
445 int skip_subroutines
;
449 register int count
= 1;
450 struct frame_info
*frame
;
451 struct cleanup
*cleanups
= 0;
457 async_exec
= strip_bg_char (&count_string
);
459 /* If we get a request for running in the bg but the target
460 doesn't support it, error out. */
461 if (event_loop_p
&& async_exec
&& !target_can_async_p ())
462 error ("Asynchronous execution not supported on this target.");
464 /* If we don't get a request of running in the bg, then we need
465 to simulate synchronous (fg) execution. */
466 if (event_loop_p
&& !async_exec
&& target_can_async_p ())
468 /* Simulate synchronous execution */
469 async_disable_stdin ();
472 count
= count_string
? parse_and_eval_address (count_string
) : 1;
474 if (!single_inst
|| skip_subroutines
) /* leave si command alone */
476 enable_longjmp_breakpoint ();
477 if (!event_loop_p
|| !target_can_async_p ())
478 cleanups
= make_cleanup ((make_cleanup_func
) disable_longjmp_breakpoint
,
481 make_exec_cleanup ((make_cleanup_func
) disable_longjmp_breakpoint
, 0);
484 /* In synchronous case, all is well, just use the regular for loop. */
485 if (!event_loop_p
|| !target_can_async_p ())
487 for (; count
> 0; count
--)
489 clear_proceed_status ();
491 frame
= get_current_frame ();
492 if (!frame
) /* Avoid coredump here. Why tho? */
493 error ("No current frame");
494 step_frame_address
= FRAME_FP (frame
);
495 step_sp
= read_sp ();
499 find_pc_line_pc_range (stop_pc
, &step_range_start
, &step_range_end
);
500 if (step_range_end
== 0)
503 if (find_pc_partial_function (stop_pc
, &name
, &step_range_start
,
504 &step_range_end
) == 0)
505 error ("Cannot find bounds of current function");
507 target_terminal_ours ();
509 Single stepping until exit from function %s, \n\
510 which has no line number information.\n", name
);
515 /* Say we are stepping, but stop after one insn whatever it does. */
516 step_range_start
= step_range_end
= 1;
517 if (!skip_subroutines
)
519 Don't step over function calls, not even to functions lacking
524 if (skip_subroutines
)
527 step_multi
= (count
> 1);
528 proceed ((CORE_ADDR
) -1, TARGET_SIGNAL_DEFAULT
, 1);
533 /* FIXME: On nexti, this may have already been done (when we hit the
534 step resume break, I think). Probably this should be moved to
535 wait_for_inferior (near the top). */
536 #if defined (SHIFT_INST_REGS)
541 if (!single_inst
|| skip_subroutines
)
542 do_cleanups (cleanups
);
545 /* In case of asynchronous target things get complicated, do only
546 one step for now, before returning control to the event loop. Let
547 the continuation figure out how many other steps we need to do,
548 and handle them one at the time, through step_once(). */
551 if (event_loop_p
&& target_can_async_p ())
552 step_once (skip_subroutines
, single_inst
, count
);
556 /* Called after we are done with one step operation, to check whether
557 we need to step again, before we print the prompt and return control
558 to the user. If count is > 1, we will need to do one more call to
559 proceed(), via step_once(). Basically it is like step_once and
560 step_1_continuation are co-recursive. */
562 step_1_continuation (arg
)
563 struct continuation_arg
*arg
;
566 int skip_subroutines
;
569 skip_subroutines
= (int) arg
->data
;
570 single_inst
= (int) (arg
->next
)->data
;
571 count
= (int) ((arg
->next
)->next
)->data
;
575 /* FIXME: On nexti, this may have already been done (when we hit the
576 step resume break, I think). Probably this should be moved to
577 wait_for_inferior (near the top). */
578 #if defined (SHIFT_INST_REGS)
581 step_once (skip_subroutines
, single_inst
, count
- 1);
584 if (!single_inst
|| skip_subroutines
)
585 do_exec_cleanups (ALL_CLEANUPS
);
588 /* Do just one step operation. If count >1 we will have to set up a
589 continuation to be done after the target stops (after this one
590 step). This is useful to implement the 'step n' kind of commands, in
591 case of asynchronous targets. We had to split step_1 into two parts,
592 one to be done before proceed() and one afterwards. This function is
593 called in case of step n with n>1, after the first step operation has
596 step_once (int skip_subroutines
, int single_inst
, int count
)
598 struct continuation_arg
*arg1
; struct continuation_arg
*arg2
;
599 struct continuation_arg
*arg3
; struct frame_info
*frame
;
603 clear_proceed_status ();
605 frame
= get_current_frame ();
606 if (!frame
) /* Avoid coredump here. Why tho? */
607 error ("No current frame");
608 step_frame_address
= FRAME_FP (frame
);
609 step_sp
= read_sp ();
613 find_pc_line_pc_range (stop_pc
, &step_range_start
, &step_range_end
);
614 if (step_range_end
== 0)
617 if (find_pc_partial_function (stop_pc
, &name
, &step_range_start
,
618 &step_range_end
) == 0)
619 error ("Cannot find bounds of current function");
621 target_terminal_ours ();
623 Single stepping until exit from function %s, \n\
624 which has no line number information.\n", name
);
629 /* Say we are stepping, but stop after one insn whatever it does. */
630 step_range_start
= step_range_end
= 1;
631 if (!skip_subroutines
)
633 Don't step over function calls, not even to functions lacking
638 if (skip_subroutines
)
641 step_multi
= (count
> 1);
643 (struct continuation_arg
*) xmalloc (sizeof (struct continuation_arg
));
645 (struct continuation_arg
*) xmalloc (sizeof (struct continuation_arg
));
647 (struct continuation_arg
*) xmalloc (sizeof (struct continuation_arg
));
649 arg1
->data
= (PTR
) skip_subroutines
;
651 arg2
->data
= (PTR
) single_inst
;
653 arg3
->data
= (PTR
) count
;
654 add_intermediate_continuation (step_1_continuation
, arg1
);
655 proceed ((CORE_ADDR
) -1, TARGET_SIGNAL_DEFAULT
, 1);
660 /* Continue program at specified address. */
663 jump_command (arg
, from_tty
)
667 register CORE_ADDR addr
;
668 struct symtabs_and_lines sals
;
669 struct symtab_and_line sal
;
676 /* Find out whether we must run in the background. */
678 async_exec
= strip_bg_char (&arg
);
680 /* If we must run in the background, but the target can't do it,
682 if (event_loop_p
&& async_exec
&& !target_can_async_p ())
683 error ("Asynchronous execution not supported on this target.");
685 /* If we are not asked to run in the bg, then prepare to run in the
686 foreground, synchronously. */
687 if (event_loop_p
&& !async_exec
&& target_can_async_p ())
689 /* Simulate synchronous execution */
690 async_disable_stdin ();
694 error_no_arg ("starting address");
696 sals
= decode_line_spec_1 (arg
, 1);
699 error ("Unreasonable jump request");
703 free ((PTR
) sals
.sals
);
705 if (sal
.symtab
== 0 && sal
.pc
== 0)
706 error ("No source file has been specified.");
708 resolve_sal_pc (&sal
); /* May error out */
710 /* See if we are trying to jump to another function. */
711 fn
= get_frame_function (get_current_frame ());
712 sfn
= find_pc_function (sal
.pc
);
713 if (fn
!= NULL
&& sfn
!= fn
)
715 if (!query ("Line %d is not in `%s'. Jump anyway? ", sal
.line
,
716 SYMBOL_SOURCE_NAME (fn
)))
718 error ("Not confirmed.");
725 fixup_symbol_section (sfn
, 0);
726 if (section_is_overlay (SYMBOL_BFD_SECTION (sfn
)) &&
727 !section_is_mapped (SYMBOL_BFD_SECTION (sfn
)))
729 if (!query ("WARNING!!! Destination is in unmapped overlay! Jump anyway? "))
731 error ("Not confirmed.");
741 printf_filtered ("Continuing at ");
742 print_address_numeric (addr
, 1, gdb_stdout
);
743 printf_filtered (".\n");
746 clear_proceed_status ();
747 proceed (addr
, TARGET_SIGNAL_0
, 0);
751 /* Go to line or address in current procedure */
753 go_command (line_no
, from_tty
)
757 if (line_no
== (char *) NULL
|| !*line_no
)
758 printf_filtered (GO_USAGE
);
761 tbreak_command (line_no
, from_tty
);
762 jump_command (line_no
, from_tty
);
767 /* Continue program giving it specified signal. */
770 signal_command (signum_exp
, from_tty
)
774 enum target_signal oursig
;
776 dont_repeat (); /* Too dangerous. */
780 error_no_arg ("signal number");
782 /* It would be even slicker to make signal names be valid expressions,
783 (the type could be "enum $signal" or some such), then the user could
784 assign them to convenience variables. */
785 oursig
= target_signal_from_name (signum_exp
);
787 if (oursig
== TARGET_SIGNAL_UNKNOWN
)
789 /* No, try numeric. */
790 int num
= parse_and_eval_address (signum_exp
);
793 oursig
= TARGET_SIGNAL_0
;
795 oursig
= target_signal_from_command (num
);
800 if (oursig
== TARGET_SIGNAL_0
)
801 printf_filtered ("Continuing with no signal.\n");
803 printf_filtered ("Continuing with signal %s.\n",
804 target_signal_to_name (oursig
));
807 clear_proceed_status ();
808 /* "signal 0" should not get stuck if we are stopped at a breakpoint.
809 FIXME: Neither should "signal foo" but when I tried passing
810 (CORE_ADDR)-1 unconditionally I got a testsuite failure which I haven't
811 tried to track down yet. */
812 proceed (oursig
== TARGET_SIGNAL_0
? (CORE_ADDR
) -1 : stop_pc
, oursig
, 0);
815 /* Call breakpoint_auto_delete on the current contents of the bpstat
816 pointed to by arg (which is really a bpstat *). */
819 breakpoint_auto_delete_contents (arg
)
822 breakpoint_auto_delete (*(bpstat
*) arg
);
826 /* Execute a "stack dummy", a piece of code stored in the stack
827 by the debugger to be executed in the inferior.
829 To call: first, do PUSH_DUMMY_FRAME.
830 Then push the contents of the dummy. It should end with a breakpoint insn.
831 Then call here, passing address at which to start the dummy.
833 The contents of all registers are saved before the dummy frame is popped
834 and copied into the buffer BUFFER.
836 The dummy's frame is automatically popped whenever that break is hit.
837 If that is the first time the program stops, run_stack_dummy
838 returns to its caller with that frame already gone and returns 0.
839 Otherwise, run_stack-dummy returns 1 (the frame will eventually be popped
840 when we do hit that breakpoint). */
843 run_stack_dummy (addr
, buffer
)
847 struct cleanup
*old_cleanups
= make_cleanup (null_cleanup
, 0);
849 /* Now proceed, having reached the desired place. */
850 clear_proceed_status ();
852 if (CALL_DUMMY_BREAKPOINT_OFFSET_P
)
854 struct breakpoint
*bpt
;
855 struct symtab_and_line sal
;
857 INIT_SAL (&sal
); /* initialize to zeroes */
858 if (CALL_DUMMY_LOCATION
== AT_ENTRY_POINT
)
860 sal
.pc
= CALL_DUMMY_ADDRESS ();
864 sal
.pc
= addr
- CALL_DUMMY_START_OFFSET
+ CALL_DUMMY_BREAKPOINT_OFFSET
;
866 sal
.section
= find_pc_overlay (sal
.pc
);
868 /* Set up a FRAME for the dummy frame so we can pass it to
869 set_momentary_breakpoint. We need to give the breakpoint a
870 frame in case there is only one copy of the dummy (e.g.
871 CALL_DUMMY_LOCATION == AFTER_TEXT_END). */
872 flush_cached_frames ();
873 set_current_frame (create_new_frame (read_fp (), sal
.pc
));
875 /* If defined, CALL_DUMMY_BREAKPOINT_OFFSET is where we need to put
876 a breakpoint instruction. If not, the call dummy already has the
877 breakpoint instruction in it.
879 addr is the address of the call dummy plus the CALL_DUMMY_START_OFFSET,
880 so we need to subtract the CALL_DUMMY_START_OFFSET. */
881 bpt
= set_momentary_breakpoint (sal
,
882 get_current_frame (),
884 bpt
->disposition
= del
;
886 /* If all error()s out of proceed ended up calling normal_stop (and
887 perhaps they should; it already does in the special case of error
888 out of resume()), then we wouldn't need this. */
889 make_cleanup (breakpoint_auto_delete_contents
, &stop_bpstat
);
892 disable_watchpoints_before_interactive_call_start ();
893 proceed_to_finish
= 1; /* We want stop_registers, please... */
894 proceed (addr
, TARGET_SIGNAL_0
, 0);
895 enable_watchpoints_after_interactive_call_stop ();
897 discard_cleanups (old_cleanups
);
899 if (!stop_stack_dummy
)
902 /* On return, the stack dummy has been popped already. */
904 memcpy (buffer
, stop_registers
, REGISTER_BYTES
);
908 /* Proceed until we reach a different source line with pc greater than
909 our current one or exit the function. We skip calls in both cases.
911 Note that eventually this command should probably be changed so
912 that only source lines are printed out when we hit the breakpoint
913 we set. This may involve changes to wait_for_inferior and the
914 proceed status code. */
918 until_next_command (from_tty
)
921 struct frame_info
*frame
;
924 struct symtab_and_line sal
;
926 clear_proceed_status ();
928 frame
= get_current_frame ();
930 /* Step until either exited from this function or greater
931 than the current line (if in symbolic section) or pc (if
935 func
= find_pc_function (pc
);
939 struct minimal_symbol
*msymbol
= lookup_minimal_symbol_by_pc (pc
);
942 error ("Execution is not within a known function.");
944 step_range_start
= SYMBOL_VALUE_ADDRESS (msymbol
);
949 sal
= find_pc_line (pc
, 0);
951 step_range_start
= BLOCK_START (SYMBOL_BLOCK_VALUE (func
));
952 step_range_end
= sal
.end
;
956 step_frame_address
= FRAME_FP (frame
);
957 step_sp
= read_sp ();
959 step_multi
= 0; /* Only one call to proceed */
961 proceed ((CORE_ADDR
) -1, TARGET_SIGNAL_DEFAULT
, 1);
965 until_command (arg
, from_tty
)
971 if (!target_has_execution
)
972 error ("The program is not running.");
974 /* Find out whether we must run in the background. */
976 async_exec
= strip_bg_char (&arg
);
978 /* If we must run in the background, but the target can't do it,
980 if (event_loop_p
&& async_exec
&& !target_can_async_p ())
981 error ("Asynchronous execution not supported on this target.");
983 /* If we are not asked to run in the bg, then prepare to run in the
984 foreground, synchronously. */
985 if (event_loop_p
&& !async_exec
&& target_can_async_p ())
987 /* Simulate synchronous execution */
988 async_disable_stdin ();
992 until_break_command (arg
, from_tty
);
994 until_next_command (from_tty
);
998 /* Print the result of a function at the end of a 'finish' command. */
1000 print_return_value (int structure_return
, struct type
*value_type
)
1002 register value_ptr value
;
1004 if (!structure_return
)
1006 value
= value_being_returned (value_type
, stop_registers
, structure_return
);
1007 printf_filtered ("Value returned is $%d = ", record_latest_value (value
));
1008 value_print (value
, gdb_stdout
, 0, Val_no_prettyprint
);
1009 printf_filtered ("\n");
1013 /* We cannot determine the contents of the structure because
1014 it is on the stack, and we don't know where, since we did not
1015 initiate the call, as opposed to the call_function_by_hand case */
1016 #ifdef VALUE_RETURNED_FROM_STACK
1018 printf_filtered ("Value returned has type: %s.", TYPE_NAME (value_type
));
1019 printf_filtered (" Cannot determine contents\n");
1021 value
= value_being_returned (value_type
, stop_registers
, structure_return
);
1022 printf_filtered ("Value returned is $%d = ", record_latest_value (value
));
1023 value_print (value
, gdb_stdout
, 0, Val_no_prettyprint
);
1024 printf_filtered ("\n");
1029 /* Stuff that needs to be done by the finish command after the target
1030 has stopped. In asynchronous mode, we wait for the target to stop in
1031 the call to poll or select in the event loop, so it is impossible to
1032 do all the stuff as part of the finish_command function itself. The
1033 only chance we have to complete this command is in
1034 fetch_inferior_event, which is called by the event loop as soon as it
1035 detects that the target has stopped. This function is called via the
1036 cmd_continaution pointer. */
1038 finish_command_continuation (arg
)
1039 struct continuation_arg
*arg
;
1041 register struct symbol
*function
;
1042 struct breakpoint
*breakpoint
;
1044 breakpoint
= (struct breakpoint
*) arg
->data
;
1045 function
= (struct symbol
*) (arg
->next
)->data
;
1047 if (bpstat_find_breakpoint (stop_bpstat
, breakpoint
) != NULL
1050 struct type
*value_type
;
1054 value_type
= TYPE_TARGET_TYPE (SYMBOL_TYPE (function
));
1056 internal_error ("finish_command: function has no target type");
1058 if (TYPE_CODE (value_type
) == TYPE_CODE_VOID
)
1060 do_exec_cleanups (ALL_CLEANUPS
);
1064 funcaddr
= BLOCK_START (SYMBOL_BLOCK_VALUE (function
));
1066 struct_return
= using_struct_return (value_of_variable (function
, NULL
),
1068 check_typedef (value_type
),
1069 BLOCK_GCC_COMPILED (SYMBOL_BLOCK_VALUE (function
)));
1071 print_return_value (struct_return
, value_type
);
1073 do_exec_cleanups (ALL_CLEANUPS
);
1076 /* "finish": Set a temporary breakpoint at the place
1077 the selected frame will return to, then continue. */
1080 finish_command (arg
, from_tty
)
1084 struct symtab_and_line sal
;
1085 register struct frame_info
*frame
;
1086 register struct symbol
*function
;
1087 struct breakpoint
*breakpoint
;
1088 struct cleanup
*old_chain
;
1089 struct continuation_arg
*arg1
, *arg2
;
1093 /* Find out whether we must run in the background. */
1095 async_exec
= strip_bg_char (&arg
);
1097 /* If we must run in the background, but the target can't do it,
1099 if (event_loop_p
&& async_exec
&& !target_can_async_p ())
1100 error ("Asynchronous execution not supported on this target.");
1102 /* If we are not asked to run in the bg, then prepare to run in the
1103 foreground, synchronously. */
1104 if (event_loop_p
&& !async_exec
&& target_can_async_p ())
1106 /* Simulate synchronous execution */
1107 async_disable_stdin ();
1111 error ("The \"finish\" command does not take any arguments.");
1112 if (!target_has_execution
)
1113 error ("The program is not running.");
1114 if (selected_frame
== NULL
)
1115 error ("No selected frame.");
1117 frame
= get_prev_frame (selected_frame
);
1119 error ("\"finish\" not meaningful in the outermost frame.");
1121 clear_proceed_status ();
1123 sal
= find_pc_line (frame
->pc
, 0);
1126 breakpoint
= set_momentary_breakpoint (sal
, frame
, bp_finish
);
1128 if (!event_loop_p
|| !target_can_async_p ())
1129 old_chain
= make_cleanup ((make_cleanup_func
) delete_breakpoint
, breakpoint
);
1131 make_exec_cleanup ((make_cleanup_func
) delete_breakpoint
, breakpoint
);
1133 /* Find the function we will return from. */
1135 function
= find_pc_function (selected_frame
->pc
);
1137 /* Print info on the selected frame, including level number
1141 printf_filtered ("Run till exit from ");
1142 print_stack_frame (selected_frame
, selected_frame_level
, 0);
1145 /* If running asynchronously and the target support asynchronous
1146 execution, set things up for the rest of the finish command to be
1147 completed later on, when gdb has detected that the target has
1148 stopped, in fetch_inferior_event. */
1149 if (event_loop_p
&& target_can_async_p ())
1152 (struct continuation_arg
*) xmalloc (sizeof (struct continuation_arg
));
1154 (struct continuation_arg
*) xmalloc (sizeof (struct continuation_arg
));
1157 arg1
->data
= (PTR
) breakpoint
;
1158 arg2
->data
= (PTR
) function
;
1159 add_continuation (finish_command_continuation
, arg1
);
1162 proceed_to_finish
= 1; /* We want stop_registers, please... */
1163 proceed ((CORE_ADDR
) -1, TARGET_SIGNAL_DEFAULT
, 0);
1165 /* Do this only if not running asynchronously or if the target
1166 cannot do async execution. Otherwise, complete this command when
1167 the target actually stops, in fetch_inferior_event. */
1168 if (!event_loop_p
|| !target_can_async_p ())
1171 /* Did we stop at our breakpoint? */
1172 if (bpstat_find_breakpoint (stop_bpstat
, breakpoint
) != NULL
1175 struct type
*value_type
;
1179 value_type
= TYPE_TARGET_TYPE (SYMBOL_TYPE (function
));
1181 internal_error ("finish_command: function has no target type");
1183 /* FIXME: Shouldn't we do the cleanups before returning? */
1184 if (TYPE_CODE (value_type
) == TYPE_CODE_VOID
)
1187 funcaddr
= BLOCK_START (SYMBOL_BLOCK_VALUE (function
));
1190 using_struct_return (value_of_variable (function
, NULL
),
1192 check_typedef (value_type
),
1193 BLOCK_GCC_COMPILED (SYMBOL_BLOCK_VALUE (function
)));
1195 print_return_value (struct_return
, value_type
);
1197 do_cleanups (old_chain
);
1203 program_info (args
, from_tty
)
1207 bpstat bs
= stop_bpstat
;
1208 int num
= bpstat_num (&bs
);
1210 if (!target_has_execution
)
1212 printf_filtered ("The program being debugged is not being run.\n");
1216 target_files_info ();
1217 printf_filtered ("Program stopped at %s.\n",
1218 local_hex_string ((unsigned long) stop_pc
));
1220 printf_filtered ("It stopped after being stepped.\n");
1223 /* There may be several breakpoints in the same place, so this
1224 isn't as strange as it seems. */
1229 printf_filtered ("It stopped at a breakpoint that has ");
1230 printf_filtered ("since been deleted.\n");
1233 printf_filtered ("It stopped at breakpoint %d.\n", num
);
1234 num
= bpstat_num (&bs
);
1237 else if (stop_signal
!= TARGET_SIGNAL_0
)
1239 printf_filtered ("It stopped with signal %s, %s.\n",
1240 target_signal_to_name (stop_signal
),
1241 target_signal_to_string (stop_signal
));
1246 printf_filtered ("Type \"info stack\" or \"info registers\" ");
1247 printf_filtered ("for more information.\n");
1252 environment_info (var
, from_tty
)
1258 register char *val
= get_in_environ (inferior_environ
, var
);
1261 puts_filtered (var
);
1262 puts_filtered (" = ");
1263 puts_filtered (val
);
1264 puts_filtered ("\n");
1268 puts_filtered ("Environment variable \"");
1269 puts_filtered (var
);
1270 puts_filtered ("\" not defined.\n");
1275 register char **vector
= environ_vector (inferior_environ
);
1278 puts_filtered (*vector
++);
1279 puts_filtered ("\n");
1285 set_environment_command (arg
, from_tty
)
1289 register char *p
, *val
, *var
;
1293 error_no_arg ("environment variable and value");
1295 /* Find seperation between variable name and value */
1296 p
= (char *) strchr (arg
, '=');
1297 val
= (char *) strchr (arg
, ' ');
1299 if (p
!= 0 && val
!= 0)
1301 /* We have both a space and an equals. If the space is before the
1302 equals, walk forward over the spaces til we see a nonspace
1303 (possibly the equals). */
1308 /* Now if the = is after the char following the spaces,
1309 take the char following the spaces. */
1313 else if (val
!= 0 && p
== 0)
1317 error_no_arg ("environment variable to set");
1319 if (p
== 0 || p
[1] == 0)
1323 p
= arg
+ strlen (arg
); /* So that savestring below will work */
1327 /* Not setting variable value to null */
1329 while (*val
== ' ' || *val
== '\t')
1333 while (p
!= arg
&& (p
[-1] == ' ' || p
[-1] == '\t'))
1336 var
= savestring (arg
, p
- arg
);
1339 printf_filtered ("Setting environment variable ");
1340 printf_filtered ("\"%s\" to null value.\n", var
);
1341 set_in_environ (inferior_environ
, var
, "");
1344 set_in_environ (inferior_environ
, var
, val
);
1349 unset_environment_command (var
, from_tty
)
1355 /* If there is no argument, delete all environment variables.
1356 Ask for confirmation if reading from the terminal. */
1357 if (!from_tty
|| query ("Delete all environment variables? "))
1359 free_environ (inferior_environ
);
1360 inferior_environ
= make_environ ();
1364 unset_in_environ (inferior_environ
, var
);
1367 /* Handle the execution path (PATH variable) */
1369 static const char path_var_name
[] = "PATH";
1373 path_info (args
, from_tty
)
1377 puts_filtered ("Executable and object file path: ");
1378 puts_filtered (get_in_environ (inferior_environ
, path_var_name
));
1379 puts_filtered ("\n");
1382 /* Add zero or more directories to the front of the execution path. */
1385 path_command (dirname
, from_tty
)
1392 env
= get_in_environ (inferior_environ
, path_var_name
);
1393 /* Can be null if path is not set */
1396 exec_path
= strsave (env
);
1397 mod_path (dirname
, &exec_path
);
1398 set_in_environ (inferior_environ
, path_var_name
, exec_path
);
1401 path_info ((char *) NULL
, from_tty
);
1405 #ifdef REGISTER_NAMES
1406 char *gdb_register_names
[] = REGISTER_NAMES
;
1408 /* Print out the machine register regnum. If regnum is -1,
1409 print all registers (fpregs == 1) or all non-float registers
1412 For most machines, having all_registers_info() print the
1413 register(s) one per line is good enough. If a different format
1414 is required, (eg, for MIPS or Pyramid 90x, which both have
1415 lots of regs), or there is an existing convention for showing
1416 all the registers, define the macro DO_REGISTERS_INFO(regnum, fp)
1417 to provide that format. */
1419 #if !defined (DO_REGISTERS_INFO)
1421 #define DO_REGISTERS_INFO(regnum, fp) do_registers_info(regnum, fp)
1424 do_registers_info (regnum
, fpregs
)
1429 int numregs
= ARCH_NUM_REGS
;
1431 for (i
= 0; i
< numregs
; i
++)
1433 char raw_buffer
[MAX_REGISTER_RAW_SIZE
];
1434 char virtual_buffer
[MAX_REGISTER_VIRTUAL_SIZE
];
1436 /* Decide between printing all regs, nonfloat regs, or specific reg. */
1439 if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i
)) == TYPE_CODE_FLT
&& !fpregs
)
1448 /* If the register name is empty, it is undefined for this
1449 processor, so don't display anything. */
1450 if (REGISTER_NAME (i
) == NULL
|| *(REGISTER_NAME (i
)) == '\0')
1453 fputs_filtered (REGISTER_NAME (i
), gdb_stdout
);
1454 print_spaces_filtered (15 - strlen (REGISTER_NAME (i
)), gdb_stdout
);
1456 /* Get the data in raw format. */
1457 if (read_relative_register_raw_bytes (i
, raw_buffer
))
1459 printf_filtered ("*value not available*\n");
1463 /* Convert raw data to virtual format if necessary. */
1464 if (REGISTER_CONVERTIBLE (i
))
1466 REGISTER_CONVERT_TO_VIRTUAL (i
, REGISTER_VIRTUAL_TYPE (i
),
1467 raw_buffer
, virtual_buffer
);
1471 memcpy (virtual_buffer
, raw_buffer
,
1472 REGISTER_VIRTUAL_SIZE (i
));
1475 /* If virtual format is floating, print it that way, and in raw hex. */
1476 if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i
)) == TYPE_CODE_FLT
)
1480 #ifdef INVALID_FLOAT
1481 if (INVALID_FLOAT (virtual_buffer
, REGISTER_VIRTUAL_SIZE (i
)))
1482 printf_filtered ("<invalid float>");
1485 val_print (REGISTER_VIRTUAL_TYPE (i
), virtual_buffer
, 0, 0,
1486 gdb_stdout
, 0, 1, 0, Val_pretty_default
);
1488 printf_filtered ("\t(raw 0x");
1489 for (j
= 0; j
< REGISTER_RAW_SIZE (i
); j
++)
1491 register int idx
= TARGET_BYTE_ORDER
== BIG_ENDIAN
? j
1492 : REGISTER_RAW_SIZE (i
) - 1 - j
;
1493 printf_filtered ("%02x", (unsigned char) raw_buffer
[idx
]);
1495 printf_filtered (")");
1498 /* FIXME! val_print probably can handle all of these cases now... */
1500 /* Else if virtual format is too long for printf,
1501 print in hex a byte at a time. */
1502 else if (REGISTER_VIRTUAL_SIZE (i
) > (int) sizeof (long))
1505 printf_filtered ("0x");
1506 for (j
= 0; j
< REGISTER_VIRTUAL_SIZE (i
); j
++)
1507 printf_filtered ("%02x", (unsigned char) virtual_buffer
[j
]);
1509 /* Else print as integer in hex and in decimal. */
1512 val_print (REGISTER_VIRTUAL_TYPE (i
), virtual_buffer
, 0, 0,
1513 gdb_stdout
, 'x', 1, 0, Val_pretty_default
);
1514 printf_filtered ("\t");
1515 val_print (REGISTER_VIRTUAL_TYPE (i
), virtual_buffer
, 0, 0,
1516 gdb_stdout
, 0, 1, 0, Val_pretty_default
);
1519 /* The SPARC wants to print even-numbered float regs as doubles
1520 in addition to printing them as floats. */
1521 #ifdef PRINT_REGISTER_HOOK
1522 PRINT_REGISTER_HOOK (i
);
1525 printf_filtered ("\n");
1528 #endif /* no DO_REGISTERS_INFO. */
1531 registers_info (addr_exp
, fpregs
)
1535 int regnum
, numregs
;
1538 if (!target_has_registers
)
1539 error ("The program has no registers now.");
1540 if (selected_frame
== NULL
)
1541 error ("No selected frame.");
1545 DO_REGISTERS_INFO (-1, fpregs
);
1551 if (addr_exp
[0] == '$')
1554 while (*end
!= '\0' && *end
!= ' ' && *end
!= '\t')
1556 numregs
= ARCH_NUM_REGS
;
1558 regnum
= target_map_name_to_register (addr_exp
, end
- addr_exp
);
1564 if (*addr_exp
>= '0' && *addr_exp
<= '9')
1565 regnum
= atoi (addr_exp
); /* Take a number */
1566 if (regnum
>= numregs
) /* Bad name, or bad number */
1567 error ("%.*s: invalid register", end
- addr_exp
, addr_exp
);
1570 DO_REGISTERS_INFO (regnum
, fpregs
);
1573 while (*addr_exp
== ' ' || *addr_exp
== '\t')
1576 while (*addr_exp
!= '\0');
1580 all_registers_info (addr_exp
, from_tty
)
1584 registers_info (addr_exp
, 1);
1588 nofp_registers_info (addr_exp
, from_tty
)
1592 registers_info (addr_exp
, 0);
1598 * Should save/restore the tty state since it might be that the
1599 * program to be debugged was started on this tty and it wants
1600 * the tty in some state other than what we want. If it's running
1601 * on another terminal or without a terminal, then saving and
1602 * restoring the tty state is a harmless no-op.
1603 * This only needs to be done if we are attaching to a process.
1608 takes a program started up outside of gdb and ``attaches'' to it.
1609 This stops it cold in its tracks and allows us to start debugging it.
1610 and wait for the trace-trap that results from attaching. */
1613 attach_command (args
, from_tty
)
1618 extern int auto_solib_add
;
1622 char *full_exec_path
= NULL
;
1624 dont_repeat (); /* Not for the faint of heart */
1626 if (target_has_execution
)
1628 if (query ("A program is being debugged already. Kill it? "))
1631 error ("Not killed.");
1634 target_attach (args
, from_tty
);
1636 /* Set up the "saved terminal modes" of the inferior
1637 based on what modes we are starting it with. */
1638 target_terminal_init ();
1640 /* Install inferior's terminal modes. */
1641 target_terminal_inferior ();
1643 /* Set up execution context to know that we should return from
1644 wait_for_inferior as soon as the target reports a stop. */
1645 init_wait_for_inferior ();
1646 clear_proceed_status ();
1647 stop_soon_quietly
= 1;
1649 /* No traps are generated when attaching to inferior under Mach 3
1651 #ifndef ATTACH_NO_WAIT
1652 wait_for_inferior ();
1656 * If no exec file is yet known, try to determine it from the
1659 exec_file
= (char *) get_exec_file (0);
1662 exec_file
= target_pid_to_exec_file (inferior_pid
);
1665 /* It's possible we don't have a full path, but rather just a
1666 filename. Some targets, such as HP-UX, don't provide the
1669 Attempt to qualify the filename against the source path.
1670 (If that fails, we'll just fall back on the original
1671 filename. Not much more we can do...)
1673 if (!source_full_path_of (exec_file
, &full_exec_path
))
1674 full_exec_path
= savestring (exec_file
, strlen (exec_file
));
1676 exec_file_attach (full_exec_path
, from_tty
);
1677 symbol_file_command (full_exec_path
, from_tty
);
1684 /* Add shared library symbols from the newly attached process, if any. */
1685 SOLIB_ADD ((char *) 0, from_tty
, ¤t_target
);
1686 re_enable_breakpoints_in_shlibs ();
1690 /* Take any necessary post-attaching actions for this platform.
1692 target_post_attach (inferior_pid
);
1702 * takes a program previously attached to and detaches it.
1703 * The program resumes execution and will no longer stop
1704 * on signals, etc. We better not have left any breakpoints
1705 * in the program or it'll die when it hits one. For this
1706 * to work, it may be necessary for the process to have been
1707 * previously attached. It *might* work if the program was
1708 * started via the normal ptrace (PTRACE_TRACEME).
1712 detach_command (args
, from_tty
)
1716 dont_repeat (); /* Not for the faint of heart */
1717 target_detach (args
, from_tty
);
1718 #if defined(SOLIB_RESTART)
1725 /* Stop the execution of the target while running in async mode, in
1728 interrupt_target_command (args
, from_tty
)
1732 if (event_loop_p
&& target_can_async_p ())
1734 dont_repeat (); /* Not for the faint of heart */
1741 float_info (addr_exp
, from_tty
)
1748 printf_filtered ("No floating point info available for this processor.\n");
1754 unset_command (args
, from_tty
)
1758 printf_filtered ("\"unset\" must be followed by the name of ");
1759 printf_filtered ("an unset subcommand.\n");
1760 help_list (unsetlist
, "unset ", -1, gdb_stdout
);
1764 _initialize_infcmd ()
1766 struct cmd_list_element
*c
;
1768 add_com ("tty", class_run
, tty_command
,
1769 "Set terminal for future runs of program being debugged.");
1772 (add_set_cmd ("args", class_run
, var_string_noescape
,
1773 (char *) &inferior_args
,
1774 "Set argument list to give program being debugged when it is started.\n\
1775 Follow this command with any number of args, to be passed to the program.",
1780 ("environment", no_class
, environment_info
,
1781 "The environment to give the program, or one variable's value.\n\
1782 With an argument VAR, prints the value of environment variable VAR to\n\
1783 give the program being debugged. With no arguments, prints the entire\n\
1784 environment to be given to the program.", &showlist
);
1785 c
->completer
= noop_completer
;
1787 add_prefix_cmd ("unset", no_class
, unset_command
,
1788 "Complement to certain \"set\" commands",
1789 &unsetlist
, "unset ", 0, &cmdlist
);
1791 c
= add_cmd ("environment", class_run
, unset_environment_command
,
1792 "Cancel environment variable VAR for the program.\n\
1793 This does not affect the program until the next \"run\" command.",
1795 c
->completer
= noop_completer
;
1797 c
= add_cmd ("environment", class_run
, set_environment_command
,
1798 "Set environment variable value to give the program.\n\
1799 Arguments are VAR VALUE where VAR is variable name and VALUE is value.\n\
1800 VALUES of environment variables are uninterpreted strings.\n\
1801 This does not affect the program until the next \"run\" command.",
1803 c
->completer
= noop_completer
;
1805 add_com ("path", class_files
, path_command
,
1806 "Add directory DIR(s) to beginning of search path for object files.\n\
1807 $cwd in the path means the current working directory.\n\
1808 This path is equivalent to the $PATH shell variable. It is a list of\n\
1809 directories, separated by colons. These directories are searched to find\n\
1810 fully linked executable files and separately compiled object files as needed.");
1812 c
= add_cmd ("paths", no_class
, path_info
,
1813 "Current search path for finding object files.\n\
1814 $cwd in the path means the current working directory.\n\
1815 This path is equivalent to the $PATH shell variable. It is a list of\n\
1816 directories, separated by colons. These directories are searched to find\n\
1817 fully linked executable files and separately compiled object files as needed.",
1819 c
->completer
= noop_completer
;
1821 add_com ("attach", class_run
, attach_command
,
1822 "Attach to a process or file outside of GDB.\n\
1823 This command attaches to another target, of the same type as your last\n\
1824 \"target\" command (\"info files\" will show your target stack).\n\
1825 The command may take as argument a process id or a device file.\n\
1826 For a process id, you must have permission to send the process a signal,\n\
1827 and it must have the same effective uid as the debugger.\n\
1828 When using \"attach\" with a process id, the debugger finds the\n\
1829 program running in the process, looking first in the current working\n\
1830 directory, or (if not found there) using the source file search path\n\
1831 (see the \"directory\" command). You can also use the \"file\" command\n\
1832 to specify the program, and to load its symbol table.");
1834 add_com ("detach", class_run
, detach_command
,
1835 "Detach a process or file previously attached.\n\
1836 If a process, it is no longer traced, and it continues its execution. If\n\
1837 you were debugging a file, the file is closed and gdb no longer accesses it.");
1839 add_com ("signal", class_run
, signal_command
,
1840 "Continue program giving it signal specified by the argument.\n\
1841 An argument of \"0\" means continue program without giving it a signal.");
1843 add_com ("stepi", class_run
, stepi_command
,
1844 "Step one instruction exactly.\n\
1845 Argument N means do this N times (or till program stops for another reason).");
1846 add_com_alias ("si", "stepi", class_alias
, 0);
1848 add_com ("nexti", class_run
, nexti_command
,
1849 "Step one instruction, but proceed through subroutine calls.\n\
1850 Argument N means do this N times (or till program stops for another reason).");
1851 add_com_alias ("ni", "nexti", class_alias
, 0);
1853 add_com ("finish", class_run
, finish_command
,
1854 "Execute until selected stack frame returns.\n\
1855 Upon return, the value returned is printed and put in the value history.");
1857 add_com ("next", class_run
, next_command
,
1858 "Step program, proceeding through subroutine calls.\n\
1859 Like the \"step\" command as long as subroutine calls do not happen;\n\
1860 when they do, the call is treated as one instruction.\n\
1861 Argument N means do this N times (or till program stops for another reason).");
1862 add_com_alias ("n", "next", class_run
, 1);
1864 add_com_alias ("S", "next", class_run
, 1);
1866 add_com ("step", class_run
, step_command
,
1867 "Step program until it reaches a different source line.\n\
1868 Argument N means do this N times (or till program stops for another reason).");
1869 add_com_alias ("s", "step", class_run
, 1);
1871 add_com ("until", class_run
, until_command
,
1872 "Execute until the program reaches a source line greater than the current\n\
1873 or a specified line or address or function (same args as break command).\n\
1874 Execution will also stop upon exit from the current stack frame.");
1875 add_com_alias ("u", "until", class_run
, 1);
1877 add_com ("jump", class_run
, jump_command
,
1878 "Continue program being debugged at specified line or address.\n\
1879 Give as argument either LINENUM or *ADDR, where ADDR is an expression\n\
1880 for an address to start at.");
1883 add_com ("go", class_run
, go_command
,
1884 "Usage: go <location>\n\
1885 Continue program being debugged, stopping at specified line or \n\
1887 Give as argument either LINENUM or *ADDR, where ADDR is an \n\
1888 expression for an address to start at.\n\
1889 This command is a combination of tbreak and jump.");
1892 add_com_alias ("g", "go", class_run
, 1);
1894 add_com ("continue", class_run
, continue_command
,
1895 "Continue program being debugged, after signal or breakpoint.\n\
1896 If proceeding from breakpoint, a number N may be used as an argument,\n\
1897 which means to set the ignore count of that breakpoint to N - 1 (so that\n\
1898 the breakpoint won't break until the Nth time it is reached).");
1899 add_com_alias ("c", "cont", class_run
, 1);
1900 add_com_alias ("fg", "cont", class_run
, 1);
1902 add_com ("run", class_run
, run_command
,
1903 "Start debugged program. You may specify arguments to give it.\n\
1904 Args may include \"*\", or \"[...]\"; they are expanded using \"sh\".\n\
1905 Input and output redirection with \">\", \"<\", or \">>\" are also allowed.\n\n\
1906 With no arguments, uses arguments last specified (with \"run\" or \"set args\").\n\
1907 To cancel previous arguments and run with no arguments,\n\
1908 use \"set args\" without arguments.");
1909 add_com_alias ("r", "run", class_run
, 1);
1911 add_com ("R", class_run
, run_no_args_command
,
1912 "Start debugged program with no arguments.");
1914 add_com ("interrupt", class_run
, interrupt_target_command
,
1915 "Interrupt the execution of the debugged program.");
1917 add_info ("registers", nofp_registers_info
,
1918 "List of integer registers and their contents, for selected stack frame.\n\
1919 Register name as argument means describe only that register.");
1922 add_com ("lr", class_info
, nofp_registers_info
,
1923 "List of integer registers and their contents, for selected stack frame.\n\
1924 Register name as argument means describe only that register.");
1925 add_info ("all-registers", all_registers_info
,
1926 "List of all registers and their contents, for selected stack frame.\n\
1927 Register name as argument means describe only that register.");
1929 add_info ("program", program_info
,
1930 "Execution status of the program.");
1932 add_info ("float", float_info
,
1933 "Print the status of the floating point unit\n");
1935 inferior_args
= savestring ("", 1); /* Initially no args */
1936 inferior_environ
= make_environ ();
1937 init_environ (inferior_environ
);