1 /* Memory-access and commands for inferior process, for GDB.
2 Copyright (C) 1986, 1987, 1988, 1989 Free Software Foundation, Inc.
4 This file is part of GDB.
6 GDB is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 1, or (at your option)
11 GDB is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GDB; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
22 #include <sys/param.h>
35 extern char *sys_siglist
[];
37 extern void until_break_command (); /* breakpoint.c */
39 #define ERROR_NO_INFERIOR \
40 if (!target_has_execution) error ("The program is not being run.");
42 /* String containing arguments to give to the program, separated by spaces.
43 Empty string (pointer to '\0') means no args. */
45 static char *inferior_args
;
47 /* File name for default use for standard in/out in the inferior. */
49 char *inferior_io_terminal
;
51 /* Pid of our debugged inferior, or 0 if no inferior now.
52 Since various parts of infrun.c test this to see whether there is a program
53 being debugged it should be nonzero (currently 3 is used) for remote
58 /* Last signal that the inferior received (why it stopped). */
62 /* Address at which inferior stopped. */
66 /* Stack frame when program stopped. */
68 FRAME_ADDR stop_frame_address
;
70 /* Chain containing status of breakpoint(s) that we have stopped at. */
74 /* Flag indicating that a command has proceeded the inferior past the
75 current breakpoint. */
77 int breakpoint_proceeded
;
79 /* Nonzero if stopped due to a step command. */
83 /* Nonzero if stopped due to completion of a stack dummy routine. */
87 /* Nonzero if stopped due to a random (unexpected) signal in inferior
90 int stopped_by_random_signal
;
92 /* Range to single step within.
93 If this is nonzero, respond to a single-step signal
94 by continuing to step if the pc is in this range. */
96 CORE_ADDR step_range_start
; /* Inclusive */
97 CORE_ADDR step_range_end
; /* Exclusive */
99 /* Stack frame address as of when stepping command was issued.
100 This is how we know when we step into a subroutine call,
101 and how to set the frame for the breakpoint used to step out. */
103 FRAME_ADDR step_frame_address
;
105 /* 1 means step over all subroutine calls.
106 -1 means step over calls to undebuggable functions. */
110 /* If stepping, nonzero means step count is > 1
111 so don't print frame next time inferior stops
112 if it stops due to stepping. */
116 /* Environment to use for running inferior,
117 in format described in environ.h. */
119 struct environ
*inferior_environ
;
121 CORE_ADDR
read_pc ();
122 void breakpoint_clear_ignore_counts ();
126 tty_command (file
, from_tty
)
131 error_no_arg ("terminal name for running target process");
133 inferior_io_terminal
= savestring (file
, strlen (file
));
137 run_command (args
, from_tty
)
148 !query ("The program being debugged has been started already.\n\
149 Start it from the beginning? "))
150 error ("Program not restarted.");
151 target_kill ((char *)0, 0);
154 exec_file
= (char *) get_exec_file (0);
156 /* The exec file is re-read every time we do an inferior_died, so
157 we just have to worry about the symbol file. */
163 cmd
= concat ("set args ", args
, "");
164 make_cleanup (free
, cmd
);
165 execute_command (cmd
, from_tty
);
170 printf ("Starting program: %s %s\n",
171 exec_file
? exec_file
: "", inferior_args
);
175 target_create_inferior (exec_file
, inferior_args
,
176 environ_vector (inferior_environ
));
180 continue_command (proc_count_exp
, from_tty
)
181 char *proc_count_exp
;
186 /* If have argument, set proceed count of breakpoint we stopped at. */
188 if (proc_count_exp
!= NULL
)
190 bpstat bs
= stop_bpstat
;
191 int num
= bpstat_num (&bs
);
192 if (num
== 0 && from_tty
)
195 ("Not stopped at any breakpoint; argument ignored.\n");
199 set_ignore_count (num
,
200 parse_and_eval_address (proc_count_exp
) - 1,
202 /* set_ignore_count prints a message ending with a period.
203 So print two spaces before "Continuing.". */
206 num
= bpstat_num (&bs
);
211 printf ("Continuing.\n");
213 clear_proceed_status ();
215 proceed ((CORE_ADDR
) -1, -1, 0);
218 /* Step until outside of current statement. */
219 static void step_1 ();
222 step_command (count_string
, from_tty
)
226 step_1 (0, 0, count_string
);
229 /* Likewise, but skip over subroutine calls as if single instructions. */
232 next_command (count_string
, from_tty
)
236 step_1 (1, 0, count_string
);
239 /* Likewise, but step only one instruction. */
242 stepi_command (count_string
, from_tty
)
246 step_1 (0, 1, count_string
);
250 nexti_command (count_string
, from_tty
)
254 step_1 (1, 1, count_string
);
258 step_1 (skip_subroutines
, single_inst
, count_string
)
259 int skip_subroutines
;
263 register int count
= 1;
267 count
= count_string
? parse_and_eval_address (count_string
) : 1;
269 for (; count
> 0; count
--)
271 clear_proceed_status ();
274 fr
= get_current_frame ();
275 if (!fr
) /* Avoid coredump here. Why tho? */
276 error ("No current frame");
277 step_frame_address
= FRAME_FP (fr
);
281 find_pc_line_pc_range (stop_pc
, &step_range_start
, &step_range_end
);
282 if (step_range_end
== 0)
286 misc
= find_pc_misc_function (stop_pc
);
287 target_terminal_ours ();
288 printf ("Current function has no line number information.\n");
291 /* No info or after _etext ("Can't happen") */
292 if (misc
== -1 || misc
== misc_function_count
- 1)
293 error ("No data available on pc function.");
295 printf ("Single stepping until function exit.\n");
298 step_range_start
= misc_function_vector
[misc
].address
;
299 step_range_end
= misc_function_vector
[misc
+ 1].address
;
304 /* Say we are stepping, but stop after one insn whatever it does.
305 Don't step through subroutine calls even to undebuggable
307 step_range_start
= step_range_end
= 1;
308 if (!skip_subroutines
)
312 if (skip_subroutines
)
315 step_multi
= (count
> 1);
316 proceed ((CORE_ADDR
) -1, -1, 1);
319 #if defined (SHIFT_INST_REGS)
320 write_register (NNPC_REGNUM
, read_register (NPC_REGNUM
));
321 write_register (NPC_REGNUM
, read_register (PC_REGNUM
));
326 /* Continue program at specified address. */
329 jump_command (arg
, from_tty
)
333 register CORE_ADDR addr
;
334 struct symtabs_and_lines sals
;
335 struct symtab_and_line sal
;
340 error_no_arg ("starting address");
342 sals
= decode_line_spec_1 (arg
, 1);
345 error ("Unreasonable jump request");
351 if (sal
.symtab
== 0 && sal
.pc
== 0)
352 error ("No source file has been specified.");
355 sal
.pc
= find_line_pc (sal
.symtab
, sal
.line
);
358 struct symbol
*fn
= get_frame_function (get_current_frame ());
359 struct symbol
*sfn
= find_pc_function (sal
.pc
);
360 if (fn
!= 0 && sfn
!= fn
361 && ! query ("Line %d is not in `%s'. Jump anyway? ",
362 sal
.line
, SYMBOL_NAME (fn
)))
363 error ("Not confirmed.");
367 error ("No line %d in file \"%s\".", sal
.line
, sal
.symtab
->filename
);
369 addr
= ADDR_BITS_SET (sal
.pc
);
372 printf ("Continuing at 0x%x.\n", addr
);
374 clear_proceed_status ();
375 proceed (addr
, 0, 0);
378 /* Continue program giving it specified signal. */
381 signal_command (signum_exp
, from_tty
)
387 dont_repeat (); /* Too dangerous. */
391 error_no_arg ("signal number");
393 signum
= parse_and_eval_address (signum_exp
);
396 printf ("Continuing with signal %d.\n", signum
);
398 clear_proceed_status ();
399 proceed (stop_pc
, signum
, 0);
402 /* Execute a "stack dummy", a piece of code stored in the stack
403 by the debugger to be executed in the inferior.
405 To call: first, do PUSH_DUMMY_FRAME.
406 Then push the contents of the dummy. It should end with a breakpoint insn.
407 Then call here, passing address at which to start the dummy.
409 The contents of all registers are saved before the dummy frame is popped
410 and copied into the buffer BUFFER.
412 The dummy's frame is automatically popped whenever that break is hit.
413 If that is the first time the program stops, run_stack_dummy
414 returns to its caller with that frame already gone.
415 Otherwise, the caller never gets returned to. */
417 /* 4 => return instead of letting the stack dummy run. */
419 static int stack_dummy_testing
= 0;
422 run_stack_dummy (addr
, buffer
)
424 char buffer
[REGISTER_BYTES
];
426 /* Now proceed, having reached the desired place. */
427 clear_proceed_status ();
428 if (stack_dummy_testing
& 4)
433 proceed_to_finish
= 1; /* We want stop_registers, please... */
434 proceed (addr
, 0, 0);
436 if (!stop_stack_dummy
)
438 "Cannot continue previously requested operation". */
440 The program being debugged stopped while in a function called from GDB.\n\
441 The expression which contained the function call has been discarded.");
443 /* On return, the stack dummy has been popped already. */
445 bcopy (stop_registers
, buffer
, sizeof stop_registers
);
448 /* Proceed until we reach a different source line with pc greater than
449 our current one or exit the function. We skip calls in both cases.
451 Note that eventually this command should probably be changed so
452 that only source lines are printed out when we hit the breakpoint
453 we set. I'm going to postpone this until after a hopeful rewrite
454 of wait_for_inferior and the proceed status code. -- randy */
457 until_next_command (from_tty
)
463 struct symtab_and_line sal
;
465 clear_proceed_status ();
467 frame
= get_current_frame ();
469 /* Step until either exited from this function or greater
470 than the current line (if in symbolic section) or pc (if
474 func
= find_pc_function (pc
);
478 int misc_func
= find_pc_misc_function (pc
);
481 error ("Execution is not within a known function.");
483 step_range_start
= misc_function_vector
[misc_func
].address
;
488 sal
= find_pc_line (pc
, 0);
490 step_range_start
= BLOCK_START (SYMBOL_BLOCK_VALUE (func
));
491 step_range_end
= sal
.end
;
495 step_frame_address
= FRAME_FP (frame
);
497 step_multi
= 0; /* Only one call to proceed */
499 proceed ((CORE_ADDR
) -1, -1, 1);
503 until_command (arg
, from_tty
)
507 if (!target_has_execution
)
508 error ("The program is not running.");
510 until_break_command (arg
, from_tty
);
512 until_next_command (from_tty
);
515 /* "finish": Set a temporary breakpoint at the place
516 the selected frame will return to, then continue. */
519 finish_command (arg
, from_tty
)
523 struct symtab_and_line sal
;
524 register FRAME frame
;
525 struct frame_info
*fi
;
526 register struct symbol
*function
;
529 error ("The \"finish\" command does not take any arguments.");
530 if (!target_has_execution
)
531 error ("The program is not running.");
532 if (selected_frame
== NULL
)
533 error ("No selected frame.");
535 frame
= get_prev_frame (selected_frame
);
537 error ("\"finish\" not meaningful in the outermost frame.");
539 clear_proceed_status ();
541 fi
= get_frame_info (frame
);
542 sal
= find_pc_line (fi
->pc
, 0);
544 set_momentary_breakpoint (sal
, frame
);
546 /* Find the function we will return from. */
548 fi
= get_frame_info (selected_frame
);
549 function
= find_pc_function (fi
->pc
);
553 printf ("Run till exit from ");
554 print_selected_frame ();
557 proceed_to_finish
= 1; /* We want stop_registers, please... */
558 proceed ((CORE_ADDR
) -1, -1, 0);
560 if (bpstat_momentary_breakpoint (stop_bpstat
) && function
!= 0)
562 struct type
*value_type
;
566 value_type
= TYPE_TARGET_TYPE (SYMBOL_TYPE (function
));
568 fatal ("internal: finish_command: function has no target type");
570 if (TYPE_CODE (value_type
) == TYPE_CODE_VOID
)
573 funcaddr
= BLOCK_START (SYMBOL_BLOCK_VALUE (function
));
575 val
= value_being_returned (value_type
, stop_registers
,
576 using_struct_return (value_of_variable (function
),
579 BLOCK_GCC_COMPILED (SYMBOL_BLOCK_VALUE (function
))));
581 printf ("Value returned is $%d = ", record_latest_value (val
));
582 value_print (val
, stdout
, 0, Val_no_prettyprint
);
588 program_info (args
, from_tty
)
592 bpstat bs
= stop_bpstat
;
593 int num
= bpstat_num (&bs
);
595 if (!target_has_execution
)
597 printf ("The program being debugged is not being run.\n");
601 target_files_info ();
602 printf ("Program stopped at 0x%x.\n", stop_pc
);
604 printf ("It stopped after being stepped.\n");
607 /* There may be several breakpoints in the same place, so this
608 isn't as strange as it seems. */
612 printf ("It stopped at a breakpoint that has since been deleted.\n");
614 printf ("It stopped at breakpoint %d.\n", num
);
615 num
= bpstat_num (&bs
);
618 else if (stop_signal
) {
619 #ifdef PRINT_RANDOM_SIGNAL
620 PRINT_RANDOM_SIGNAL (stop_signal
);
622 printf ("It stopped with signal %d (%s).\n",
624 (stop_signal
> NSIG
)? "unknown": sys_siglist
[stop_signal
]);
629 printf ("Type \"info stack\" or \"info registers\" for more information.\n");
633 environment_info (var
)
638 register char *val
= get_in_environ (inferior_environ
, var
);
640 printf ("%s = %s\n", var
, val
);
642 printf ("Environment variable \"%s\" not defined.\n", var
);
646 register char **vector
= environ_vector (inferior_environ
);
648 printf ("%s\n", *vector
++);
653 set_environment_command (arg
)
656 register char *p
, *val
, *var
;
660 error_no_arg ("environment variable and value");
662 /* Find seperation between variable name and value */
663 p
= (char *) strchr (arg
, '=');
664 val
= (char *) strchr (arg
, ' ');
666 if (p
!= 0 && val
!= 0)
668 /* We have both a space and an equals. If the space is before the
669 equals and the only thing between the two is more space, use
675 /* Take the smaller of the two. If there was space before the
676 "=", they will be the same right now. */
677 p
= arg
+ min (p
- arg
, val
- arg
);
679 else if (val
!= 0 && p
== 0)
683 error_no_arg ("environment variable to set");
685 if (p
== 0 || p
[1] == 0)
689 p
= arg
+ strlen (arg
); /* So that savestring below will work */
693 /* Not setting variable value to null */
695 while (*val
== ' ' || *val
== '\t')
699 while (p
!= arg
&& (p
[-1] == ' ' || p
[-1] == '\t')) p
--;
701 var
= savestring (arg
, p
- arg
);
704 printf ("Setting environment variable \"%s\" to null value.\n", var
);
705 set_in_environ (inferior_environ
, var
, "");
708 set_in_environ (inferior_environ
, var
, val
);
713 unset_environment_command (var
, from_tty
)
719 /* If there is no argument, delete all environment variables.
720 Ask for confirmation if reading from the terminal. */
721 if (!from_tty
|| query ("Delete all environment variables? "))
723 free_environ (inferior_environ
);
724 inferior_environ
= make_environ ();
728 unset_in_environ (inferior_environ
, var
);
731 /* Handle the execution path (PATH variable) */
733 const static char path_var_name
[] = "PATH";
736 path_info (args
, from_tty
)
740 printf ("Executable and object file path: %s\n",
741 get_in_environ (inferior_environ
, path_var_name
));
744 /* Add zero or more directories to the front of the execution path. */
747 path_command (dirname
, from_tty
)
754 exec_path
= strsave (get_in_environ (inferior_environ
, path_var_name
));
755 mod_path (dirname
, from_tty
, &exec_path
);
756 set_in_environ (inferior_environ
, path_var_name
, exec_path
);
765 return ADDR_BITS_REMOVE ((CORE_ADDR
) read_register (PC_REGNUM
));
772 write_register (PC_REGNUM
, (long) val
);
774 write_register (NPC_REGNUM
, (long) val
+4);
779 char *reg_names
[] = REGISTER_NAMES
;
781 /* Print out the machine register regnum. If regnum is -1,
783 For most machines, having all_registers_info() print the
784 register(s) one per line is good enough. If a different format
785 is required, (eg, for SPARC or Pyramid 90x, which both have
786 lots of regs), or there is an existing convention for showing
787 all the registers, define the macro DO_REGISTERS_INFO(regnum)
788 to provide that format. */
789 #if !defined (DO_REGISTERS_INFO)
790 #define DO_REGISTERS_INFO(regnum) do_registers_info(regnum)
791 static void do_registers_info (regnum
)
798 "Register Contents (relative to selected stack frame)\n\n");
800 for (i
= 0; i
< NUM_REGS
; i
++)
802 char raw_buffer
[MAX_REGISTER_RAW_SIZE
];
803 char virtual_buffer
[MAX_REGISTER_VIRTUAL_SIZE
];
805 if (regnum
!= -1 && i
!= regnum
)
808 fputs_filtered (reg_names
[i
], stdout
);
809 print_spaces_filtered (15 - strlen (reg_names
[i
]), stdout
);
811 /* Get the data in raw format, then convert also to virtual format. */
812 if (read_relative_register_raw_bytes (i
, raw_buffer
))
814 printf_filtered ("Invalid register contents\n");
818 target_convert_to_virtual (i
, raw_buffer
, virtual_buffer
);
820 /* If virtual format is floating, print it that way, and in raw hex. */
821 if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i
)) == TYPE_CODE_FLT
822 && ! INVALID_FLOAT (virtual_buffer
, REGISTER_VIRTUAL_SIZE (i
)))
826 val_print (REGISTER_VIRTUAL_TYPE (i
), virtual_buffer
, 0,
827 stdout
, 0, 1, 0, Val_pretty_default
);
829 printf_filtered ("\t(raw 0x");
830 for (j
= 0; j
< REGISTER_RAW_SIZE (i
); j
++)
831 printf_filtered ("%02x", (unsigned char)raw_buffer
[j
]);
832 printf_filtered (")");
835 /* FIXME! val_print probably can handle all of these cases now... */
837 /* Else if virtual format is too long for printf,
838 print in hex a byte at a time. */
839 else if (REGISTER_VIRTUAL_SIZE (i
) > sizeof (long))
842 printf_filtered ("0x");
843 for (j
= 0; j
< REGISTER_VIRTUAL_SIZE (i
); j
++)
844 printf_filtered ("%02x", (unsigned char)virtual_buffer
[j
]);
846 /* Else print as integer in hex and in decimal. */
849 val_print (REGISTER_VIRTUAL_TYPE (i
), raw_buffer
, 0,
850 stdout
, 'x', 1, 0, Val_pretty_default
);
851 printf_filtered ("\t");
852 val_print (REGISTER_VIRTUAL_TYPE (i
), raw_buffer
, 0,
853 stdout
, 0, 1, 0, Val_pretty_default
);
856 /* The SPARC wants to print even-numbered float regs as doubles
857 in addition to printing them as floats. */
858 #ifdef PRINT_REGISTER_HOOK
859 PRINT_REGISTER_HOOK (i
);
862 printf_filtered ("\n");
865 #endif /* no DO_REGISTERS_INFO. */
868 registers_info (addr_exp
)
873 if (!target_has_registers
)
874 error ("The program has no registers now.");
878 if (*addr_exp
>= '0' && *addr_exp
<= '9')
879 regnum
= atoi (addr_exp
);
882 register char *p
= addr_exp
;
885 for (regnum
= 0; regnum
< NUM_REGS
; regnum
++)
886 if (!strcmp (p
, reg_names
[regnum
]))
888 if (regnum
== NUM_REGS
)
889 error ("%s: invalid register name.", addr_exp
);
895 DO_REGISTERS_INFO(regnum
);
900 * Should save/restore the tty state since it might be that the
901 * program to be debugged was started on this tty and it wants
902 * the tty in some state other than what we want. If it's running
903 * on another terminal or without a terminal, then saving and
904 * restoring the tty state is a harmless no-op.
905 * This only needs to be done if we are attaching to a process.
910 * takes a program started up outside of gdb and ``attaches'' to it.
911 * This stops it cold in its tracks and allows us to start tracing it.
912 * For this to work, we must be able to send the process a
913 * signal and we must have the same effective uid as the program.
916 attach_command (args
, from_tty
)
920 dont_repeat (); /* Not for the faint of heart */
921 target_attach (args
, from_tty
);
926 * takes a program previously attached to and detaches it.
927 * The program resumes execution and will no longer stop
928 * on signals, etc. We better not have left any breakpoints
929 * in the program or it'll die when it hits one. For this
930 * to work, it may be necessary for the process to have been
931 * previously attached. It *might* work if the program was
932 * started via the normal ptrace (PTRACE_TRACEME).
936 detach_command (args
, from_tty
)
940 dont_repeat (); /* Not for the faint of heart */
941 target_detach (args
, from_tty
);
946 float_info (addr_exp
)
952 printf ("No floating point info available for this processor.\n");
956 struct cmd_list_element
*unsetlist
= NULL
;
960 unset_command (args
, from_tty
)
964 printf ("\"unset\" must be followed by the name of an unset subcommand.\n");
965 help_list (unsetlist
, "unset ", -1, stdout
);
969 _initialize_infcmd ()
971 struct cmd_list_element
*c
;
973 add_com ("tty", class_run
, tty_command
,
974 "Set terminal for future runs of program being debugged.");
977 (add_set_cmd ("args", class_run
, var_string_noescape
, (char *)&inferior_args
,
979 "Set arguments to give program being debugged when it is started.\n\
980 Follow this command with any number of args, to be passed to the program.",
985 ("environment", no_class
, environment_info
,
986 "The environment to give the program, or one variable's value.\n\
987 With an argument VAR, prints the value of environment variable VAR to\n\
988 give the program being debugged. With no arguments, prints the entire\n\
989 environment to be given to the program.", &showlist
);
990 c
->completer
= noop_completer
;
992 add_prefix_cmd ("unset", no_class
, unset_command
,
993 "Complement to certain \"set\" commands",
994 &unsetlist
, "unset ", 0, &cmdlist
);
996 c
= add_cmd ("environment", class_run
, unset_environment_command
,
997 "Cancel environment variable VAR for the program.\n\
998 This does not affect the program until the next \"run\" command.",
1000 c
->completer
= noop_completer
;
1002 c
= add_cmd ("environment", class_run
, set_environment_command
,
1003 "Set environment variable value to give the program.\n\
1004 Arguments are VAR VALUE where VAR is variable name and VALUE is value.\n\
1005 VALUES of environment variables are uninterpreted strings.\n\
1006 This does not affect the program until the next \"run\" command.",
1008 c
->completer
= noop_completer
;
1010 add_com ("path", class_files
, path_command
,
1011 "Add directory DIR(s) to beginning of search path for object files.\n\
1012 $cwd in the path means the current working directory.\n\
1013 This path is equivalent to the $PATH shell variable. It is a list of\n\
1014 directories, separated by colons. These directories are searched to find\n\
1015 fully linked executable files and separately compiled object files as needed.");
1017 add_info ("path", path_info
,
1018 "Current search path for finding object files.\n\
1019 $cwd in the path means the current working directory.\n\
1020 This path is equivalent to the $PATH shell variable. It is a list of\n\
1021 directories, separated by colons. These directories are searched to find\n\
1022 fully linked executable files and separately compiled object files as needed.");
1024 add_com ("attach", class_run
, attach_command
,
1025 "Attach to a process or file outside of GDB.\n\
1026 This command attaches to another target, of the same type as your last\n\
1027 `target' command (`info files' will show your target stack).\n\
1028 The command may take as argument a process id or a device file.\n\
1029 For a process id, you must have permission to send the process a signal,\n\
1030 and it must have the same effective uid as the debugger.\n\
1031 When using \"attach\", you should use the \"file\" command to specify\n\
1032 the program running in the process, and to load its symbol table.");
1034 add_com ("detach", class_run
, detach_command
,
1035 "Detach a process or file previously attached.\n\
1036 If a process, it is no longer traced, and it continues its execution. If you\n\
1037 were debugging a file, the file is closed and gdb no longer accesses it.");
1039 add_com ("signal", class_run
, signal_command
,
1040 "Continue program giving it signal number SIGNUMBER.");
1042 add_com ("stepi", class_run
, stepi_command
,
1043 "Step one instruction exactly.\n\
1044 Argument N means do this N times (or till program stops for another reason).");
1045 add_com_alias ("si", "stepi", class_alias
, 0);
1047 add_com ("nexti", class_run
, nexti_command
,
1048 "Step one instruction, but proceed through subroutine calls.\n\
1049 Argument N means do this N times (or till program stops for another reason).");
1050 add_com_alias ("ni", "nexti", class_alias
, 0);
1052 add_com ("finish", class_run
, finish_command
,
1053 "Execute until selected stack frame returns.\n\
1054 Upon return, the value returned is printed and put in the value history.");
1056 add_com ("next", class_run
, next_command
,
1057 "Step program, proceeding through subroutine calls.\n\
1058 Like the \"step\" command as long as subroutine calls do not happen;\n\
1059 when they do, the call is treated as one instruction.\n\
1060 Argument N means do this N times (or till program stops for another reason).");
1061 add_com_alias ("n", "next", class_run
, 1);
1063 add_com ("step", class_run
, step_command
,
1064 "Step program until it reaches a different source line.\n\
1065 Argument N means do this N times (or till program stops for another reason).");
1066 add_com_alias ("s", "step", class_run
, 1);
1068 add_com ("until", class_run
, until_command
,
1069 "Execute until the program reaches a source line greater than the current\n\
1070 or a specified line or address or function (same args as break command).\n\
1071 Execution will also stop upon exit from the current stack frame.");
1072 add_com_alias ("u", "until", class_run
, 1);
1074 add_com ("jump", class_run
, jump_command
,
1075 "Continue program being debugged at specified line or address.\n\
1076 Give as argument either LINENUM or *ADDR, where ADDR is an expression\n\
1077 for an address to start at.");
1079 add_com ("continue", class_run
, continue_command
,
1080 "Continue program being debugged, after signal or breakpoint.\n\
1081 If proceeding from breakpoint, a number N may be used as an argument:\n\
1082 then the same breakpoint won't break until the Nth time it is reached.");
1083 add_com_alias ("c", "cont", class_run
, 1);
1084 add_com_alias ("fg", "cont", class_run
, 1);
1086 add_com ("run", class_run
, run_command
,
1087 "Start debugged program. You may specify arguments to give it.\n\
1088 Args may include \"*\", or \"[...]\"; they are expanded using \"sh\".\n\
1089 Input and output redirection with \">\", \"<\", or \">>\" are also allowed.\n\n\
1090 With no arguments, uses arguments last specified (with \"run\" or \"set args\".\n\
1091 To cancel previous arguments and run with no arguments,\n\
1092 use \"set args\" without arguments.");
1093 add_com_alias ("r", "run", class_run
, 1);
1095 add_info ("registers", registers_info
,
1096 "List of registers and their contents, for selected stack frame.\n\
1097 Register name as argument means describe only that register.");
1099 add_info ("program", program_info
,
1100 "Execution status of the program.");
1102 add_info ("float", float_info
,
1103 "Print the status of the floating point unit\n");
1105 inferior_args
= savestring ("", 1); /* Initially no args */
1106 inferior_environ
= make_environ ();
1107 init_environ (inferior_environ
);