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