* config/tc-mn10300.c (md_assemble): Copy size to real_size before
[deliverable/binutils-gdb.git] / gdb / infcmd.c
CommitLineData
c906108c 1/* Memory-access and commands for "inferior" process, for GDB.
96baa820 2 Copyright 1986, 87, 88, 89, 91, 92, 95, 96, 1998, 1999
c906108c
SS
3 Free Software Foundation, Inc.
4
c5aa993b 5 This file is part of GDB.
c906108c 6
c5aa993b
JM
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.
c906108c 11
c5aa993b
JM
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.
c906108c 16
c5aa993b
JM
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
c906108c
SS
21
22#include "defs.h"
23#include <signal.h>
24#include "gdb_string.h"
25#include "symtab.h"
26#include "gdbtypes.h"
27#include "frame.h"
28#include "inferior.h"
29#include "environ.h"
30#include "value.h"
31#include "gdbcmd.h"
32#include "gdbcore.h"
33#include "target.h"
34#include "language.h"
35#include "symfile.h"
36#include "objfiles.h"
8b93c638
JM
37#ifdef UI_OUT
38#include "ui-out.h"
39#endif
6426a772 40#include "event-top.h"
96baa820 41#include "parser-defs.h"
c906108c
SS
42
43/* Functions exported for general use: */
44
45void nofp_registers_info PARAMS ((char *, int));
46
47void all_registers_info PARAMS ((char *, int));
48
49void registers_info PARAMS ((char *, int));
50
51/* Local functions: */
52
53void continue_command PARAMS ((char *, int));
54
11cf8741
JM
55static void print_return_value (int struct_return, struct type *value_type);
56
43ff13b4
JM
57static void finish_command_continuation PARAMS ((struct continuation_arg *));
58
c906108c
SS
59static void until_next_command PARAMS ((int));
60
61static void until_command PARAMS ((char *, int));
62
63static void path_info PARAMS ((char *, int));
64
65static void path_command PARAMS ((char *, int));
66
67static void unset_command PARAMS ((char *, int));
68
69static void float_info PARAMS ((char *, int));
70
71static void detach_command PARAMS ((char *, int));
72
96baa820
JM
73static void interrupt_target_command (char *args, int from_tty);
74
c906108c
SS
75#if !defined (DO_REGISTERS_INFO)
76static void do_registers_info PARAMS ((int, int));
77#endif
78
79static void unset_environment_command PARAMS ((char *, int));
80
81static void set_environment_command PARAMS ((char *, int));
82
83static void environment_info PARAMS ((char *, int));
84
85static void program_info PARAMS ((char *, int));
86
87static void finish_command PARAMS ((char *, int));
88
89static void signal_command PARAMS ((char *, int));
90
91static void jump_command PARAMS ((char *, int));
92
93static void step_1 PARAMS ((int, int, char *));
c2d11a7d
JM
94static void step_once (int skip_subroutines, int single_inst, int count);
95static void step_1_continuation (struct continuation_arg *arg);
c906108c
SS
96
97void nexti_command PARAMS ((char *, int));
98
99void stepi_command PARAMS ((char *, int));
100
101static void next_command PARAMS ((char *, int));
102
103static void step_command PARAMS ((char *, int));
104
105static void run_command PARAMS ((char *, int));
106
392a587b
JM
107static void run_no_args_command PARAMS ((char *args, int from_tty));
108
109static void go_command PARAMS ((char *line_no, int from_tty));
110
43ff13b4
JM
111static int strip_bg_char PARAMS ((char **));
112
c906108c
SS
113void _initialize_infcmd PARAMS ((void));
114
115#define GO_USAGE "Usage: go <location>\n"
116
c906108c 117static void breakpoint_auto_delete_contents PARAMS ((PTR));
c906108c
SS
118
119#define ERROR_NO_INFERIOR \
120 if (!target_has_execution) error ("The program is not being run.");
121
122/* String containing arguments to give to the program, separated by spaces.
123 Empty string (pointer to '\0') means no args. */
124
125static char *inferior_args;
126
127/* File name for default use for standard in/out in the inferior. */
128
129char *inferior_io_terminal;
130
131/* Pid of our debugged inferior, or 0 if no inferior now.
132 Since various parts of infrun.c test this to see whether there is a program
133 being debugged it should be nonzero (currently 3 is used) for remote
134 debugging. */
135
136int inferior_pid;
137
138/* Last signal that the inferior received (why it stopped). */
139
140enum target_signal stop_signal;
141
142/* Address at which inferior stopped. */
143
144CORE_ADDR stop_pc;
145
146/* Chain containing status of breakpoint(s) that we have stopped at. */
147
148bpstat stop_bpstat;
149
150/* Flag indicating that a command has proceeded the inferior past the
151 current breakpoint. */
152
153int breakpoint_proceeded;
154
155/* Nonzero if stopped due to a step command. */
156
157int stop_step;
158
159/* Nonzero if stopped due to completion of a stack dummy routine. */
160
161int stop_stack_dummy;
162
163/* Nonzero if stopped due to a random (unexpected) signal in inferior
164 process. */
165
166int stopped_by_random_signal;
167
168/* Range to single step within.
169 If this is nonzero, respond to a single-step signal
170 by continuing to step if the pc is in this range. */
171
c5aa993b
JM
172CORE_ADDR step_range_start; /* Inclusive */
173CORE_ADDR step_range_end; /* Exclusive */
c906108c
SS
174
175/* Stack frame address as of when stepping command was issued.
176 This is how we know when we step into a subroutine call,
177 and how to set the frame for the breakpoint used to step out. */
178
179CORE_ADDR step_frame_address;
180
181/* Our notion of the current stack pointer. */
182
183CORE_ADDR step_sp;
184
185/* 1 means step over all subroutine calls.
186 0 means don't step over calls (used by stepi).
187 -1 means step over calls to undebuggable functions. */
188
189int step_over_calls;
190
191/* If stepping, nonzero means step count is > 1
192 so don't print frame next time inferior stops
193 if it stops due to stepping. */
194
195int step_multi;
196
197/* Environment to use for running inferior,
198 in format described in environ.h. */
199
200struct environ *inferior_environ;
c906108c 201\f
c5aa993b 202
43ff13b4
JM
203/* This function detects whether or not a '&' character (indicating
204 background execution) has been added as *the last* of the arguments ARGS
205 of a command. If it has, it removes it and returns 1. Otherwise it
206 does nothing and returns 0. */
c5aa993b 207static int
43ff13b4
JM
208strip_bg_char (args)
209 char **args;
210{
211 char *p = NULL;
c5aa993b 212
9846de1b 213 p = strchr (*args, '&');
c5aa993b 214
9846de1b 215 if (p)
43ff13b4
JM
216 {
217 if (p == (*args + strlen (*args) - 1))
218 {
c5aa993b 219 if (strlen (*args) > 1)
43ff13b4
JM
220 {
221 do
222 p--;
223 while (*p == ' ' || *p == '\t');
224 *(p + 1) = '\0';
225 }
226 else
227 *args = 0;
228 return 1;
229 }
230 }
231 return 0;
232}
233
c906108c
SS
234/* ARGSUSED */
235void
236tty_command (file, from_tty)
237 char *file;
238 int from_tty;
239{
240 if (file == 0)
241 error_no_arg ("terminal name for running target process");
242
243 inferior_io_terminal = savestring (file, strlen (file));
244}
245
246static void
247run_command (args, from_tty)
248 char *args;
249 int from_tty;
250{
251 char *exec_file;
252
253 dont_repeat ();
254
255 if (inferior_pid != 0 && target_has_execution)
256 {
adf40b2e
JM
257 if (from_tty
258 && !query ("The program being debugged has been started already.\n\
c906108c
SS
259Start it from the beginning? "))
260 error ("Program not restarted.");
261 target_kill ();
262#if defined(SOLIB_RESTART)
263 SOLIB_RESTART ();
264#endif
265 init_wait_for_inferior ();
266 }
267
268 clear_breakpoint_hit_counts ();
269
270 exec_file = (char *) get_exec_file (0);
271
272 /* Purge old solib objfiles. */
273 objfile_purge_solibs ();
274
275 do_run_cleanups (NULL);
276
277 /* The exec file is re-read every time we do a generic_mourn_inferior, so
278 we just have to worry about the symbol file. */
279 reread_symbols ();
280
281 /* We keep symbols from add-symbol-file, on the grounds that the
282 user might want to add some symbols before running the program
283 (right?). But sometimes (dynamic loading where the user manually
284 introduces the new symbols with add-symbol-file), the code which
285 the symbols describe does not persist between runs. Currently
286 the user has to manually nuke all symbols between runs if they
287 want them to go away (PR 2207). This is probably reasonable. */
288
43ff13b4 289 if (!args)
6426a772
JM
290 {
291 if (event_loop_p && target_can_async_p ())
292 async_disable_stdin ();
293 }
43ff13b4 294 else
c906108c
SS
295 {
296 char *cmd;
43ff13b4
JM
297 int async_exec = strip_bg_char (&args);
298
299 /* If we get a request for running in the bg but the target
300 doesn't support it, error out. */
6426a772 301 if (event_loop_p && async_exec && !target_can_async_p ())
43ff13b4
JM
302 error ("Asynchronous execution not supported on this target.");
303
304 /* If we don't get a request of running in the bg, then we need
c5aa993b 305 to simulate synchronous (fg) execution. */
6426a772 306 if (event_loop_p && !async_exec && target_can_async_p ())
43ff13b4
JM
307 {
308 /* Simulate synchronous execution */
6426a772 309 async_disable_stdin ();
43ff13b4
JM
310 }
311
312 /* If there were other args, beside '&', process them. */
313 if (args)
314 {
315 cmd = concat ("set args ", args, NULL);
316 make_cleanup (free, cmd);
317 execute_command (cmd, from_tty);
318 }
c906108c
SS
319 }
320
321 if (from_tty)
322 {
8b93c638
JM
323#ifdef UI_OUT
324 ui_out_field_string (uiout, NULL, "Starting program");
325 ui_out_text (uiout, ": ");
326 if (exec_file)
327 ui_out_field_string (uiout, "execfile", exec_file);
328 ui_out_spaces (uiout, 1);
329 ui_out_field_string (uiout, "infargs", inferior_args);
330 ui_out_text (uiout, "\n");
331 ui_out_flush (uiout);
332#else
c5aa993b 333 puts_filtered ("Starting program: ");
c906108c 334 if (exec_file)
c5aa993b
JM
335 puts_filtered (exec_file);
336 puts_filtered (" ");
337 puts_filtered (inferior_args);
338 puts_filtered ("\n");
c906108c 339 gdb_flush (gdb_stdout);
8b93c638 340#endif
c906108c
SS
341 }
342
343 target_create_inferior (exec_file, inferior_args,
344 environ_vector (inferior_environ));
345}
346
347
348static void
349run_no_args_command (args, from_tty)
350 char *args;
351 int from_tty;
352{
c5aa993b
JM
353 execute_command ("set args", from_tty);
354 run_command ((char *) NULL, from_tty);
c906108c 355}
c906108c 356\f
c5aa993b 357
c906108c
SS
358void
359continue_command (proc_count_exp, from_tty)
360 char *proc_count_exp;
361 int from_tty;
362{
c5aa993b 363 int async_exec = 0;
c906108c
SS
364 ERROR_NO_INFERIOR;
365
43ff13b4
JM
366 /* Find out whether we must run in the background. */
367 if (proc_count_exp != NULL)
368 async_exec = strip_bg_char (&proc_count_exp);
369
370 /* If we must run in the background, but the target can't do it,
371 error out. */
6426a772 372 if (event_loop_p && async_exec && !target_can_async_p ())
43ff13b4
JM
373 error ("Asynchronous execution not supported on this target.");
374
375 /* If we are not asked to run in the bg, then prepare to run in the
376 foreground, synchronously. */
6426a772 377 if (event_loop_p && !async_exec && target_can_async_p ())
c5aa993b 378 {
43ff13b4 379 /* Simulate synchronous execution */
6426a772 380 async_disable_stdin ();
43ff13b4 381 }
c906108c 382
43ff13b4
JM
383 /* If have argument (besides '&'), set proceed count of breakpoint
384 we stopped at. */
c906108c
SS
385 if (proc_count_exp != NULL)
386 {
387 bpstat bs = stop_bpstat;
388 int num = bpstat_num (&bs);
389 if (num == 0 && from_tty)
390 {
391 printf_filtered
392 ("Not stopped at any breakpoint; argument ignored.\n");
393 }
394 while (num != 0)
395 {
396 set_ignore_count (num,
397 parse_and_eval_address (proc_count_exp) - 1,
398 from_tty);
399 /* set_ignore_count prints a message ending with a period.
400 So print two spaces before "Continuing.". */
401 if (from_tty)
402 printf_filtered (" ");
403 num = bpstat_num (&bs);
404 }
405 }
406
407 if (from_tty)
408 printf_filtered ("Continuing.\n");
409
410 clear_proceed_status ();
411
2acceee2 412 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
c906108c
SS
413}
414\f
415/* Step until outside of current statement. */
416
417/* ARGSUSED */
418static void
419step_command (count_string, from_tty)
420 char *count_string;
421 int from_tty;
422{
423 step_1 (0, 0, count_string);
424}
425
426/* Likewise, but skip over subroutine calls as if single instructions. */
427
428/* ARGSUSED */
429static void
430next_command (count_string, from_tty)
431 char *count_string;
432 int from_tty;
433{
434 step_1 (1, 0, count_string);
435}
436
437/* Likewise, but step only one instruction. */
438
439/* ARGSUSED */
440void
441stepi_command (count_string, from_tty)
442 char *count_string;
443 int from_tty;
444{
445 step_1 (0, 1, count_string);
446}
447
448/* ARGSUSED */
449void
450nexti_command (count_string, from_tty)
451 char *count_string;
452 int from_tty;
453{
454 step_1 (1, 1, count_string);
455}
456
74b7792f
AC
457static void
458disable_longjmp_breakpoint_cleanup (void *ignore)
459{
460 disable_longjmp_breakpoint ();
461}
462
c906108c
SS
463static void
464step_1 (skip_subroutines, single_inst, count_string)
465 int skip_subroutines;
466 int single_inst;
467 char *count_string;
468{
469 register int count = 1;
470 struct frame_info *frame;
471 struct cleanup *cleanups = 0;
43ff13b4 472 int async_exec = 0;
c5aa993b 473
c906108c 474 ERROR_NO_INFERIOR;
43ff13b4
JM
475
476 if (count_string)
477 async_exec = strip_bg_char (&count_string);
c5aa993b 478
43ff13b4
JM
479 /* If we get a request for running in the bg but the target
480 doesn't support it, error out. */
6426a772 481 if (event_loop_p && async_exec && !target_can_async_p ())
43ff13b4
JM
482 error ("Asynchronous execution not supported on this target.");
483
484 /* If we don't get a request of running in the bg, then we need
485 to simulate synchronous (fg) execution. */
6426a772 486 if (event_loop_p && !async_exec && target_can_async_p ())
43ff13b4
JM
487 {
488 /* Simulate synchronous execution */
6426a772 489 async_disable_stdin ();
43ff13b4
JM
490 }
491
c906108c
SS
492 count = count_string ? parse_and_eval_address (count_string) : 1;
493
c5aa993b 494 if (!single_inst || skip_subroutines) /* leave si command alone */
c906108c 495 {
c5aa993b 496 enable_longjmp_breakpoint ();
c2d11a7d 497 if (!event_loop_p || !target_can_async_p ())
74b7792f 498 cleanups = make_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/);
c2d11a7d 499 else
74b7792f 500 make_exec_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/);
c2d11a7d
JM
501 }
502
503 /* In synchronous case, all is well, just use the regular for loop. */
504 if (!event_loop_p || !target_can_async_p ())
505 {
506 for (; count > 0; count--)
507 {
508 clear_proceed_status ();
509
510 frame = get_current_frame ();
511 if (!frame) /* Avoid coredump here. Why tho? */
512 error ("No current frame");
513 step_frame_address = FRAME_FP (frame);
514 step_sp = read_sp ();
515
516 if (!single_inst)
517 {
518 find_pc_line_pc_range (stop_pc, &step_range_start, &step_range_end);
519 if (step_range_end == 0)
520 {
521 char *name;
522 if (find_pc_partial_function (stop_pc, &name, &step_range_start,
523 &step_range_end) == 0)
524 error ("Cannot find bounds of current function");
525
526 target_terminal_ours ();
527 printf_filtered ("\
528Single stepping until exit from function %s, \n\
529which has no line number information.\n", name);
530 }
531 }
532 else
533 {
534 /* Say we are stepping, but stop after one insn whatever it does. */
535 step_range_start = step_range_end = 1;
536 if (!skip_subroutines)
537 /* It is stepi.
538 Don't step over function calls, not even to functions lacking
539 line numbers. */
540 step_over_calls = 0;
541 }
542
543 if (skip_subroutines)
544 step_over_calls = 1;
545
546 step_multi = (count > 1);
547 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
548
549 if (!stop_step)
550 break;
551
552 /* FIXME: On nexti, this may have already been done (when we hit the
553 step resume break, I think). Probably this should be moved to
554 wait_for_inferior (near the top). */
555#if defined (SHIFT_INST_REGS)
556 SHIFT_INST_REGS ();
557#endif
558 }
559
560 if (!single_inst || skip_subroutines)
561 do_cleanups (cleanups);
562 return;
563 }
564 /* In case of asynchronous target things get complicated, do only
565 one step for now, before returning control to the event loop. Let
566 the continuation figure out how many other steps we need to do,
567 and handle them one at the time, through step_once(). */
568 else
569 {
570 if (event_loop_p && target_can_async_p ())
571 step_once (skip_subroutines, single_inst, count);
c906108c 572 }
c2d11a7d 573}
c906108c 574
c2d11a7d
JM
575/* Called after we are done with one step operation, to check whether
576 we need to step again, before we print the prompt and return control
577 to the user. If count is > 1, we will need to do one more call to
578 proceed(), via step_once(). Basically it is like step_once and
579 step_1_continuation are co-recursive. */
580static void
581step_1_continuation (arg)
582 struct continuation_arg *arg;
583{
57e687d9
MS
584 int count;
585 int skip_subroutines;
586 int single_inst;
587
588 skip_subroutines = arg->data.integer;
589 single_inst = arg->next->data.integer;
590 count = arg->next->next->data.integer;
591
592 if (stop_step)
593 {
594 /* FIXME: On nexti, this may have already been done (when we hit the
595 step resume break, I think). Probably this should be moved to
596 wait_for_inferior (near the top). */
c2d11a7d 597#if defined (SHIFT_INST_REGS)
57e687d9 598 SHIFT_INST_REGS ();
c2d11a7d 599#endif
57e687d9
MS
600 step_once (skip_subroutines, single_inst, count - 1);
601 }
602 else
603 if (!single_inst || skip_subroutines)
604 do_exec_cleanups (ALL_CLEANUPS);
c2d11a7d
JM
605}
606
607/* Do just one step operation. If count >1 we will have to set up a
608 continuation to be done after the target stops (after this one
609 step). This is useful to implement the 'step n' kind of commands, in
610 case of asynchronous targets. We had to split step_1 into two parts,
611 one to be done before proceed() and one afterwards. This function is
612 called in case of step n with n>1, after the first step operation has
613 been completed.*/
614static void
0d06e24b 615step_once (int skip_subroutines, int single_inst, int count)
c2d11a7d 616{
0d06e24b
JM
617 struct continuation_arg *arg1;
618 struct continuation_arg *arg2;
619 struct continuation_arg *arg3;
620 struct frame_info *frame;
c2d11a7d
JM
621
622 if (count > 0)
c906108c
SS
623 {
624 clear_proceed_status ();
625
626 frame = get_current_frame ();
c5aa993b 627 if (!frame) /* Avoid coredump here. Why tho? */
c906108c
SS
628 error ("No current frame");
629 step_frame_address = FRAME_FP (frame);
630 step_sp = read_sp ();
631
c5aa993b 632 if (!single_inst)
c906108c
SS
633 {
634 find_pc_line_pc_range (stop_pc, &step_range_start, &step_range_end);
635 if (step_range_end == 0)
636 {
637 char *name;
638 if (find_pc_partial_function (stop_pc, &name, &step_range_start,
639 &step_range_end) == 0)
640 error ("Cannot find bounds of current function");
641
642 target_terminal_ours ();
643 printf_filtered ("\
644Single stepping until exit from function %s, \n\
645which has no line number information.\n", name);
646 }
647 }
648 else
649 {
650 /* Say we are stepping, but stop after one insn whatever it does. */
651 step_range_start = step_range_end = 1;
652 if (!skip_subroutines)
653 /* It is stepi.
654 Don't step over function calls, not even to functions lacking
655 line numbers. */
656 step_over_calls = 0;
657 }
658
659 if (skip_subroutines)
660 step_over_calls = 1;
661
662 step_multi = (count > 1);
c2d11a7d
JM
663 arg1 =
664 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
665 arg2 =
666 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
667 arg3 =
668 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
669 arg1->next = arg2;
57e687d9 670 arg1->data.integer = skip_subroutines;
c2d11a7d 671 arg2->next = arg3;
57e687d9 672 arg2->data.integer = single_inst;
c2d11a7d 673 arg3->next = NULL;
57e687d9 674 arg3->data.integer = count;
c2d11a7d 675 add_intermediate_continuation (step_1_continuation, arg1);
2acceee2 676 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
c906108c 677 }
c906108c 678}
c2d11a7d 679
c906108c
SS
680\f
681/* Continue program at specified address. */
682
683static void
684jump_command (arg, from_tty)
685 char *arg;
686 int from_tty;
687{
688 register CORE_ADDR addr;
689 struct symtabs_and_lines sals;
690 struct symtab_and_line sal;
691 struct symbol *fn;
692 struct symbol *sfn;
43ff13b4 693 int async_exec = 0;
c5aa993b 694
c906108c
SS
695 ERROR_NO_INFERIOR;
696
43ff13b4
JM
697 /* Find out whether we must run in the background. */
698 if (arg != NULL)
699 async_exec = strip_bg_char (&arg);
700
701 /* If we must run in the background, but the target can't do it,
702 error out. */
6426a772 703 if (event_loop_p && async_exec && !target_can_async_p ())
43ff13b4
JM
704 error ("Asynchronous execution not supported on this target.");
705
706 /* If we are not asked to run in the bg, then prepare to run in the
707 foreground, synchronously. */
6426a772 708 if (event_loop_p && !async_exec && target_can_async_p ())
c5aa993b 709 {
43ff13b4 710 /* Simulate synchronous execution */
6426a772 711 async_disable_stdin ();
43ff13b4
JM
712 }
713
c906108c
SS
714 if (!arg)
715 error_no_arg ("starting address");
716
717 sals = decode_line_spec_1 (arg, 1);
718 if (sals.nelts != 1)
719 {
720 error ("Unreasonable jump request");
721 }
722
723 sal = sals.sals[0];
c5aa993b 724 free ((PTR) sals.sals);
c906108c
SS
725
726 if (sal.symtab == 0 && sal.pc == 0)
727 error ("No source file has been specified.");
728
c5aa993b 729 resolve_sal_pc (&sal); /* May error out */
c906108c
SS
730
731 /* See if we are trying to jump to another function. */
732 fn = get_frame_function (get_current_frame ());
733 sfn = find_pc_function (sal.pc);
734 if (fn != NULL && sfn != fn)
735 {
736 if (!query ("Line %d is not in `%s'. Jump anyway? ", sal.line,
737 SYMBOL_SOURCE_NAME (fn)))
738 {
739 error ("Not confirmed.");
740 /* NOTREACHED */
741 }
742 }
743
c5aa993b 744 if (sfn != NULL)
c906108c
SS
745 {
746 fixup_symbol_section (sfn, 0);
c5aa993b 747 if (section_is_overlay (SYMBOL_BFD_SECTION (sfn)) &&
c906108c
SS
748 !section_is_mapped (SYMBOL_BFD_SECTION (sfn)))
749 {
750 if (!query ("WARNING!!! Destination is in unmapped overlay! Jump anyway? "))
751 {
752 error ("Not confirmed.");
753 /* NOTREACHED */
754 }
755 }
756 }
757
c906108c
SS
758 addr = sal.pc;
759
760 if (from_tty)
761 {
762 printf_filtered ("Continuing at ");
763 print_address_numeric (addr, 1, gdb_stdout);
764 printf_filtered (".\n");
765 }
766
767 clear_proceed_status ();
768 proceed (addr, TARGET_SIGNAL_0, 0);
769}
c906108c 770\f
c5aa993b 771
c906108c
SS
772/* Go to line or address in current procedure */
773static void
b83266a0 774go_command (line_no, from_tty)
c906108c
SS
775 char *line_no;
776 int from_tty;
777{
c5aa993b 778 if (line_no == (char *) NULL || !*line_no)
b83266a0 779 printf_filtered (GO_USAGE);
c906108c
SS
780 else
781 {
b83266a0
SS
782 tbreak_command (line_no, from_tty);
783 jump_command (line_no, from_tty);
c906108c
SS
784 }
785}
c906108c 786\f
c5aa993b 787
c906108c
SS
788/* Continue program giving it specified signal. */
789
790static void
791signal_command (signum_exp, from_tty)
792 char *signum_exp;
793 int from_tty;
794{
795 enum target_signal oursig;
796
797 dont_repeat (); /* Too dangerous. */
798 ERROR_NO_INFERIOR;
799
800 if (!signum_exp)
801 error_no_arg ("signal number");
802
803 /* It would be even slicker to make signal names be valid expressions,
804 (the type could be "enum $signal" or some such), then the user could
805 assign them to convenience variables. */
806 oursig = target_signal_from_name (signum_exp);
807
808 if (oursig == TARGET_SIGNAL_UNKNOWN)
809 {
810 /* No, try numeric. */
811 int num = parse_and_eval_address (signum_exp);
812
813 if (num == 0)
814 oursig = TARGET_SIGNAL_0;
815 else
816 oursig = target_signal_from_command (num);
817 }
818
819 if (from_tty)
820 {
821 if (oursig == TARGET_SIGNAL_0)
822 printf_filtered ("Continuing with no signal.\n");
823 else
824 printf_filtered ("Continuing with signal %s.\n",
825 target_signal_to_name (oursig));
826 }
827
828 clear_proceed_status ();
829 /* "signal 0" should not get stuck if we are stopped at a breakpoint.
830 FIXME: Neither should "signal foo" but when I tried passing
831 (CORE_ADDR)-1 unconditionally I got a testsuite failure which I haven't
832 tried to track down yet. */
2acceee2 833 proceed (oursig == TARGET_SIGNAL_0 ? (CORE_ADDR) -1 : stop_pc, oursig, 0);
c906108c
SS
834}
835
836/* Call breakpoint_auto_delete on the current contents of the bpstat
837 pointed to by arg (which is really a bpstat *). */
838
c906108c
SS
839static void
840breakpoint_auto_delete_contents (arg)
841 PTR arg;
842{
c5aa993b 843 breakpoint_auto_delete (*(bpstat *) arg);
c906108c
SS
844}
845
c906108c
SS
846
847/* Execute a "stack dummy", a piece of code stored in the stack
848 by the debugger to be executed in the inferior.
849
850 To call: first, do PUSH_DUMMY_FRAME.
851 Then push the contents of the dummy. It should end with a breakpoint insn.
852 Then call here, passing address at which to start the dummy.
853
854 The contents of all registers are saved before the dummy frame is popped
855 and copied into the buffer BUFFER.
856
857 The dummy's frame is automatically popped whenever that break is hit.
858 If that is the first time the program stops, run_stack_dummy
859 returns to its caller with that frame already gone and returns 0.
da59e081
JM
860
861 Otherwise, run_stack-dummy returns a non-zero value.
862 If the called function receives a random signal, we do not allow the user
863 to continue executing it as this may not work. The dummy frame is poped
864 and we return 1.
865 If we hit a breakpoint, we leave the frame in place and return 2 (the frame
866 will eventually be popped when we do hit the dummy end breakpoint). */
c906108c 867
c906108c
SS
868int
869run_stack_dummy (addr, buffer)
870 CORE_ADDR addr;
7a292a7a 871 char *buffer;
c906108c
SS
872{
873 struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0);
ed9a39eb 874 int saved_async = 0;
c906108c
SS
875
876 /* Now proceed, having reached the desired place. */
877 clear_proceed_status ();
96baa820 878
7a292a7a
SS
879 if (CALL_DUMMY_BREAKPOINT_OFFSET_P)
880 {
881 struct breakpoint *bpt;
882 struct symtab_and_line sal;
c5aa993b
JM
883
884 INIT_SAL (&sal); /* initialize to zeroes */
7a292a7a
SS
885 if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT)
886 {
887 sal.pc = CALL_DUMMY_ADDRESS ();
888 }
889 else
890 {
891 sal.pc = addr - CALL_DUMMY_START_OFFSET + CALL_DUMMY_BREAKPOINT_OFFSET;
892 }
893 sal.section = find_pc_overlay (sal.pc);
c5aa993b 894
7a292a7a 895 /* Set up a FRAME for the dummy frame so we can pass it to
c5aa993b
JM
896 set_momentary_breakpoint. We need to give the breakpoint a
897 frame in case there is only one copy of the dummy (e.g.
898 CALL_DUMMY_LOCATION == AFTER_TEXT_END). */
7a292a7a
SS
899 flush_cached_frames ();
900 set_current_frame (create_new_frame (read_fp (), sal.pc));
c5aa993b 901
7a292a7a 902 /* If defined, CALL_DUMMY_BREAKPOINT_OFFSET is where we need to put
c5aa993b
JM
903 a breakpoint instruction. If not, the call dummy already has the
904 breakpoint instruction in it.
905
906 addr is the address of the call dummy plus the CALL_DUMMY_START_OFFSET,
907 so we need to subtract the CALL_DUMMY_START_OFFSET. */
7a292a7a
SS
908 bpt = set_momentary_breakpoint (sal,
909 get_current_frame (),
910 bp_call_dummy);
911 bpt->disposition = del;
c5aa993b 912
7a292a7a 913 /* If all error()s out of proceed ended up calling normal_stop (and
c5aa993b
JM
914 perhaps they should; it already does in the special case of error
915 out of resume()), then we wouldn't need this. */
7a292a7a
SS
916 make_cleanup (breakpoint_auto_delete_contents, &stop_bpstat);
917 }
c906108c
SS
918
919 disable_watchpoints_before_interactive_call_start ();
920 proceed_to_finish = 1; /* We want stop_registers, please... */
ed9a39eb
JM
921
922 if (target_can_async_p ())
923 saved_async = target_async_mask (0);
924
c906108c 925 proceed (addr, TARGET_SIGNAL_0, 0);
ed9a39eb
JM
926
927 if (saved_async)
928 target_async_mask (saved_async);
929
c906108c
SS
930 enable_watchpoints_after_interactive_call_stop ();
931
932 discard_cleanups (old_cleanups);
933
242bfc55 934 /* We can stop during an inferior call because a signal is received. */
da59e081 935 if (stopped_by_random_signal)
242bfc55 936 return 1;
da59e081
JM
937
938 /* We may also stop prematurely because we hit a breakpoint in the
242bfc55 939 called routine. */
c906108c 940 if (!stop_stack_dummy)
da59e081 941 return 2;
c906108c 942
da59e081 943 /* On normal return, the stack dummy has been popped already. */
c906108c 944
7a292a7a 945 memcpy (buffer, stop_registers, REGISTER_BYTES);
c906108c
SS
946 return 0;
947}
948\f
949/* Proceed until we reach a different source line with pc greater than
950 our current one or exit the function. We skip calls in both cases.
951
952 Note that eventually this command should probably be changed so
953 that only source lines are printed out when we hit the breakpoint
954 we set. This may involve changes to wait_for_inferior and the
955 proceed status code. */
956
957/* ARGSUSED */
958static void
959until_next_command (from_tty)
960 int from_tty;
961{
962 struct frame_info *frame;
963 CORE_ADDR pc;
964 struct symbol *func;
965 struct symtab_and_line sal;
c5aa993b 966
c906108c
SS
967 clear_proceed_status ();
968
969 frame = get_current_frame ();
970
971 /* Step until either exited from this function or greater
972 than the current line (if in symbolic section) or pc (if
973 not). */
974
975 pc = read_pc ();
976 func = find_pc_function (pc);
c5aa993b 977
c906108c
SS
978 if (!func)
979 {
980 struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (pc);
c5aa993b 981
c906108c
SS
982 if (msymbol == NULL)
983 error ("Execution is not within a known function.");
c5aa993b 984
c906108c
SS
985 step_range_start = SYMBOL_VALUE_ADDRESS (msymbol);
986 step_range_end = pc;
987 }
988 else
989 {
990 sal = find_pc_line (pc, 0);
c5aa993b 991
c906108c
SS
992 step_range_start = BLOCK_START (SYMBOL_BLOCK_VALUE (func));
993 step_range_end = sal.end;
994 }
c5aa993b 995
c906108c
SS
996 step_over_calls = 1;
997 step_frame_address = FRAME_FP (frame);
998 step_sp = read_sp ();
999
1000 step_multi = 0; /* Only one call to proceed */
c5aa993b 1001
2acceee2 1002 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
c906108c
SS
1003}
1004
c5aa993b 1005static void
c906108c
SS
1006until_command (arg, from_tty)
1007 char *arg;
1008 int from_tty;
1009{
43ff13b4
JM
1010 int async_exec = 0;
1011
c906108c
SS
1012 if (!target_has_execution)
1013 error ("The program is not running.");
43ff13b4
JM
1014
1015 /* Find out whether we must run in the background. */
1016 if (arg != NULL)
1017 async_exec = strip_bg_char (&arg);
1018
1019 /* If we must run in the background, but the target can't do it,
1020 error out. */
6426a772 1021 if (event_loop_p && async_exec && !target_can_async_p ())
43ff13b4
JM
1022 error ("Asynchronous execution not supported on this target.");
1023
1024 /* If we are not asked to run in the bg, then prepare to run in the
1025 foreground, synchronously. */
6426a772 1026 if (event_loop_p && !async_exec && target_can_async_p ())
c5aa993b 1027 {
43ff13b4 1028 /* Simulate synchronous execution */
6426a772 1029 async_disable_stdin ();
43ff13b4
JM
1030 }
1031
c906108c
SS
1032 if (arg)
1033 until_break_command (arg, from_tty);
1034 else
1035 until_next_command (from_tty);
1036}
1037\f
43ff13b4 1038
11cf8741
JM
1039/* Print the result of a function at the end of a 'finish' command. */
1040static void
1041print_return_value (int structure_return, struct type *value_type)
1042{
1043 register value_ptr value;
8b93c638
JM
1044#ifdef UI_OUT
1045 static struct ui_stream *stb = NULL;
1046#endif /* UI_OUT */
11cf8741
JM
1047
1048 if (!structure_return)
1049 {
1050 value = value_being_returned (value_type, stop_registers, structure_return);
8b93c638
JM
1051#ifdef UI_OUT
1052 stb = ui_out_stream_new (uiout);
1053 ui_out_text (uiout, "Value returned is ");
1054 ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value));
1055 ui_out_text (uiout, "= ");
1056 value_print (value, stb->stream, 0, Val_no_prettyprint);
1057 ui_out_field_stream (uiout, "return-value", stb);
1058 ui_out_text (uiout, "\n");
1059#else /* UI_OUT */
11cf8741
JM
1060 printf_filtered ("Value returned is $%d = ", record_latest_value (value));
1061 value_print (value, gdb_stdout, 0, Val_no_prettyprint);
1062 printf_filtered ("\n");
8b93c638 1063#endif /* UI_OUT */
11cf8741
JM
1064 }
1065 else
1066 {
1067 /* We cannot determine the contents of the structure because
1068 it is on the stack, and we don't know where, since we did not
1069 initiate the call, as opposed to the call_function_by_hand case */
1070#ifdef VALUE_RETURNED_FROM_STACK
1071 value = 0;
8b93c638
JM
1072#ifdef UI_OUT
1073 ui_out_text (uiout, "Value returned has type: ");
1074 ui_out_field_string (uiout, "return-type", TYPE_NAME (value_type));
1075 ui_out_text (uiout, ".");
1076 ui_out_text (uiout, " Cannot determine contents\n");
1077#else /* UI_OUT */
11cf8741
JM
1078 printf_filtered ("Value returned has type: %s.", TYPE_NAME (value_type));
1079 printf_filtered (" Cannot determine contents\n");
8b93c638 1080#endif /* UI_OUT */
11cf8741
JM
1081#else
1082 value = value_being_returned (value_type, stop_registers, structure_return);
8b93c638
JM
1083#ifdef UI_OUT
1084 stb = ui_out_stream_new (uiout);
1085 ui_out_text (uiout, "Value returned is ");
1086 ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value));
1087 ui_out_text (uiout, "= ");
1088 value_print (value, stb->stream, 0, Val_no_prettyprint);
1089 ui_out_field_stream (uiout, "return-value", stb);
1090 ui_out_text (uiout, "\n");
1091#else
11cf8741
JM
1092 printf_filtered ("Value returned is $%d = ", record_latest_value (value));
1093 value_print (value, gdb_stdout, 0, Val_no_prettyprint);
1094 printf_filtered ("\n");
8b93c638 1095#endif
11cf8741
JM
1096#endif
1097 }
1098}
1099
43ff13b4
JM
1100/* Stuff that needs to be done by the finish command after the target
1101 has stopped. In asynchronous mode, we wait for the target to stop in
1102 the call to poll or select in the event loop, so it is impossible to
1103 do all the stuff as part of the finish_command function itself. The
1104 only chance we have to complete this command is in
1105 fetch_inferior_event, which is called by the event loop as soon as it
1106 detects that the target has stopped. This function is called via the
1107 cmd_continaution pointer. */
1108void
1109finish_command_continuation (arg)
1110 struct continuation_arg *arg;
1111{
1112 register struct symbol *function;
1113 struct breakpoint *breakpoint;
0d06e24b 1114 struct cleanup *cleanups;
c5aa993b 1115
57e687d9
MS
1116 breakpoint = (struct breakpoint *) arg->data.pointer;
1117 function = (struct symbol *) arg->next->data.pointer;
1118 cleanups = (struct cleanup *) arg->next->next->data.pointer;
43ff13b4 1119
c5aa993b 1120 if (bpstat_find_breakpoint (stop_bpstat, breakpoint) != NULL
43ff13b4
JM
1121 && function != 0)
1122 {
1123 struct type *value_type;
43ff13b4
JM
1124 CORE_ADDR funcaddr;
1125 int struct_return;
1126
1127 value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function));
1128 if (!value_type)
96baa820 1129 internal_error ("finish_command: function has no target type");
c5aa993b 1130
43ff13b4
JM
1131 if (TYPE_CODE (value_type) == TYPE_CODE_VOID)
1132 {
0d06e24b 1133 do_exec_cleanups (cleanups);
43ff13b4
JM
1134 return;
1135 }
1136
1137 funcaddr = BLOCK_START (SYMBOL_BLOCK_VALUE (function));
1138
1139 struct_return = using_struct_return (value_of_variable (function, NULL),
c5aa993b
JM
1140 funcaddr,
1141 check_typedef (value_type),
11cf8741 1142 BLOCK_GCC_COMPILED (SYMBOL_BLOCK_VALUE (function)));
43ff13b4 1143
11cf8741 1144 print_return_value (struct_return, value_type);
43ff13b4 1145 }
0d06e24b 1146 do_exec_cleanups (cleanups);
43ff13b4
JM
1147}
1148
c906108c
SS
1149/* "finish": Set a temporary breakpoint at the place
1150 the selected frame will return to, then continue. */
1151
1152static void
1153finish_command (arg, from_tty)
1154 char *arg;
1155 int from_tty;
1156{
1157 struct symtab_and_line sal;
1158 register struct frame_info *frame;
1159 register struct symbol *function;
1160 struct breakpoint *breakpoint;
1161 struct cleanup *old_chain;
0d06e24b 1162 struct continuation_arg *arg1, *arg2, *arg3;
43ff13b4
JM
1163
1164 int async_exec = 0;
1165
1166 /* Find out whether we must run in the background. */
1167 if (arg != NULL)
1168 async_exec = strip_bg_char (&arg);
1169
1170 /* If we must run in the background, but the target can't do it,
1171 error out. */
6426a772 1172 if (event_loop_p && async_exec && !target_can_async_p ())
43ff13b4
JM
1173 error ("Asynchronous execution not supported on this target.");
1174
1175 /* If we are not asked to run in the bg, then prepare to run in the
1176 foreground, synchronously. */
6426a772 1177 if (event_loop_p && !async_exec && target_can_async_p ())
c5aa993b 1178 {
43ff13b4 1179 /* Simulate synchronous execution */
6426a772 1180 async_disable_stdin ();
43ff13b4 1181 }
c906108c
SS
1182
1183 if (arg)
1184 error ("The \"finish\" command does not take any arguments.");
1185 if (!target_has_execution)
1186 error ("The program is not running.");
1187 if (selected_frame == NULL)
1188 error ("No selected frame.");
1189
1190 frame = get_prev_frame (selected_frame);
1191 if (frame == 0)
1192 error ("\"finish\" not meaningful in the outermost frame.");
1193
1194 clear_proceed_status ();
1195
1196 sal = find_pc_line (frame->pc, 0);
1197 sal.pc = frame->pc;
1198
1199 breakpoint = set_momentary_breakpoint (sal, frame, bp_finish);
1200
6426a772 1201 if (!event_loop_p || !target_can_async_p ())
4d6140d9 1202 old_chain = make_cleanup_delete_breakpoint (breakpoint);
43ff13b4 1203 else
4d6140d9 1204 old_chain = make_exec_cleanup_delete_breakpoint (breakpoint);
c906108c
SS
1205
1206 /* Find the function we will return from. */
1207
1208 function = find_pc_function (selected_frame->pc);
1209
1210 /* Print info on the selected frame, including level number
1211 but not source. */
1212 if (from_tty)
1213 {
1214 printf_filtered ("Run till exit from ");
1215 print_stack_frame (selected_frame, selected_frame_level, 0);
1216 }
1217
43ff13b4
JM
1218 /* If running asynchronously and the target support asynchronous
1219 execution, set things up for the rest of the finish command to be
1220 completed later on, when gdb has detected that the target has
1221 stopped, in fetch_inferior_event. */
6426a772 1222 if (event_loop_p && target_can_async_p ())
43ff13b4 1223 {
c5aa993b 1224 arg1 =
43ff13b4 1225 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
c5aa993b 1226 arg2 =
43ff13b4 1227 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
0d06e24b
JM
1228 arg3 =
1229 (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
43ff13b4 1230 arg1->next = arg2;
0d06e24b
JM
1231 arg2->next = arg3;
1232 arg3->next = NULL;
57e687d9
MS
1233 arg1->data.pointer = breakpoint;
1234 arg2->data.pointer = function;
1235 arg3->data.pointer = old_chain;
43ff13b4
JM
1236 add_continuation (finish_command_continuation, arg1);
1237 }
1238
c5aa993b 1239 proceed_to_finish = 1; /* We want stop_registers, please... */
2acceee2 1240 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
c906108c 1241
43ff13b4
JM
1242 /* Do this only if not running asynchronously or if the target
1243 cannot do async execution. Otherwise, complete this command when
c5aa993b 1244 the target actually stops, in fetch_inferior_event. */
6426a772 1245 if (!event_loop_p || !target_can_async_p ())
c5aa993b
JM
1246 {
1247
1248 /* Did we stop at our breakpoint? */
1249 if (bpstat_find_breakpoint (stop_bpstat, breakpoint) != NULL
1250 && function != 0)
1251 {
1252 struct type *value_type;
c5aa993b
JM
1253 CORE_ADDR funcaddr;
1254 int struct_return;
1255
1256 value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function));
1257 if (!value_type)
96baa820 1258 internal_error ("finish_command: function has no target type");
c5aa993b
JM
1259
1260 /* FIXME: Shouldn't we do the cleanups before returning? */
1261 if (TYPE_CODE (value_type) == TYPE_CODE_VOID)
1262 return;
1263
1264 funcaddr = BLOCK_START (SYMBOL_BLOCK_VALUE (function));
1265
1266 struct_return =
1267 using_struct_return (value_of_variable (function, NULL),
1268 funcaddr,
1269 check_typedef (value_type),
1270 BLOCK_GCC_COMPILED (SYMBOL_BLOCK_VALUE (function)));
1271
11cf8741 1272 print_return_value (struct_return, value_type);
c5aa993b
JM
1273 }
1274 do_cleanups (old_chain);
1275 }
c906108c
SS
1276}
1277\f
1278/* ARGSUSED */
1279static void
1280program_info (args, from_tty)
c5aa993b
JM
1281 char *args;
1282 int from_tty;
c906108c
SS
1283{
1284 bpstat bs = stop_bpstat;
1285 int num = bpstat_num (&bs);
c5aa993b 1286
c906108c
SS
1287 if (!target_has_execution)
1288 {
1289 printf_filtered ("The program being debugged is not being run.\n");
1290 return;
1291 }
1292
1293 target_files_info ();
1294 printf_filtered ("Program stopped at %s.\n",
c5aa993b 1295 local_hex_string ((unsigned long) stop_pc));
c906108c
SS
1296 if (stop_step)
1297 printf_filtered ("It stopped after being stepped.\n");
1298 else if (num != 0)
1299 {
1300 /* There may be several breakpoints in the same place, so this
c5aa993b 1301 isn't as strange as it seems. */
c906108c
SS
1302 while (num != 0)
1303 {
1304 if (num < 0)
1305 {
1306 printf_filtered ("It stopped at a breakpoint that has ");
1307 printf_filtered ("since been deleted.\n");
1308 }
1309 else
1310 printf_filtered ("It stopped at breakpoint %d.\n", num);
1311 num = bpstat_num (&bs);
1312 }
1313 }
1314 else if (stop_signal != TARGET_SIGNAL_0)
1315 {
1316 printf_filtered ("It stopped with signal %s, %s.\n",
1317 target_signal_to_name (stop_signal),
1318 target_signal_to_string (stop_signal));
1319 }
1320
1321 if (!from_tty)
1322 {
1323 printf_filtered ("Type \"info stack\" or \"info registers\" ");
1324 printf_filtered ("for more information.\n");
1325 }
1326}
1327\f
1328static void
1329environment_info (var, from_tty)
1330 char *var;
1331 int from_tty;
1332{
1333 if (var)
1334 {
1335 register char *val = get_in_environ (inferior_environ, var);
1336 if (val)
1337 {
1338 puts_filtered (var);
1339 puts_filtered (" = ");
1340 puts_filtered (val);
1341 puts_filtered ("\n");
1342 }
1343 else
1344 {
1345 puts_filtered ("Environment variable \"");
1346 puts_filtered (var);
1347 puts_filtered ("\" not defined.\n");
1348 }
1349 }
1350 else
1351 {
1352 register char **vector = environ_vector (inferior_environ);
1353 while (*vector)
1354 {
1355 puts_filtered (*vector++);
1356 puts_filtered ("\n");
1357 }
1358 }
1359}
1360
1361static void
1362set_environment_command (arg, from_tty)
1363 char *arg;
1364 int from_tty;
1365{
1366 register char *p, *val, *var;
1367 int nullset = 0;
1368
1369 if (arg == 0)
1370 error_no_arg ("environment variable and value");
1371
1372 /* Find seperation between variable name and value */
1373 p = (char *) strchr (arg, '=');
1374 val = (char *) strchr (arg, ' ');
1375
1376 if (p != 0 && val != 0)
1377 {
1378 /* We have both a space and an equals. If the space is before the
c5aa993b
JM
1379 equals, walk forward over the spaces til we see a nonspace
1380 (possibly the equals). */
c906108c
SS
1381 if (p > val)
1382 while (*val == ' ')
1383 val++;
1384
1385 /* Now if the = is after the char following the spaces,
c5aa993b 1386 take the char following the spaces. */
c906108c
SS
1387 if (p > val)
1388 p = val - 1;
1389 }
1390 else if (val != 0 && p == 0)
1391 p = val;
1392
1393 if (p == arg)
1394 error_no_arg ("environment variable to set");
1395
1396 if (p == 0 || p[1] == 0)
1397 {
1398 nullset = 1;
1399 if (p == 0)
1400 p = arg + strlen (arg); /* So that savestring below will work */
1401 }
1402 else
1403 {
1404 /* Not setting variable value to null */
1405 val = p + 1;
1406 while (*val == ' ' || *val == '\t')
1407 val++;
1408 }
1409
c5aa993b
JM
1410 while (p != arg && (p[-1] == ' ' || p[-1] == '\t'))
1411 p--;
c906108c
SS
1412
1413 var = savestring (arg, p - arg);
1414 if (nullset)
1415 {
1416 printf_filtered ("Setting environment variable ");
1417 printf_filtered ("\"%s\" to null value.\n", var);
1418 set_in_environ (inferior_environ, var, "");
1419 }
1420 else
1421 set_in_environ (inferior_environ, var, val);
1422 free (var);
1423}
1424
1425static void
1426unset_environment_command (var, from_tty)
1427 char *var;
1428 int from_tty;
1429{
1430 if (var == 0)
1431 {
1432 /* If there is no argument, delete all environment variables.
c5aa993b 1433 Ask for confirmation if reading from the terminal. */
c906108c
SS
1434 if (!from_tty || query ("Delete all environment variables? "))
1435 {
1436 free_environ (inferior_environ);
1437 inferior_environ = make_environ ();
1438 }
1439 }
1440 else
1441 unset_in_environ (inferior_environ, var);
1442}
1443
1444/* Handle the execution path (PATH variable) */
1445
1446static const char path_var_name[] = "PATH";
1447
1448/* ARGSUSED */
1449static void
1450path_info (args, from_tty)
1451 char *args;
1452 int from_tty;
1453{
1454 puts_filtered ("Executable and object file path: ");
1455 puts_filtered (get_in_environ (inferior_environ, path_var_name));
1456 puts_filtered ("\n");
1457}
1458
1459/* Add zero or more directories to the front of the execution path. */
1460
1461static void
1462path_command (dirname, from_tty)
1463 char *dirname;
1464 int from_tty;
1465{
1466 char *exec_path;
1467 char *env;
1468 dont_repeat ();
1469 env = get_in_environ (inferior_environ, path_var_name);
1470 /* Can be null if path is not set */
1471 if (!env)
1472 env = "";
1473 exec_path = strsave (env);
1474 mod_path (dirname, &exec_path);
1475 set_in_environ (inferior_environ, path_var_name, exec_path);
1476 free (exec_path);
1477 if (from_tty)
c5aa993b 1478 path_info ((char *) NULL, from_tty);
c906108c 1479}
c906108c 1480\f
c5aa993b 1481
c906108c
SS
1482#ifdef REGISTER_NAMES
1483char *gdb_register_names[] = REGISTER_NAMES;
1484#endif
1485/* Print out the machine register regnum. If regnum is -1,
1486 print all registers (fpregs == 1) or all non-float registers
1487 (fpregs == 0).
1488
1489 For most machines, having all_registers_info() print the
1490 register(s) one per line is good enough. If a different format
1491 is required, (eg, for MIPS or Pyramid 90x, which both have
1492 lots of regs), or there is an existing convention for showing
1493 all the registers, define the macro DO_REGISTERS_INFO(regnum, fp)
c5aa993b 1494 to provide that format. */
c906108c
SS
1495
1496#if !defined (DO_REGISTERS_INFO)
1497
1498#define DO_REGISTERS_INFO(regnum, fp) do_registers_info(regnum, fp)
1499
1500static void
1501do_registers_info (regnum, fpregs)
1502 int regnum;
1503 int fpregs;
1504{
1505 register int i;
1506 int numregs = ARCH_NUM_REGS;
1507
1508 for (i = 0; i < numregs; i++)
1509 {
1510 char raw_buffer[MAX_REGISTER_RAW_SIZE];
1511 char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
1512
1513 /* Decide between printing all regs, nonfloat regs, or specific reg. */
c5aa993b
JM
1514 if (regnum == -1)
1515 {
1516 if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT && !fpregs)
1517 continue;
1518 }
1519 else
1520 {
1521 if (i != regnum)
1522 continue;
1523 }
c906108c
SS
1524
1525 /* If the register name is empty, it is undefined for this
c5aa993b 1526 processor, so don't display anything. */
c906108c
SS
1527 if (REGISTER_NAME (i) == NULL || *(REGISTER_NAME (i)) == '\0')
1528 continue;
1529
1530 fputs_filtered (REGISTER_NAME (i), gdb_stdout);
1531 print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), gdb_stdout);
1532
1533 /* Get the data in raw format. */
1534 if (read_relative_register_raw_bytes (i, raw_buffer))
1535 {
1536 printf_filtered ("*value not available*\n");
1537 continue;
1538 }
1539
1540 /* Convert raw data to virtual format if necessary. */
c906108c
SS
1541 if (REGISTER_CONVERTIBLE (i))
1542 {
1543 REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i),
1544 raw_buffer, virtual_buffer);
1545 }
1546 else
392a587b
JM
1547 {
1548 memcpy (virtual_buffer, raw_buffer,
1549 REGISTER_VIRTUAL_SIZE (i));
1550 }
c906108c
SS
1551
1552 /* If virtual format is floating, print it that way, and in raw hex. */
1553 if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
1554 {
1555 register int j;
1556
1557#ifdef INVALID_FLOAT
1558 if (INVALID_FLOAT (virtual_buffer, REGISTER_VIRTUAL_SIZE (i)))
1559 printf_filtered ("<invalid float>");
1560 else
1561#endif
1562 val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
1563 gdb_stdout, 0, 1, 0, Val_pretty_default);
1564
1565 printf_filtered ("\t(raw 0x");
1566 for (j = 0; j < REGISTER_RAW_SIZE (i); j++)
1567 {
1568 register int idx = TARGET_BYTE_ORDER == BIG_ENDIAN ? j
c5aa993b
JM
1569 : REGISTER_RAW_SIZE (i) - 1 - j;
1570 printf_filtered ("%02x", (unsigned char) raw_buffer[idx]);
c906108c
SS
1571 }
1572 printf_filtered (")");
1573 }
1574
1575/* FIXME! val_print probably can handle all of these cases now... */
1576
1577 /* Else if virtual format is too long for printf,
c5aa993b 1578 print in hex a byte at a time. */
c906108c
SS
1579 else if (REGISTER_VIRTUAL_SIZE (i) > (int) sizeof (long))
1580 {
1581 register int j;
1582 printf_filtered ("0x");
1583 for (j = 0; j < REGISTER_VIRTUAL_SIZE (i); j++)
c5aa993b 1584 printf_filtered ("%02x", (unsigned char) virtual_buffer[j]);
c906108c
SS
1585 }
1586 /* Else print as integer in hex and in decimal. */
1587 else
1588 {
1589 val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
1590 gdb_stdout, 'x', 1, 0, Val_pretty_default);
1591 printf_filtered ("\t");
1592 val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0,
c5aa993b 1593 gdb_stdout, 0, 1, 0, Val_pretty_default);
c906108c
SS
1594 }
1595
1596 /* The SPARC wants to print even-numbered float regs as doubles
c5aa993b 1597 in addition to printing them as floats. */
c906108c
SS
1598#ifdef PRINT_REGISTER_HOOK
1599 PRINT_REGISTER_HOOK (i);
1600#endif
1601
1602 printf_filtered ("\n");
1603 }
1604}
1605#endif /* no DO_REGISTERS_INFO. */
1606
c906108c
SS
1607void
1608registers_info (addr_exp, fpregs)
1609 char *addr_exp;
1610 int fpregs;
1611{
1612 int regnum, numregs;
1613 register char *end;
1614
1615 if (!target_has_registers)
1616 error ("The program has no registers now.");
1617 if (selected_frame == NULL)
1618 error ("No selected frame.");
1619
1620 if (!addr_exp)
1621 {
c5aa993b 1622 DO_REGISTERS_INFO (-1, fpregs);
c906108c
SS
1623 return;
1624 }
1625
1626 do
c5aa993b 1627 {
c906108c
SS
1628 if (addr_exp[0] == '$')
1629 addr_exp++;
1630 end = addr_exp;
1631 while (*end != '\0' && *end != ' ' && *end != '\t')
1632 ++end;
1633 numregs = ARCH_NUM_REGS;
1634
1635 regnum = target_map_name_to_register (addr_exp, end - addr_exp);
c5aa993b 1636 if (regnum >= 0)
c906108c
SS
1637 goto found;
1638
1639 regnum = numregs;
1640
1641 if (*addr_exp >= '0' && *addr_exp <= '9')
c5aa993b
JM
1642 regnum = atoi (addr_exp); /* Take a number */
1643 if (regnum >= numregs) /* Bad name, or bad number */
c906108c
SS
1644 error ("%.*s: invalid register", end - addr_exp, addr_exp);
1645
c5aa993b
JM
1646 found:
1647 DO_REGISTERS_INFO (regnum, fpregs);
c906108c
SS
1648
1649 addr_exp = end;
1650 while (*addr_exp == ' ' || *addr_exp == '\t')
1651 ++addr_exp;
c5aa993b
JM
1652 }
1653 while (*addr_exp != '\0');
c906108c
SS
1654}
1655
1656void
1657all_registers_info (addr_exp, from_tty)
1658 char *addr_exp;
1659 int from_tty;
1660{
1661 registers_info (addr_exp, 1);
1662}
1663
1664void
1665nofp_registers_info (addr_exp, from_tty)
1666 char *addr_exp;
1667 int from_tty;
1668{
1669 registers_info (addr_exp, 0);
1670}
c906108c 1671\f
c5aa993b 1672
c906108c
SS
1673/*
1674 * TODO:
1675 * Should save/restore the tty state since it might be that the
1676 * program to be debugged was started on this tty and it wants
1677 * the tty in some state other than what we want. If it's running
1678 * on another terminal or without a terminal, then saving and
1679 * restoring the tty state is a harmless no-op.
1680 * This only needs to be done if we are attaching to a process.
1681 */
1682
1683/*
1684 attach_command --
1685 takes a program started up outside of gdb and ``attaches'' to it.
1686 This stops it cold in its tracks and allows us to start debugging it.
1687 and wait for the trace-trap that results from attaching. */
1688
1689void
1690attach_command (args, from_tty)
1691 char *args;
1692 int from_tty;
1693{
1694#ifdef SOLIB_ADD
1695 extern int auto_solib_add;
1696#endif
1697
c5aa993b
JM
1698 char *exec_file;
1699 char *full_exec_path = NULL;
c906108c 1700
c5aa993b 1701 dont_repeat (); /* Not for the faint of heart */
c906108c
SS
1702
1703 if (target_has_execution)
1704 {
1705 if (query ("A program is being debugged already. Kill it? "))
1706 target_kill ();
1707 else
1708 error ("Not killed.");
1709 }
1710
1711 target_attach (args, from_tty);
1712
1713 /* Set up the "saved terminal modes" of the inferior
1714 based on what modes we are starting it with. */
1715 target_terminal_init ();
1716
1717 /* Install inferior's terminal modes. */
1718 target_terminal_inferior ();
1719
1720 /* Set up execution context to know that we should return from
1721 wait_for_inferior as soon as the target reports a stop. */
1722 init_wait_for_inferior ();
1723 clear_proceed_status ();
1724 stop_soon_quietly = 1;
1725
1726 /* No traps are generated when attaching to inferior under Mach 3
1727 or GNU hurd. */
1728#ifndef ATTACH_NO_WAIT
1729 wait_for_inferior ();
1730#endif
1731
1732 /*
1733 * If no exec file is yet known, try to determine it from the
1734 * process itself.
1735 */
1736 exec_file = (char *) get_exec_file (0);
c5aa993b
JM
1737 if (!exec_file)
1738 {
1739 exec_file = target_pid_to_exec_file (inferior_pid);
1740 if (exec_file)
1741 {
1742 /* It's possible we don't have a full path, but rather just a
1743 filename. Some targets, such as HP-UX, don't provide the
1744 full path, sigh.
1745
1746 Attempt to qualify the filename against the source path.
1747 (If that fails, we'll just fall back on the original
1748 filename. Not much more we can do...)
1749 */
1750 if (!source_full_path_of (exec_file, &full_exec_path))
1751 full_exec_path = savestring (exec_file, strlen (exec_file));
1752
1753 exec_file_attach (full_exec_path, from_tty);
1754 symbol_file_command (full_exec_path, from_tty);
1755 }
c906108c 1756 }
c906108c
SS
1757
1758#ifdef SOLIB_ADD
1759 if (auto_solib_add)
1760 {
1761 /* Add shared library symbols from the newly attached process, if any. */
c5aa993b 1762 SOLIB_ADD ((char *) 0, from_tty, &current_target);
c906108c
SS
1763 re_enable_breakpoints_in_shlibs ();
1764 }
1765#endif
1766
1767 /* Take any necessary post-attaching actions for this platform.
c5aa993b 1768 */
c906108c
SS
1769 target_post_attach (inferior_pid);
1770
1771 normal_stop ();
6426a772
JM
1772
1773 if (attach_hook)
1774 attach_hook ();
c906108c
SS
1775}
1776
1777/*
1778 * detach_command --
1779 * takes a program previously attached to and detaches it.
1780 * The program resumes execution and will no longer stop
1781 * on signals, etc. We better not have left any breakpoints
1782 * in the program or it'll die when it hits one. For this
1783 * to work, it may be necessary for the process to have been
1784 * previously attached. It *might* work if the program was
1785 * started via the normal ptrace (PTRACE_TRACEME).
1786 */
1787
1788static void
1789detach_command (args, from_tty)
1790 char *args;
1791 int from_tty;
1792{
c5aa993b 1793 dont_repeat (); /* Not for the faint of heart */
c906108c
SS
1794 target_detach (args, from_tty);
1795#if defined(SOLIB_RESTART)
1796 SOLIB_RESTART ();
1797#endif
6426a772
JM
1798 if (detach_hook)
1799 detach_hook ();
c906108c
SS
1800}
1801
43ff13b4
JM
1802/* Stop the execution of the target while running in async mode, in
1803 the backgound. */
8b93c638
JM
1804#ifdef UI_OUT
1805void
1806interrupt_target_command_wrapper (args, from_tty)
1807 char *args;
1808 int from_tty;
1809{
1810 interrupt_target_command (args, from_tty);
1811}
1812#endif
43ff13b4
JM
1813static void
1814interrupt_target_command (args, from_tty)
1815 char *args;
1816 int from_tty;
1817{
6426a772 1818 if (event_loop_p && target_can_async_p ())
43ff13b4 1819 {
c5aa993b 1820 dont_repeat (); /* Not for the faint of heart */
43ff13b4
JM
1821 target_stop ();
1822 }
1823}
1824
c906108c
SS
1825/* ARGSUSED */
1826static void
1827float_info (addr_exp, from_tty)
1828 char *addr_exp;
1829 int from_tty;
1830{
1831#ifdef FLOAT_INFO
1832 FLOAT_INFO;
1833#else
1834 printf_filtered ("No floating point info available for this processor.\n");
1835#endif
1836}
1837\f
1838/* ARGSUSED */
1839static void
1840unset_command (args, from_tty)
1841 char *args;
1842 int from_tty;
1843{
1844 printf_filtered ("\"unset\" must be followed by the name of ");
1845 printf_filtered ("an unset subcommand.\n");
1846 help_list (unsetlist, "unset ", -1, gdb_stdout);
1847}
1848
1849void
1850_initialize_infcmd ()
1851{
1852 struct cmd_list_element *c;
c5aa993b 1853
c906108c
SS
1854 add_com ("tty", class_run, tty_command,
1855 "Set terminal for future runs of program being debugged.");
1856
1857 add_show_from_set
c5aa993b
JM
1858 (add_set_cmd ("args", class_run, var_string_noescape,
1859 (char *) &inferior_args,
1860 "Set argument list to give program being debugged when it is started.\n\
c906108c
SS
1861Follow this command with any number of args, to be passed to the program.",
1862 &setlist),
1863 &showlist);
1864
1865 c = add_cmd
1866 ("environment", no_class, environment_info,
1867 "The environment to give the program, or one variable's value.\n\
1868With an argument VAR, prints the value of environment variable VAR to\n\
1869give the program being debugged. With no arguments, prints the entire\n\
1870environment to be given to the program.", &showlist);
1871 c->completer = noop_completer;
1872
1873 add_prefix_cmd ("unset", no_class, unset_command,
1874 "Complement to certain \"set\" commands",
1875 &unsetlist, "unset ", 0, &cmdlist);
c5aa993b 1876
c906108c 1877 c = add_cmd ("environment", class_run, unset_environment_command,
c5aa993b 1878 "Cancel environment variable VAR for the program.\n\
c906108c 1879This does not affect the program until the next \"run\" command.",
c5aa993b 1880 &unsetlist);
c906108c
SS
1881 c->completer = noop_completer;
1882
1883 c = add_cmd ("environment", class_run, set_environment_command,
1884 "Set environment variable value to give the program.\n\
1885Arguments are VAR VALUE where VAR is variable name and VALUE is value.\n\
1886VALUES of environment variables are uninterpreted strings.\n\
1887This does not affect the program until the next \"run\" command.",
c5aa993b 1888 &setlist);
c906108c 1889 c->completer = noop_completer;
c5aa993b 1890
c906108c 1891 add_com ("path", class_files, path_command,
c5aa993b 1892 "Add directory DIR(s) to beginning of search path for object files.\n\
c906108c
SS
1893$cwd in the path means the current working directory.\n\
1894This path is equivalent to the $PATH shell variable. It is a list of\n\
1895directories, separated by colons. These directories are searched to find\n\
1896fully linked executable files and separately compiled object files as needed.");
1897
1898 c = add_cmd ("paths", no_class, path_info,
c5aa993b 1899 "Current search path for finding object files.\n\
c906108c
SS
1900$cwd in the path means the current working directory.\n\
1901This path is equivalent to the $PATH shell variable. It is a list of\n\
1902directories, separated by colons. These directories are searched to find\n\
1903fully linked executable files and separately compiled object files as needed.",
1904 &showlist);
1905 c->completer = noop_completer;
1906
c5aa993b
JM
1907 add_com ("attach", class_run, attach_command,
1908 "Attach to a process or file outside of GDB.\n\
c906108c
SS
1909This command attaches to another target, of the same type as your last\n\
1910\"target\" command (\"info files\" will show your target stack).\n\
1911The command may take as argument a process id or a device file.\n\
1912For a process id, you must have permission to send the process a signal,\n\
1913and it must have the same effective uid as the debugger.\n\
1914When using \"attach\" with a process id, the debugger finds the\n\
1915program running in the process, looking first in the current working\n\
1916directory, or (if not found there) using the source file search path\n\
1917(see the \"directory\" command). You can also use the \"file\" command\n\
1918to specify the program, and to load its symbol table.");
1919
1920 add_com ("detach", class_run, detach_command,
1921 "Detach a process or file previously attached.\n\
1922If a process, it is no longer traced, and it continues its execution. If\n\
1923you were debugging a file, the file is closed and gdb no longer accesses it.");
1924
1925 add_com ("signal", class_run, signal_command,
1926 "Continue program giving it signal specified by the argument.\n\
1927An argument of \"0\" means continue program without giving it a signal.");
1928
1929 add_com ("stepi", class_run, stepi_command,
1930 "Step one instruction exactly.\n\
1931Argument N means do this N times (or till program stops for another reason).");
1932 add_com_alias ("si", "stepi", class_alias, 0);
1933
1934 add_com ("nexti", class_run, nexti_command,
1935 "Step one instruction, but proceed through subroutine calls.\n\
1936Argument N means do this N times (or till program stops for another reason).");
1937 add_com_alias ("ni", "nexti", class_alias, 0);
1938
1939 add_com ("finish", class_run, finish_command,
1940 "Execute until selected stack frame returns.\n\
1941Upon return, the value returned is printed and put in the value history.");
1942
1943 add_com ("next", class_run, next_command,
1944 "Step program, proceeding through subroutine calls.\n\
1945Like the \"step\" command as long as subroutine calls do not happen;\n\
1946when they do, the call is treated as one instruction.\n\
1947Argument N means do this N times (or till program stops for another reason).");
1948 add_com_alias ("n", "next", class_run, 1);
1949 if (xdb_commands)
c5aa993b 1950 add_com_alias ("S", "next", class_run, 1);
c906108c
SS
1951
1952 add_com ("step", class_run, step_command,
1953 "Step program until it reaches a different source line.\n\
1954Argument N means do this N times (or till program stops for another reason).");
1955 add_com_alias ("s", "step", class_run, 1);
1956
1957 add_com ("until", class_run, until_command,
c5aa993b 1958 "Execute until the program reaches a source line greater than the current\n\
c906108c
SS
1959or a specified line or address or function (same args as break command).\n\
1960Execution will also stop upon exit from the current stack frame.");
1961 add_com_alias ("u", "until", class_run, 1);
c5aa993b 1962
c906108c
SS
1963 add_com ("jump", class_run, jump_command,
1964 "Continue program being debugged at specified line or address.\n\
1965Give as argument either LINENUM or *ADDR, where ADDR is an expression\n\
1966for an address to start at.");
1967
b83266a0
SS
1968 if (xdb_commands)
1969 add_com ("go", class_run, go_command,
1970 "Usage: go <location>\n\
c906108c
SS
1971Continue program being debugged, stopping at specified line or \n\
1972address.\n\
1973Give as argument either LINENUM or *ADDR, where ADDR is an \n\
1974expression for an address to start at.\n\
1975This command is a combination of tbreak and jump.");
b83266a0 1976
c906108c 1977 if (xdb_commands)
c5aa993b 1978 add_com_alias ("g", "go", class_run, 1);
c906108c
SS
1979
1980 add_com ("continue", class_run, continue_command,
1981 "Continue program being debugged, after signal or breakpoint.\n\
1982If proceeding from breakpoint, a number N may be used as an argument,\n\
1983which means to set the ignore count of that breakpoint to N - 1 (so that\n\
1984the breakpoint won't break until the Nth time it is reached).");
1985 add_com_alias ("c", "cont", class_run, 1);
1986 add_com_alias ("fg", "cont", class_run, 1);
1987
1988 add_com ("run", class_run, run_command,
1989 "Start debugged program. You may specify arguments to give it.\n\
1990Args may include \"*\", or \"[...]\"; they are expanded using \"sh\".\n\
1991Input and output redirection with \">\", \"<\", or \">>\" are also allowed.\n\n\
1992With no arguments, uses arguments last specified (with \"run\" or \"set args\").\n\
1993To cancel previous arguments and run with no arguments,\n\
1994use \"set args\" without arguments.");
1995 add_com_alias ("r", "run", class_run, 1);
1996 if (xdb_commands)
1997 add_com ("R", class_run, run_no_args_command,
c5aa993b 1998 "Start debugged program with no arguments.");
c906108c 1999
43ff13b4
JM
2000 add_com ("interrupt", class_run, interrupt_target_command,
2001 "Interrupt the execution of the debugged program.");
2002
c906108c 2003 add_info ("registers", nofp_registers_info,
c5aa993b 2004 "List of integer registers and their contents, for selected stack frame.\n\
c906108c 2005Register name as argument means describe only that register.");
7194c49b 2006 add_info_alias ("r", "registers", 1);
c906108c
SS
2007
2008 if (xdb_commands)
c5aa993b
JM
2009 add_com ("lr", class_info, nofp_registers_info,
2010 "List of integer registers and their contents, for selected stack frame.\n\
c906108c
SS
2011 Register name as argument means describe only that register.");
2012 add_info ("all-registers", all_registers_info,
c5aa993b 2013 "List of all registers and their contents, for selected stack frame.\n\
c906108c
SS
2014Register name as argument means describe only that register.");
2015
2016 add_info ("program", program_info,
2017 "Execution status of the program.");
2018
2019 add_info ("float", float_info,
2020 "Print the status of the floating point unit\n");
2021
2022 inferior_args = savestring ("", 1); /* Initially no args */
2023 inferior_environ = make_environ ();
2024 init_environ (inferior_environ);
2025}
This page took 0.142066 seconds and 4 git commands to generate.