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