home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / gdb-4.16-base.tgz / gdb-4.16-base.tar / fsf / gdb / gdb / infcmd.c < prev    next >
C/C++ Source or Header  |  1996-04-12  |  39KB  |  1,376 lines

  1. /* Memory-access and commands for "inferior" process, for GDB.
  2.    Copyright 1986, 1987, 1988, 1989, 1991, 1992, 1995, 1996 Free Software Foundation, Inc.
  3.  
  4. This file is part of GDB.
  5.  
  6. This program 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 2 of the License, or
  9. (at your option) any later version.
  10.  
  11. This program 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.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  19.  
  20. #include "defs.h"
  21. #include <signal.h>
  22. #include <sys/param.h>
  23. #include "gdb_string.h"
  24. #include "symtab.h"
  25. #include "gdbtypes.h"
  26. #include "frame.h"
  27. #include "inferior.h"
  28. #include "environ.h"
  29. #include "value.h"
  30. #include "gdbcmd.h"
  31. #include "gdbcore.h"
  32. #include "target.h"
  33. #include "language.h"
  34.  
  35. static void continue_command PARAMS ((char *, int));
  36.  
  37. static void until_next_command PARAMS ((int));
  38.  
  39. static void until_command PARAMS ((char *, int));
  40.  
  41. static void path_info PARAMS ((char *, int));
  42.  
  43. static void path_command PARAMS ((char *, int));
  44.  
  45. static void unset_command PARAMS ((char *, int));
  46.  
  47. static void float_info PARAMS ((char *, int));
  48.  
  49. static void detach_command PARAMS ((char *, int));
  50.  
  51. static void nofp_registers_info PARAMS ((char *, int));
  52.  
  53. static void all_registers_info PARAMS ((char *, int));
  54.  
  55. static void registers_info PARAMS ((char *, int));
  56.  
  57. static void do_registers_info PARAMS ((int, int));
  58.  
  59. static void unset_environment_command PARAMS ((char *, int));
  60.  
  61. static void set_environment_command PARAMS ((char *, int));
  62.  
  63. static void environment_info PARAMS ((char *, int));
  64.  
  65. static void program_info PARAMS ((char *, int));
  66.  
  67. static void finish_command PARAMS ((char *, int));
  68.  
  69. static void signal_command PARAMS ((char *, int));
  70.  
  71. static void jump_command PARAMS ((char *, int));
  72.  
  73. static void step_1 PARAMS ((int, int, char *));
  74.  
  75. static void nexti_command PARAMS ((char *, int));
  76.  
  77. static void stepi_command PARAMS ((char *, int));
  78.  
  79. static void next_command PARAMS ((char *, int));
  80.  
  81. static void step_command PARAMS ((char *, int));
  82.  
  83. static void run_command PARAMS ((char *, int));
  84.  
  85. #define ERROR_NO_INFERIOR \
  86.    if (!target_has_execution) error ("The program is not being run.");
  87.  
  88. /* String containing arguments to give to the program, separated by spaces.
  89.    Empty string (pointer to '\0') means no args.  */
  90.  
  91. static char *inferior_args;
  92.  
  93. /* File name for default use for standard in/out in the inferior.  */
  94.  
  95. char *inferior_io_terminal;
  96.  
  97. /* Pid of our debugged inferior, or 0 if no inferior now.
  98.    Since various parts of infrun.c test this to see whether there is a program
  99.    being debugged it should be nonzero (currently 3 is used) for remote
  100.    debugging.  */
  101.  
  102. int inferior_pid;
  103.  
  104. /* Last signal that the inferior received (why it stopped).  */
  105.  
  106. enum target_signal stop_signal;
  107.  
  108. /* Address at which inferior stopped.  */
  109.  
  110. CORE_ADDR stop_pc;
  111.  
  112. /* Chain containing status of breakpoint(s) that we have stopped at.  */
  113.  
  114. bpstat stop_bpstat;
  115.  
  116. /* Flag indicating that a command has proceeded the inferior past the
  117.    current breakpoint.  */
  118.  
  119. int breakpoint_proceeded;
  120.  
  121. /* Nonzero if stopped due to a step command.  */
  122.  
  123. int stop_step;
  124.  
  125. /* Nonzero if stopped due to completion of a stack dummy routine.  */
  126.  
  127. int stop_stack_dummy;
  128.  
  129. /* Nonzero if stopped due to a random (unexpected) signal in inferior
  130.    process.  */
  131.  
  132. int stopped_by_random_signal;
  133.  
  134. /* Range to single step within.
  135.    If this is nonzero, respond to a single-step signal
  136.    by continuing to step if the pc is in this range.  */
  137.  
  138. CORE_ADDR step_range_start; /* Inclusive */
  139. CORE_ADDR step_range_end; /* Exclusive */
  140.  
  141. /* Stack frame address as of when stepping command was issued.
  142.    This is how we know when we step into a subroutine call,
  143.    and how to set the frame for the breakpoint used to step out.  */
  144.  
  145. CORE_ADDR step_frame_address;
  146.  
  147. /* Our notion of the current stack pointer.  */
  148.  
  149. CORE_ADDR step_sp;
  150.  
  151. /* 1 means step over all subroutine calls.
  152.    0 means don't step over calls (used by stepi).
  153.    -1 means step over calls to undebuggable functions.  */
  154.  
  155. int step_over_calls;
  156.  
  157. /* If stepping, nonzero means step count is > 1
  158.    so don't print frame next time inferior stops
  159.    if it stops due to stepping.  */
  160.  
  161. int step_multi;
  162.  
  163. /* Environment to use for running inferior,
  164.    in format described in environ.h.  */
  165.  
  166. struct environ *inferior_environ;
  167.  
  168.  
  169. /* ARGSUSED */
  170. void
  171. tty_command (file, from_tty)
  172.      char *file;
  173.      int from_tty;
  174. {
  175.   if (file == 0)
  176.     error_no_arg ("terminal name for running target process");
  177.  
  178.   inferior_io_terminal = savestring (file, strlen (file));
  179. }
  180.  
  181. static void
  182. run_command (args, from_tty)
  183.      char *args;
  184.      int from_tty;
  185. {
  186.   char *exec_file;
  187.  
  188.   dont_repeat ();
  189.  
  190.   if (inferior_pid)
  191.     {
  192.       if (
  193.       !query ("The program being debugged has been started already.\n\
  194. Start it from the beginning? "))
  195.     error ("Program not restarted.");
  196.       target_kill ();
  197.     }
  198.  
  199.   clear_breakpoint_hit_counts ();
  200.  
  201.   exec_file = (char *) get_exec_file (0);
  202.  
  203.   /* The exec file is re-read every time we do a generic_mourn_inferior, so
  204.      we just have to worry about the symbol file.  */
  205.   reread_symbols ();
  206.  
  207.   /* We keep symbols from add-symbol-file, on the grounds that the
  208.      user might want to add some symbols before running the program
  209.      (right?).  But sometimes (dynamic loading where the user manually
  210.      introduces the new symbols with add-symbol-file), the code which
  211.      the symbols describe does not persist between runs.  Currently
  212.      the user has to manually nuke all symbols between runs if they
  213.      want them to go away (PR 2207).  This is probably reasonable.  */
  214.  
  215.   if (args)
  216.     {
  217.       char *cmd;
  218.       cmd = concat ("set args ", args, NULL);
  219.       make_cleanup (free, cmd);
  220.       execute_command (cmd, from_tty);
  221.     }
  222.  
  223.   if (from_tty)
  224.     {
  225.       puts_filtered("Starting program: ");
  226.       if (exec_file)
  227.     puts_filtered(exec_file);
  228.       puts_filtered(" ");
  229.       puts_filtered(inferior_args);
  230.       puts_filtered("\n");
  231.       gdb_flush (gdb_stdout);
  232.     }
  233.  
  234.   target_create_inferior (exec_file, inferior_args,
  235.               environ_vector (inferior_environ));
  236. }
  237.  
  238. static void
  239. continue_command (proc_count_exp, from_tty)
  240.      char *proc_count_exp;
  241.      int from_tty;
  242. {
  243.   ERROR_NO_INFERIOR;
  244.  
  245.   /* If have argument, set proceed count of breakpoint we stopped at.  */
  246.  
  247.   if (proc_count_exp != NULL)
  248.     {
  249.       bpstat bs = stop_bpstat;
  250.       int num = bpstat_num (&bs);
  251.       if (num == 0 && from_tty)
  252.     {
  253.       printf_filtered
  254.         ("Not stopped at any breakpoint; argument ignored.\n");
  255.     }
  256.       while (num != 0)
  257.     {
  258.       set_ignore_count (num,
  259.                 parse_and_eval_address (proc_count_exp) - 1,
  260.                 from_tty);
  261.       /* set_ignore_count prints a message ending with a period.
  262.          So print two spaces before "Continuing.".  */
  263.       if (from_tty)
  264.         printf_filtered ("  ");
  265.       num = bpstat_num (&bs);
  266.     }
  267.     }
  268.  
  269.   if (from_tty)
  270.     printf_filtered ("Continuing.\n");
  271.  
  272.   clear_proceed_status ();
  273.  
  274.   proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
  275. }
  276.  
  277. /* Step until outside of current statement.  */
  278.  
  279. /* ARGSUSED */
  280. static void
  281. step_command (count_string, from_tty)
  282.      char *count_string;
  283.      int from_tty;
  284. {
  285.   step_1 (0, 0, count_string);
  286. }
  287.  
  288. /* Likewise, but skip over subroutine calls as if single instructions.  */
  289.  
  290. /* ARGSUSED */
  291. static void
  292. next_command (count_string, from_tty)
  293.      char *count_string;
  294.      int from_tty;
  295. {
  296.   step_1 (1, 0, count_string);
  297. }
  298.  
  299. /* Likewise, but step only one instruction.  */
  300.  
  301. /* ARGSUSED */
  302. static void
  303. stepi_command (count_string, from_tty)
  304.      char *count_string;
  305.      int from_tty;
  306. {
  307.   step_1 (0, 1, count_string);
  308. }
  309.  
  310. /* ARGSUSED */
  311. static void
  312. nexti_command (count_string, from_tty)
  313.      char *count_string;
  314.      int from_tty;
  315. {
  316.   step_1 (1, 1, count_string);
  317. }
  318.  
  319. static void
  320. step_1 (skip_subroutines, single_inst, count_string)
  321.      int skip_subroutines;
  322.      int single_inst;
  323.      char *count_string;
  324. {
  325.   register int count = 1;
  326.   struct frame_info *frame;
  327.   struct cleanup *cleanups = 0;
  328.  
  329.   ERROR_NO_INFERIOR;
  330.   count = count_string ? parse_and_eval_address (count_string) : 1;
  331.  
  332.   if (!single_inst || skip_subroutines) /* leave si command alone */
  333.     {
  334.       enable_longjmp_breakpoint();
  335.       cleanups = make_cleanup(disable_longjmp_breakpoint, 0);
  336.     }
  337.  
  338.   for (; count > 0; count--)
  339.     {
  340.       clear_proceed_status ();
  341.  
  342.       frame = get_current_frame ();
  343.       if (!frame)            /* Avoid coredump here.  Why tho? */
  344.     error ("No current frame");
  345.       step_frame_address = FRAME_FP (frame);
  346.       step_sp = read_sp ();
  347.  
  348.       if (! single_inst)
  349.     {
  350.       find_pc_line_pc_range (stop_pc, &step_range_start, &step_range_end);
  351.       if (step_range_end == 0)
  352.         {
  353.           char *name;
  354.           if (find_pc_partial_function (stop_pc, &name, &step_range_start,
  355.                         &step_range_end) == 0)
  356.         error ("Cannot find bounds of current function");
  357.  
  358.           target_terminal_ours ();
  359.           printf_filtered ("\
  360. Single stepping until exit from function %s, \n\
  361. which has no line number information.\n", name);
  362.         }
  363.     }
  364.       else
  365.     {
  366.       /* Say we are stepping, but stop after one insn whatever it does.  */
  367.       step_range_start = step_range_end = 1;
  368.       if (!skip_subroutines)
  369.         /* It is stepi.
  370.            Don't step over function calls, not even to functions lacking
  371.            line numbers.  */
  372.         step_over_calls = 0;
  373.     }
  374.  
  375.       if (skip_subroutines)
  376.     step_over_calls = 1;
  377.  
  378.       step_multi = (count > 1);
  379.       proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
  380.       if (! stop_step)
  381.     break;
  382.  
  383.       /* FIXME: On nexti, this may have already been done (when we hit the
  384.      step resume break, I think).  Probably this should be moved to
  385.      wait_for_inferior (near the top).  */
  386. #if defined (SHIFT_INST_REGS)
  387.       SHIFT_INST_REGS();
  388. #endif
  389.     }
  390.  
  391.   if (!single_inst || skip_subroutines)
  392.     do_cleanups(cleanups);
  393. }
  394.  
  395. /* Continue program at specified address.  */
  396.  
  397. static void
  398. jump_command (arg, from_tty)
  399.      char *arg;
  400.      int from_tty;
  401. {
  402.   register CORE_ADDR addr;
  403.   struct symtabs_and_lines sals;
  404.   struct symtab_and_line sal;
  405.   struct symbol *fn;
  406.   struct symbol *sfn;
  407.  
  408.   ERROR_NO_INFERIOR;
  409.  
  410.   if (!arg)
  411.     error_no_arg ("starting address");
  412.  
  413.   sals = decode_line_spec_1 (arg, 1);
  414.   if (sals.nelts != 1)
  415.     {
  416.       error ("Unreasonable jump request");
  417.     }
  418.  
  419.   sal = sals.sals[0];
  420.   free ((PTR)sals.sals);
  421.  
  422.   if (sal.symtab == 0 && sal.pc == 0)
  423.     error ("No source file has been specified.");
  424.  
  425.   resolve_sal_pc (&sal);            /* May error out */
  426.  
  427.   /* See if we are trying to jump to another function. */
  428.   fn = get_frame_function (get_current_frame ());
  429.   sfn = find_pc_function (sal.pc);
  430.   if (fn != NULL && sfn != fn)
  431.     {
  432.       if (!query ("Line %d is not in `%s'.  Jump anyway? ", sal.line,
  433.           SYMBOL_SOURCE_NAME (fn)))
  434.     {
  435.       error ("Not confirmed.");
  436.       /* NOTREACHED */
  437.     }
  438.     }
  439.  
  440.   addr = sal.pc;
  441.  
  442.   if (from_tty)
  443.     {
  444.       printf_filtered ("Continuing at ");
  445.       print_address_numeric (addr, 1, gdb_stdout);
  446.       printf_filtered (".\n");
  447.     }
  448.  
  449.   clear_proceed_status ();
  450.   proceed (addr, TARGET_SIGNAL_0, 0);
  451. }
  452.  
  453. /* Continue program giving it specified signal.  */
  454.  
  455. static void
  456. signal_command (signum_exp, from_tty)
  457.      char *signum_exp;
  458.      int from_tty;
  459. {
  460.   enum target_signal oursig;
  461.  
  462.   dont_repeat ();        /* Too dangerous.  */
  463.   ERROR_NO_INFERIOR;
  464.  
  465.   if (!signum_exp)
  466.     error_no_arg ("signal number");
  467.  
  468.   /* It would be even slicker to make signal names be valid expressions,
  469.      (the type could be "enum $signal" or some such), then the user could
  470.      assign them to convenience variables.  */
  471.   oursig = target_signal_from_name (signum_exp);
  472.  
  473.   if (oursig == TARGET_SIGNAL_UNKNOWN)
  474.     {
  475.       /* No, try numeric.  */
  476.       int num = parse_and_eval_address (signum_exp);
  477.  
  478.       if (num == 0)
  479.     oursig = TARGET_SIGNAL_0;
  480.       else
  481.     oursig = target_signal_from_command (num);
  482.     }
  483.  
  484.   if (from_tty)
  485.     {
  486.       if (oursig == TARGET_SIGNAL_0)
  487.     printf_filtered ("Continuing with no signal.\n");
  488.       else
  489.     printf_filtered ("Continuing with signal %s.\n",
  490.              target_signal_to_name (oursig));
  491.     }
  492.  
  493.   clear_proceed_status ();
  494.   /* "signal 0" should not get stuck if we are stopped at a breakpoint.
  495.      FIXME: Neither should "signal foo" but when I tried passing
  496.      (CORE_ADDR)-1 unconditionally I got a testsuite failure which I haven't
  497.      tried to track down yet.  */
  498.   proceed (oursig == TARGET_SIGNAL_0 ? (CORE_ADDR) -1 : stop_pc, oursig, 0);
  499. }
  500.  
  501. /* Call breakpoint_auto_delete on the current contents of the bpstat
  502.    pointed to by arg (which is really a bpstat *).  */
  503. void
  504. breakpoint_auto_delete_contents (arg)
  505.      PTR arg;
  506. {
  507.   breakpoint_auto_delete (*(bpstat *)arg);
  508. }
  509.  
  510. /* Execute a "stack dummy", a piece of code stored in the stack
  511.    by the debugger to be executed in the inferior.
  512.  
  513.    To call: first, do PUSH_DUMMY_FRAME.
  514.    Then push the contents of the dummy.  It should end with a breakpoint insn.
  515.    Then call here, passing address at which to start the dummy.
  516.  
  517.    The contents of all registers are saved before the dummy frame is popped
  518.    and copied into the buffer BUFFER.
  519.  
  520.    The dummy's frame is automatically popped whenever that break is hit.
  521.    If that is the first time the program stops, run_stack_dummy
  522.    returns to its caller with that frame already gone and returns 0.
  523.    Otherwise, run_stack-dummy returns 1 (the frame will eventually be popped
  524.    when we do hit that breakpoint).  */
  525.  
  526. /* DEBUG HOOK:  4 => return instead of letting the stack dummy run.  */
  527.  
  528. static int stack_dummy_testing = 0;
  529.  
  530. int
  531. run_stack_dummy (addr, buffer)
  532.      CORE_ADDR addr;
  533.      char buffer[REGISTER_BYTES];
  534. {
  535.   struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0);
  536.  
  537.   /* Now proceed, having reached the desired place.  */
  538.   clear_proceed_status ();
  539.   if (stack_dummy_testing & 4)
  540.     {
  541.       POP_FRAME;
  542.       return(0);
  543.     }
  544. #ifdef CALL_DUMMY_BREAKPOINT_OFFSET
  545.   {
  546.     struct breakpoint *bpt;
  547.     struct symtab_and_line sal;
  548.  
  549. #if CALL_DUMMY_LOCATION != AT_ENTRY_POINT
  550.     sal.pc = addr - CALL_DUMMY_START_OFFSET + CALL_DUMMY_BREAKPOINT_OFFSET;
  551. #else
  552.     sal.pc = CALL_DUMMY_ADDRESS ();
  553. #endif
  554.     sal.symtab = NULL;
  555.     sal.line = 0;
  556.  
  557.     /* Set up a FRAME for the dummy frame so we can pass it to
  558.        set_momentary_breakpoint.  We need to give the breakpoint a
  559.        frame in case there is only one copy of the dummy (e.g.
  560.        CALL_DUMMY_LOCATION == AFTER_TEXT_END).  */
  561.     flush_cached_frames ();
  562.     set_current_frame (create_new_frame (read_fp (), sal.pc));
  563.  
  564.     /* If defined, CALL_DUMMY_BREAKPOINT_OFFSET is where we need to put
  565.        a breakpoint instruction.  If not, the call dummy already has the
  566.        breakpoint instruction in it.
  567.  
  568.        addr is the address of the call dummy plus the CALL_DUMMY_START_OFFSET,
  569.        so we need to subtract the CALL_DUMMY_START_OFFSET.  */
  570.     bpt = set_momentary_breakpoint (sal,
  571.                     get_current_frame (),
  572.                     bp_call_dummy);
  573.     bpt->disposition = del;
  574.  
  575.     /* If all error()s out of proceed ended up calling normal_stop (and
  576.        perhaps they should; it already does in the special case of error
  577.        out of resume()), then we wouldn't need this.  */
  578.     make_cleanup (breakpoint_auto_delete_contents, &stop_bpstat);
  579.   }
  580. #endif /* CALL_DUMMY_BREAKPOINT_OFFSET.  */
  581.  
  582.   proceed_to_finish = 1;    /* We want stop_registers, please... */
  583.   proceed (addr, TARGET_SIGNAL_0, 0);
  584.  
  585.   discard_cleanups (old_cleanups);
  586.  
  587.   if (!stop_stack_dummy)
  588.     return 1;
  589.  
  590.   /* On return, the stack dummy has been popped already.  */
  591.  
  592.   memcpy (buffer, stop_registers, sizeof stop_registers);
  593.   return 0;
  594. }
  595.  
  596. /* Proceed until we reach a different source line with pc greater than
  597.    our current one or exit the function.  We skip calls in both cases.
  598.  
  599.    Note that eventually this command should probably be changed so
  600.    that only source lines are printed out when we hit the breakpoint
  601.    we set.  This may involve changes to wait_for_inferior and the
  602.    proceed status code.  */
  603.  
  604. /* ARGSUSED */
  605. static void
  606. until_next_command (from_tty)
  607.      int from_tty;
  608. {
  609.   struct frame_info *frame;
  610.   CORE_ADDR pc;
  611.   struct symbol *func;
  612.   struct symtab_and_line sal;
  613.  
  614.   clear_proceed_status ();
  615.  
  616.   frame = get_current_frame ();
  617.  
  618.   /* Step until either exited from this function or greater
  619.      than the current line (if in symbolic section) or pc (if
  620.      not). */
  621.  
  622.   pc = read_pc ();
  623.   func = find_pc_function (pc);
  624.   
  625.   if (!func)
  626.     {
  627.       struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (pc);
  628.       
  629.       if (msymbol == NULL)
  630.     error ("Execution is not within a known function.");
  631.       
  632.       step_range_start = SYMBOL_VALUE_ADDRESS (msymbol);
  633.       step_range_end = pc;
  634.     }
  635.   else
  636.     {
  637.       sal = find_pc_line (pc, 0);
  638.       
  639.       step_range_start = BLOCK_START (SYMBOL_BLOCK_VALUE (func));
  640.       step_range_end = sal.end;
  641.     }
  642.   
  643.   step_over_calls = 1;
  644.   step_frame_address = FRAME_FP (frame);
  645.   step_sp = read_sp ();
  646.  
  647.   step_multi = 0;        /* Only one call to proceed */
  648.   
  649.   proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
  650. }
  651.  
  652. static void 
  653. until_command (arg, from_tty)
  654.      char *arg;
  655.      int from_tty;
  656. {
  657.   if (!target_has_execution)
  658.     error ("The program is not running.");
  659.   if (arg)
  660.     until_break_command (arg, from_tty);
  661.   else
  662.     until_next_command (from_tty);
  663. }
  664.  
  665. /* "finish": Set a temporary breakpoint at the place
  666.    the selected frame will return to, then continue.  */
  667.  
  668. static void
  669. finish_command (arg, from_tty)
  670.      char *arg;
  671.      int from_tty;
  672. {
  673.   struct symtab_and_line sal;
  674.   register struct frame_info *frame;
  675.   register struct symbol *function;
  676.   struct breakpoint *breakpoint;
  677.   struct cleanup *old_chain;
  678.  
  679.   if (arg)
  680.     error ("The \"finish\" command does not take any arguments.");
  681.   if (!target_has_execution)
  682.     error ("The program is not running.");
  683.   if (selected_frame == NULL)
  684.     error ("No selected frame.");
  685.  
  686.   frame = get_prev_frame (selected_frame);
  687.   if (frame == 0)
  688.     error ("\"finish\" not meaningful in the outermost frame.");
  689.  
  690.   clear_proceed_status ();
  691.  
  692.   sal = find_pc_line (frame->pc, 0);
  693.   sal.pc = frame->pc;
  694.  
  695.   breakpoint = set_momentary_breakpoint (sal, frame, bp_finish);
  696.  
  697.   old_chain = make_cleanup(delete_breakpoint, breakpoint);
  698.  
  699.   /* Find the function we will return from.  */
  700.  
  701.   function = find_pc_function (selected_frame->pc);
  702.  
  703.   /* Print info on the selected frame, including level number
  704.      but not source.  */
  705.   if (from_tty)
  706.     {
  707.       printf_filtered ("Run till exit from ");
  708.       print_stack_frame (selected_frame, selected_frame_level, 0);
  709.     }
  710.  
  711.   proceed_to_finish = 1;        /* We want stop_registers, please... */
  712.   proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
  713.  
  714.   /* Did we stop at our breakpoint? */
  715.   if (bpstat_find_breakpoint(stop_bpstat, breakpoint) != NULL
  716.       && function != 0)
  717.     {
  718.       struct type *value_type;
  719.       register value_ptr val;
  720.       CORE_ADDR funcaddr;
  721.  
  722.       value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function));
  723.       if (!value_type)
  724.     fatal ("internal: finish_command: function has no target type");
  725.       
  726.       if (TYPE_CODE (value_type) == TYPE_CODE_VOID)
  727.     return;
  728.  
  729.       funcaddr = BLOCK_START (SYMBOL_BLOCK_VALUE (function));
  730.  
  731.       val = value_being_returned (value_type, stop_registers,
  732.           using_struct_return (value_of_variable (function, NULL),
  733.                    funcaddr,
  734.                    check_typedef (value_type),
  735.         BLOCK_GCC_COMPILED (SYMBOL_BLOCK_VALUE (function))));
  736.  
  737.       printf_filtered ("Value returned is $%d = ", record_latest_value (val));
  738.       value_print (val, gdb_stdout, 0, Val_no_prettyprint);
  739.       printf_filtered ("\n");
  740.     }
  741.   do_cleanups(old_chain);
  742. }
  743.  
  744. /* ARGSUSED */
  745. static void
  746. program_info (args, from_tty)
  747.     char *args;
  748.     int from_tty;
  749. {
  750.   bpstat bs = stop_bpstat;
  751.   int num = bpstat_num (&bs);
  752.   
  753.   if (!target_has_execution)
  754.     {
  755.       printf_filtered ("The program being debugged is not being run.\n");
  756.       return;
  757.     }
  758.  
  759.   target_files_info ();
  760.   printf_filtered ("Program stopped at %s.\n",
  761.            local_hex_string((unsigned long) stop_pc));
  762.   if (stop_step)
  763.     printf_filtered ("It stopped after being stepped.\n");
  764.   else if (num != 0)
  765.     {
  766.       /* There may be several breakpoints in the same place, so this
  767.      isn't as strange as it seems.  */
  768.       while (num != 0)
  769.     {
  770.       if (num < 0)
  771.         printf_filtered ("It stopped at a breakpoint that has since been deleted.\n");
  772.       else
  773.         printf_filtered ("It stopped at breakpoint %d.\n", num);
  774.       num = bpstat_num (&bs);
  775.     }
  776.     }
  777.   else if (stop_signal != TARGET_SIGNAL_0)
  778.     {
  779.       printf_filtered ("It stopped with signal %s, %s.\n",
  780.                target_signal_to_name (stop_signal),
  781.                target_signal_to_string (stop_signal));
  782.     }
  783.  
  784.   if (!from_tty)
  785.     printf_filtered ("Type \"info stack\" or \"info registers\" for more information.\n");
  786. }
  787.  
  788. static void
  789. environment_info (var, from_tty)
  790.      char *var;
  791.      int from_tty;
  792. {
  793.   if (var)
  794.     {
  795.       register char *val = get_in_environ (inferior_environ, var);
  796.       if (val)
  797.     {
  798.       puts_filtered (var);
  799.       puts_filtered (" = ");
  800.       puts_filtered (val);
  801.       puts_filtered ("\n");
  802.     }
  803.       else
  804.     {
  805.       puts_filtered ("Environment variable \"");
  806.       puts_filtered (var);
  807.       puts_filtered ("\" not defined.\n");
  808.     }
  809.     }
  810.   else
  811.     {
  812.       register char **vector = environ_vector (inferior_environ);
  813.       while (*vector)
  814.     {
  815.       puts_filtered (*vector++);
  816.       puts_filtered ("\n");
  817.     }
  818.     }
  819. }
  820.  
  821. static void
  822. set_environment_command (arg, from_tty)
  823.      char *arg;
  824.      int from_tty;
  825. {
  826.   register char *p, *val, *var;
  827.   int nullset = 0;
  828.  
  829.   if (arg == 0)
  830.     error_no_arg ("environment variable and value");
  831.  
  832.   /* Find seperation between variable name and value */
  833.   p = (char *) strchr (arg, '=');
  834.   val = (char *) strchr (arg, ' ');
  835.  
  836.   if (p != 0 && val != 0)
  837.     {
  838.       /* We have both a space and an equals.  If the space is before the
  839.      equals, walk forward over the spaces til we see a nonspace 
  840.      (possibly the equals). */
  841.       if (p > val)
  842.     while (*val == ' ')
  843.       val++;
  844.  
  845.       /* Now if the = is after the char following the spaces,
  846.      take the char following the spaces.  */
  847.       if (p > val)
  848.     p = val - 1;
  849.     }
  850.   else if (val != 0 && p == 0)
  851.     p = val;
  852.  
  853.   if (p == arg)
  854.     error_no_arg ("environment variable to set");
  855.  
  856.   if (p == 0 || p[1] == 0)
  857.     {
  858.       nullset = 1;
  859.       if (p == 0)
  860.     p = arg + strlen (arg);    /* So that savestring below will work */
  861.     }
  862.   else
  863.     {
  864.       /* Not setting variable value to null */
  865.       val = p + 1;
  866.       while (*val == ' ' || *val == '\t')
  867.     val++;
  868.     }
  869.  
  870.   while (p != arg && (p[-1] == ' ' || p[-1] == '\t')) p--;
  871.  
  872.   var = savestring (arg, p - arg);
  873.   if (nullset)
  874.     {
  875.       printf_filtered ("Setting environment variable \"%s\" to null value.\n", var);
  876.       set_in_environ (inferior_environ, var, "");
  877.     }
  878.   else
  879.     set_in_environ (inferior_environ, var, val);
  880.   free (var);
  881. }
  882.  
  883. static void
  884. unset_environment_command (var, from_tty)
  885.      char *var;
  886.      int from_tty;
  887. {
  888.   if (var == 0)
  889.     {
  890.       /* If there is no argument, delete all environment variables.
  891.      Ask for confirmation if reading from the terminal.  */
  892.       if (!from_tty || query ("Delete all environment variables? "))
  893.     {
  894.       free_environ (inferior_environ);
  895.       inferior_environ = make_environ ();
  896.     }
  897.     }
  898.   else
  899.     unset_in_environ (inferior_environ, var);
  900. }
  901.  
  902. /* Handle the execution path (PATH variable) */
  903.  
  904. static const char path_var_name[] = "PATH";
  905.  
  906. /* ARGSUSED */
  907. static void
  908. path_info (args, from_tty)
  909.      char *args;
  910.      int from_tty;
  911. {
  912.   puts_filtered ("Executable and object file path: ");
  913.   puts_filtered (get_in_environ (inferior_environ, path_var_name));
  914.   puts_filtered ("\n");
  915. }
  916.  
  917. /* Add zero or more directories to the front of the execution path.  */
  918.  
  919. static void
  920. path_command (dirname, from_tty)
  921.      char *dirname;
  922.      int from_tty;
  923. {
  924.   char *exec_path;
  925.   char *env;
  926.   dont_repeat ();
  927.   env = get_in_environ (inferior_environ, path_var_name);
  928.   /* Can be null if path is not set */
  929.   if (!env)
  930.     env = "";
  931.   exec_path = strsave (env);
  932.   mod_path (dirname, &exec_path);
  933.   set_in_environ (inferior_environ, path_var_name, exec_path);
  934.   free (exec_path);
  935.   if (from_tty)
  936.     path_info ((char *)NULL, from_tty);
  937. }
  938.  
  939. /* The array of register names.  */
  940.  
  941. char *reg_names[] = REGISTER_NAMES;
  942.  
  943. /* Print out the machine register regnum. If regnum is -1,
  944.    print all registers (fpregs == 1) or all non-float registers
  945.    (fpregs == 0).
  946.  
  947.    For most machines, having all_registers_info() print the
  948.    register(s) one per line is good enough. If a different format
  949.    is required, (eg, for MIPS or Pyramid 90x, which both have
  950.    lots of regs), or there is an existing convention for showing
  951.    all the registers, define the macro DO_REGISTERS_INFO(regnum, fp)
  952.    to provide that format.  */  
  953.  
  954. #if !defined (DO_REGISTERS_INFO)
  955.  
  956. #define DO_REGISTERS_INFO(regnum, fp) do_registers_info(regnum, fp)
  957.  
  958. static void
  959. do_registers_info (regnum, fpregs)
  960.      int regnum;
  961.      int fpregs;
  962. {
  963.   register int i;
  964.   int numregs = ARCH_NUM_REGS;
  965.  
  966.   for (i = 0; i < numregs; i++)
  967.     {
  968.       char raw_buffer[MAX_REGISTER_RAW_SIZE];
  969.       char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
  970.  
  971.       /* Decide between printing all regs, nonfloat regs, or specific reg.  */
  972.       if (regnum == -1) {
  973.     if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT && !fpregs)
  974.       continue;
  975.       } else {
  976.         if (i != regnum)
  977.       continue;
  978.       }
  979.  
  980.       /* If the register name is empty, it is undefined for this
  981.      processor, so don't display anything.  */
  982.       if (reg_names[i] == NULL || *(reg_names[i]) == '\0')
  983.     continue;
  984.  
  985.       fputs_filtered (reg_names[i], gdb_stdout);
  986.       print_spaces_filtered (15 - strlen (reg_names[i]), gdb_stdout);
  987.  
  988.       /* Get the data in raw format.  */
  989.       if (read_relative_register_raw_bytes (i, raw_buffer))
  990.     {
  991.       printf_filtered ("Invalid register contents\n");
  992.       continue;
  993.     }
  994.  
  995.       /* Convert raw data to virtual format if necessary.  */
  996. #ifdef REGISTER_CONVERTIBLE
  997.       if (REGISTER_CONVERTIBLE (i))
  998.     {
  999.       REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i),
  1000.                        raw_buffer, virtual_buffer);
  1001.     }
  1002.       else
  1003. #endif
  1004.     memcpy (virtual_buffer, raw_buffer,
  1005.         REGISTER_VIRTUAL_SIZE (i));
  1006.  
  1007.       /* If virtual format is floating, print it that way, and in raw hex.  */
  1008.       if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
  1009.     {
  1010.       register int j;
  1011.  
  1012. #ifdef INVALID_FLOAT
  1013.       if (INVALID_FLOAT (virtual_buffer, REGISTER_VIRTUAL_SIZE (i)))
  1014.         printf_filtered ("<invalid float>");
  1015.       else
  1016. #endif
  1017.         val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0,
  1018.                gdb_stdout, 0, 1, 0, Val_pretty_default);
  1019.  
  1020.       printf_filtered ("\t(raw 0x");
  1021.       for (j = 0; j < REGISTER_RAW_SIZE (i); j++)
  1022.         printf_filtered ("%02x", (unsigned char)raw_buffer[j]);
  1023.       printf_filtered (")");
  1024.     }
  1025.  
  1026. /* FIXME!  val_print probably can handle all of these cases now...  */
  1027.  
  1028.       /* Else if virtual format is too long for printf,
  1029.      print in hex a byte at a time.  */
  1030.       else if (REGISTER_VIRTUAL_SIZE (i) > (int) sizeof (long))
  1031.     {
  1032.       register int j;
  1033.       printf_filtered ("0x");
  1034.       for (j = 0; j < REGISTER_VIRTUAL_SIZE (i); j++)
  1035.         printf_filtered ("%02x", (unsigned char)virtual_buffer[j]);
  1036.     }
  1037.       /* Else print as integer in hex and in decimal.  */
  1038.       else
  1039.     {
  1040.       val_print (REGISTER_VIRTUAL_TYPE (i), raw_buffer, 0,
  1041.              gdb_stdout, 'x', 1, 0, Val_pretty_default);
  1042.       printf_filtered ("\t");
  1043.       val_print (REGISTER_VIRTUAL_TYPE (i), raw_buffer, 0,
  1044.              gdb_stdout,   0, 1, 0, Val_pretty_default);
  1045.     }
  1046.  
  1047.       /* The SPARC wants to print even-numbered float regs as doubles
  1048.      in addition to printing them as floats.  */
  1049. #ifdef PRINT_REGISTER_HOOK
  1050.       PRINT_REGISTER_HOOK (i);
  1051. #endif
  1052.  
  1053.       printf_filtered ("\n");
  1054.     }
  1055. }
  1056. #endif /* no DO_REGISTERS_INFO.  */
  1057.  
  1058. static void
  1059. registers_info (addr_exp, fpregs)
  1060.      char *addr_exp;
  1061.      int fpregs;
  1062. {
  1063.   int regnum, numregs;
  1064.   register char *end;
  1065.  
  1066.   if (!target_has_registers)
  1067.     error ("The program has no registers now.");
  1068.   if (selected_frame == NULL)
  1069.     error ("No selected frame.");
  1070.  
  1071.   if (!addr_exp)
  1072.     {
  1073.       DO_REGISTERS_INFO(-1, fpregs);
  1074.       return;
  1075.     }
  1076.  
  1077.   do
  1078.     {      
  1079.       if (addr_exp[0] == '$')
  1080.     addr_exp++;
  1081.       end = addr_exp;
  1082.       while (*end != '\0' && *end != ' ' && *end != '\t')
  1083.     ++end;
  1084.       numregs = ARCH_NUM_REGS;
  1085.       for (regnum = 0; regnum < numregs; regnum++)
  1086.     if (!strncmp (addr_exp, reg_names[regnum], end - addr_exp)
  1087.         && strlen (reg_names[regnum]) == end - addr_exp)
  1088.       goto found;
  1089.       if (*addr_exp >= '0' && *addr_exp <= '9')
  1090.     regnum = atoi (addr_exp);        /* Take a number */
  1091.       if (regnum >= numregs)        /* Bad name, or bad number */
  1092.     error ("%.*s: invalid register", end - addr_exp, addr_exp);
  1093.  
  1094. found:
  1095.       DO_REGISTERS_INFO(regnum, fpregs);
  1096.  
  1097.       addr_exp = end;
  1098.       while (*addr_exp == ' ' || *addr_exp == '\t')
  1099.     ++addr_exp;
  1100.     } while (*addr_exp != '\0');
  1101. }
  1102.  
  1103. static void
  1104. all_registers_info (addr_exp, from_tty)
  1105.      char *addr_exp;
  1106.      int from_tty;
  1107. {
  1108.   registers_info (addr_exp, 1);
  1109. }
  1110.  
  1111. static void
  1112. nofp_registers_info (addr_exp, from_tty)
  1113.      char *addr_exp;
  1114.      int from_tty;
  1115. {
  1116.   registers_info (addr_exp, 0);
  1117. }
  1118.  
  1119. /*
  1120.  * TODO:
  1121.  * Should save/restore the tty state since it might be that the
  1122.  * program to be debugged was started on this tty and it wants
  1123.  * the tty in some state other than what we want.  If it's running
  1124.  * on another terminal or without a terminal, then saving and
  1125.  * restoring the tty state is a harmless no-op.
  1126.  * This only needs to be done if we are attaching to a process.
  1127.  */
  1128.  
  1129. /*
  1130.    attach_command --
  1131.    takes a program started up outside of gdb and ``attaches'' to it.
  1132.    This stops it cold in its tracks and allows us to start debugging it.
  1133.    and wait for the trace-trap that results from attaching.  */
  1134.  
  1135. void
  1136. attach_command (args, from_tty)
  1137.      char *args;
  1138.      int from_tty;
  1139. {
  1140.   extern int auto_solib_add;
  1141.  
  1142.   dont_repeat ();            /* Not for the faint of heart */
  1143.  
  1144.   if (target_has_execution)
  1145.     {
  1146.       if (query ("A program is being debugged already.  Kill it? "))
  1147.     target_kill ();
  1148.       else
  1149.     error ("Not killed.");
  1150.     }
  1151.  
  1152.   target_attach (args, from_tty);
  1153.  
  1154.   /* Set up the "saved terminal modes" of the inferior
  1155.      based on what modes we are starting it with.  */
  1156.   target_terminal_init ();
  1157.  
  1158.   /* Install inferior's terminal modes.  */
  1159.   target_terminal_inferior ();
  1160.  
  1161.   /* Set up execution context to know that we should return from
  1162.      wait_for_inferior as soon as the target reports a stop.  */
  1163.   init_wait_for_inferior ();
  1164.   clear_proceed_status ();
  1165.   stop_soon_quietly = 1;
  1166.  
  1167.   /* No traps are generated when attaching to inferior under Mach 3
  1168.      or GNU hurd.  */
  1169. #ifndef ATTACH_NO_WAIT
  1170.   wait_for_inferior ();
  1171. #endif
  1172.  
  1173. #ifdef SOLIB_ADD
  1174.   if (auto_solib_add)
  1175.     {
  1176.       /* Add shared library symbols from the newly attached process, if any.  */
  1177.       SOLIB_ADD ((char *)0, from_tty, (struct target_ops *)0);
  1178.       re_enable_breakpoints_in_shlibs ();
  1179.     }
  1180. #endif
  1181.  
  1182.   normal_stop ();
  1183. }
  1184.  
  1185. /*
  1186.  * detach_command --
  1187.  * takes a program previously attached to and detaches it.
  1188.  * The program resumes execution and will no longer stop
  1189.  * on signals, etc.  We better not have left any breakpoints
  1190.  * in the program or it'll die when it hits one.  For this
  1191.  * to work, it may be necessary for the process to have been
  1192.  * previously attached.  It *might* work if the program was
  1193.  * started via the normal ptrace (PTRACE_TRACEME).
  1194.  */
  1195.  
  1196. static void
  1197. detach_command (args, from_tty)
  1198.      char *args;
  1199.      int from_tty;
  1200. {
  1201.   dont_repeat ();            /* Not for the faint of heart */
  1202.   target_detach (args, from_tty);
  1203. }
  1204.  
  1205. /* ARGSUSED */
  1206. static void
  1207. float_info (addr_exp, from_tty)
  1208.      char *addr_exp;
  1209.      int from_tty;
  1210. {
  1211. #ifdef FLOAT_INFO
  1212.     FLOAT_INFO;
  1213. #else
  1214.     printf_filtered ("No floating point info available for this processor.\n");
  1215. #endif
  1216. }
  1217.  
  1218. /* ARGSUSED */
  1219. static void
  1220. unset_command (args, from_tty)
  1221.      char *args;
  1222.      int from_tty;
  1223. {
  1224.   printf_filtered ("\"unset\" must be followed by the name of an unset subcommand.\n");
  1225.   help_list (unsetlist, "unset ", -1, gdb_stdout);
  1226. }
  1227.  
  1228. void
  1229. _initialize_infcmd ()
  1230. {
  1231.   struct cmd_list_element *c;
  1232.   
  1233.   add_com ("tty", class_run, tty_command,
  1234.        "Set terminal for future runs of program being debugged.");
  1235.  
  1236.   add_show_from_set
  1237.     (add_set_cmd ("args", class_run, var_string_noescape, (char *)&inferior_args,
  1238.           
  1239. "Set arguments to give program being debugged when it is started.\n\
  1240. Follow this command with any number of args, to be passed to the program.",
  1241.           &setlist),
  1242.      &showlist);
  1243.  
  1244.   c = add_cmd
  1245.     ("environment", no_class, environment_info,
  1246.      "The environment to give the program, or one variable's value.\n\
  1247. With an argument VAR, prints the value of environment variable VAR to\n\
  1248. give the program being debugged.  With no arguments, prints the entire\n\
  1249. environment to be given to the program.", &showlist);
  1250.   c->completer = noop_completer;
  1251.  
  1252.   add_prefix_cmd ("unset", no_class, unset_command,
  1253.           "Complement to certain \"set\" commands",
  1254.           &unsetlist, "unset ", 0, &cmdlist);
  1255.   
  1256.   c = add_cmd ("environment", class_run, unset_environment_command,
  1257.           "Cancel environment variable VAR for the program.\n\
  1258. This does not affect the program until the next \"run\" command.",
  1259.        &unsetlist);
  1260.   c->completer = noop_completer;
  1261.  
  1262.   c = add_cmd ("environment", class_run, set_environment_command,
  1263.            "Set environment variable value to give the program.\n\
  1264. Arguments are VAR VALUE where VAR is variable name and VALUE is value.\n\
  1265. VALUES of environment variables are uninterpreted strings.\n\
  1266. This does not affect the program until the next \"run\" command.",
  1267.        &setlist);
  1268.   c->completer = noop_completer;
  1269.  
  1270.   add_com ("path", class_files, path_command,
  1271.        "Add directory DIR(s) to beginning of search path for object files.\n\
  1272. $cwd in the path means the current working directory.\n\
  1273. This path is equivalent to the $PATH shell variable.  It is a list of\n\
  1274. directories, separated by colons.  These directories are searched to find\n\
  1275. fully linked executable files and separately compiled object files as needed.");
  1276.  
  1277.   c = add_cmd ("paths", no_class, path_info,
  1278.         "Current search path for finding object files.\n\
  1279. $cwd in the path means the current working directory.\n\
  1280. This path is equivalent to the $PATH shell variable.  It is a list of\n\
  1281. directories, separated by colons.  These directories are searched to find\n\
  1282. fully linked executable files and separately compiled object files as needed.", &showlist);
  1283.   c->completer = noop_completer;
  1284.  
  1285.  add_com ("attach", class_run, attach_command,
  1286.         "Attach to a process or file outside of GDB.\n\
  1287. This command attaches to another target, of the same type as your last\n\
  1288. `target' command (`info files' will show your target stack).\n\
  1289. The command may take as argument a process id or a device file.\n\
  1290. For a process id, you must have permission to send the process a signal,\n\
  1291. and it must have the same effective uid as the debugger.\n\
  1292. When using \"attach\", you should use the \"file\" command to specify\n\
  1293. the program running in the process, and to load its symbol table.");
  1294.  
  1295.   add_com ("detach", class_run, detach_command,
  1296.        "Detach a process or file previously attached.\n\
  1297. If a process, it is no longer traced, and it continues its execution.  If you\n\
  1298. were debugging a file, the file is closed and gdb no longer accesses it.");
  1299.  
  1300.   add_com ("signal", class_run, signal_command,
  1301.        "Continue program giving it signal specified by the argument.\n\
  1302. An argument of \"0\" means continue program without giving it a signal.");
  1303.  
  1304.   add_com ("stepi", class_run, stepi_command,
  1305.        "Step one instruction exactly.\n\
  1306. Argument N means do this N times (or till program stops for another reason).");
  1307.   add_com_alias ("si", "stepi", class_alias, 0);
  1308.  
  1309.   add_com ("nexti", class_run, nexti_command,
  1310.        "Step one instruction, but proceed through subroutine calls.\n\
  1311. Argument N means do this N times (or till program stops for another reason).");
  1312.   add_com_alias ("ni", "nexti", class_alias, 0);
  1313.  
  1314.   add_com ("finish", class_run, finish_command,
  1315.        "Execute until selected stack frame returns.\n\
  1316. Upon return, the value returned is printed and put in the value history.");
  1317.  
  1318.   add_com ("next", class_run, next_command,
  1319.        "Step program, proceeding through subroutine calls.\n\
  1320. Like the \"step\" command as long as subroutine calls do not happen;\n\
  1321. when they do, the call is treated as one instruction.\n\
  1322. Argument N means do this N times (or till program stops for another reason).");
  1323.   add_com_alias ("n", "next", class_run, 1);
  1324.  
  1325.   add_com ("step", class_run, step_command,
  1326.        "Step program until it reaches a different source line.\n\
  1327. Argument N means do this N times (or till program stops for another reason).");
  1328.   add_com_alias ("s", "step", class_run, 1);
  1329.  
  1330.   add_com ("until", class_run, until_command,
  1331.        "Execute until the program reaches a source line greater than the current\n\
  1332. or a specified line or address or function (same args as break command).\n\
  1333. Execution will also stop upon exit from the current stack frame.");
  1334.   add_com_alias ("u", "until", class_run, 1);
  1335.   
  1336.   add_com ("jump", class_run, jump_command,
  1337.        "Continue program being debugged at specified line or address.\n\
  1338. Give as argument either LINENUM or *ADDR, where ADDR is an expression\n\
  1339. for an address to start at.");
  1340.  
  1341.   add_com ("continue", class_run, continue_command,
  1342.        "Continue program being debugged, after signal or breakpoint.\n\
  1343. If proceeding from breakpoint, a number N may be used as an argument,\n\
  1344. which means to set the ignore count of that breakpoint to N - 1 (so that\n\
  1345. the breakpoint won't break until the Nth time it is reached).");
  1346.   add_com_alias ("c", "cont", class_run, 1);
  1347.   add_com_alias ("fg", "cont", class_run, 1);
  1348.  
  1349.   add_com ("run", class_run, run_command,
  1350.        "Start debugged program.  You may specify arguments to give it.\n\
  1351. Args may include \"*\", or \"[...]\"; they are expanded using \"sh\".\n\
  1352. Input and output redirection with \">\", \"<\", or \">>\" are also allowed.\n\n\
  1353. With no arguments, uses arguments last specified (with \"run\" or \"set args\").\n\
  1354. To cancel previous arguments and run with no arguments,\n\
  1355. use \"set args\" without arguments.");
  1356.   add_com_alias ("r", "run", class_run, 1);
  1357.  
  1358.   add_info ("registers", nofp_registers_info,
  1359.     "List of integer registers and their contents, for selected stack frame.\n\
  1360. Register name as argument means describe only that register.");
  1361.  
  1362.   add_info ("all-registers", all_registers_info,
  1363. "List of all registers and their contents, for selected stack frame.\n\
  1364. Register name as argument means describe only that register.");
  1365.  
  1366.   add_info ("program", program_info,
  1367.         "Execution status of the program.");
  1368.  
  1369.   add_info ("float", float_info,
  1370.         "Print the status of the floating point unit\n");
  1371.  
  1372.   inferior_args = savestring ("", 1);    /* Initially no args */
  1373.   inferior_environ = make_environ ();
  1374.   init_environ (inferior_environ);
  1375. }
  1376.