4baeebabf889804d8b4b5b1a94c2d9f7743a1eb9
[deliverable/binutils-gdb.git] / gdb / infcmd.c
1 /* Memory-access and commands for "inferior" process, for GDB.
2
3 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
4 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
5 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
6
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21
22 #include "defs.h"
23 #include "arch-utils.h"
24 #include <signal.h>
25 #include "gdb_string.h"
26 #include "symtab.h"
27 #include "gdbtypes.h"
28 #include "frame.h"
29 #include "inferior.h"
30 #include "environ.h"
31 #include "value.h"
32 #include "gdbcmd.h"
33 #include "symfile.h"
34 #include "gdbcore.h"
35 #include "target.h"
36 #include "language.h"
37 #include "symfile.h"
38 #include "objfiles.h"
39 #include "completer.h"
40 #include "ui-out.h"
41 #include "event-top.h"
42 #include "parser-defs.h"
43 #include "regcache.h"
44 #include "reggroups.h"
45 #include "block.h"
46 #include "solib.h"
47 #include <ctype.h>
48 #include "gdb_assert.h"
49 #include "observer.h"
50 #include "target-descriptions.h"
51 #include "user-regs.h"
52 #include "exceptions.h"
53 #include "cli/cli-decode.h"
54 #include "gdbthread.h"
55 #include "valprint.h"
56 #include "inline-frame.h"
57 #include "tracepoint.h"
58 #include "inf-loop.h"
59
60 /* Functions exported for general use, in inferior.h: */
61
62 void all_registers_info (char *, int);
63
64 void registers_info (char *, int);
65
66 void nexti_command (char *, int);
67
68 void stepi_command (char *, int);
69
70 void continue_command (char *, int);
71
72 void interrupt_target_command (char *args, int from_tty);
73
74 /* Local functions: */
75
76 static void nofp_registers_info (char *, int);
77
78 static void print_return_value (struct type *func_type,
79 struct type *value_type);
80
81 static void until_next_command (int);
82
83 static void until_command (char *, int);
84
85 static void path_info (char *, int);
86
87 static void path_command (char *, int);
88
89 static void unset_command (char *, int);
90
91 static void float_info (char *, int);
92
93 static void disconnect_command (char *, int);
94
95 static void unset_environment_command (char *, int);
96
97 static void set_environment_command (char *, int);
98
99 static void environment_info (char *, int);
100
101 static void program_info (char *, int);
102
103 static void finish_command (char *, int);
104
105 static void signal_command (char *, int);
106
107 static void jump_command (char *, int);
108
109 static void step_1 (int, int, char *);
110 static void step_once (int skip_subroutines, int single_inst,
111 int count, int thread);
112
113 static void next_command (char *, int);
114
115 static void step_command (char *, int);
116
117 static void run_command (char *, int);
118
119 static void run_no_args_command (char *args, int from_tty);
120
121 static void go_command (char *line_no, int from_tty);
122
123 static int strip_bg_char (char **);
124
125 void _initialize_infcmd (void);
126
127 #define ERROR_NO_INFERIOR \
128 if (!target_has_execution) error (_("The program is not being run."));
129
130 /* Scratch area where string containing arguments to give to the
131 program will be stored by 'set args'. As soon as anything is
132 stored, notice_args_set will move it into per-inferior storage.
133 Arguments are separated by spaces. Empty string (pointer to '\0')
134 means no args. */
135
136 static char *inferior_args_scratch;
137
138 /* Scratch area where 'set inferior-tty' will store user-provided value.
139 We'll immediate copy it into per-inferior storage. */
140
141 static char *inferior_io_terminal_scratch;
142
143 /* Pid of our debugged inferior, or 0 if no inferior now.
144 Since various parts of infrun.c test this to see whether there is a program
145 being debugged it should be nonzero (currently 3 is used) for remote
146 debugging. */
147
148 ptid_t inferior_ptid;
149
150 /* Address at which inferior stopped. */
151
152 CORE_ADDR stop_pc;
153
154 /* Flag indicating that a command has proceeded the inferior past the
155 current breakpoint. */
156
157 int breakpoint_proceeded;
158
159 /* Nonzero if stopped due to completion of a stack dummy routine. */
160
161 enum stop_stack_kind stop_stack_dummy;
162
163 /* Nonzero if stopped due to a random (unexpected) signal in inferior
164 process. */
165
166 int stopped_by_random_signal;
167
168 \f
169 /* Accessor routines. */
170
171 /* Set the io terminal for the current inferior. Ownership of
172 TERMINAL_NAME is not transferred. */
173
174 void
175 set_inferior_io_terminal (const char *terminal_name)
176 {
177 xfree (current_inferior ()->terminal);
178 current_inferior ()->terminal = terminal_name ? xstrdup (terminal_name) : 0;
179 }
180
181 const char *
182 get_inferior_io_terminal (void)
183 {
184 return current_inferior ()->terminal;
185 }
186
187 static void
188 set_inferior_tty_command (char *args, int from_tty,
189 struct cmd_list_element *c)
190 {
191 /* CLI has assigned the user-provided value to inferior_io_terminal_scratch.
192 Now route it to current inferior. */
193 set_inferior_io_terminal (inferior_io_terminal_scratch);
194 }
195
196 static void
197 show_inferior_tty_command (struct ui_file *file, int from_tty,
198 struct cmd_list_element *c, const char *value)
199 {
200 /* Note that we ignore the passed-in value in favor of computing it
201 directly. */
202 const char *inferior_io_terminal = get_inferior_io_terminal ();
203
204 if (inferior_io_terminal == NULL)
205 inferior_io_terminal = "";
206 fprintf_filtered (gdb_stdout,
207 _("Terminal for future runs of program being debugged "
208 "is \"%s\".\n"), inferior_io_terminal);
209 }
210
211 char *
212 get_inferior_args (void)
213 {
214 if (current_inferior ()->argc != 0)
215 {
216 char *n;
217
218 n = construct_inferior_arguments (current_inferior ()->argc,
219 current_inferior ()->argv);
220 set_inferior_args (n);
221 xfree (n);
222 }
223
224 if (current_inferior ()->args == NULL)
225 current_inferior ()->args = xstrdup ("");
226
227 return current_inferior ()->args;
228 }
229
230 /* Set the arguments for the current inferior. Ownership of
231 NEWARGS is not transferred. */
232
233 void
234 set_inferior_args (char *newargs)
235 {
236 xfree (current_inferior ()->args);
237 current_inferior ()->args = newargs ? xstrdup (newargs) : NULL;
238 current_inferior ()->argc = 0;
239 current_inferior ()->argv = 0;
240 }
241
242 void
243 set_inferior_args_vector (int argc, char **argv)
244 {
245 current_inferior ()->argc = argc;
246 current_inferior ()->argv = argv;
247 }
248
249 /* Notice when `set args' is run. */
250 static void
251 set_args_command (char *args, int from_tty, struct cmd_list_element *c)
252 {
253 /* CLI has assigned the user-provided value to inferior_args_scratch.
254 Now route it to current inferior. */
255 set_inferior_args (inferior_args_scratch);
256 }
257
258 /* Notice when `show args' is run. */
259 static void
260 show_args_command (struct ui_file *file, int from_tty,
261 struct cmd_list_element *c, const char *value)
262 {
263 /* Note that we ignore the passed-in value in favor of computing it
264 directly. */
265 deprecated_show_value_hack (file, from_tty, c, get_inferior_args ());
266 }
267
268 \f
269 /* Compute command-line string given argument vector. This does the
270 same shell processing as fork_inferior. */
271 char *
272 construct_inferior_arguments (int argc, char **argv)
273 {
274 char *result;
275
276 if (STARTUP_WITH_SHELL)
277 {
278 /* This holds all the characters considered special to the
279 typical Unix shells. We include `^' because the SunOS
280 /bin/sh treats it as a synonym for `|'. */
281 char *special = "\"!#$&*()\\|[]{}<>?'\"`~^; \t\n";
282 int i;
283 int length = 0;
284 char *out, *cp;
285
286 /* We over-compute the size. It shouldn't matter. */
287 for (i = 0; i < argc; ++i)
288 length += 3 * strlen (argv[i]) + 1 + 2 * (argv[i][0] == '\0');
289
290 result = (char *) xmalloc (length);
291 out = result;
292
293 for (i = 0; i < argc; ++i)
294 {
295 if (i > 0)
296 *out++ = ' ';
297
298 /* Need to handle empty arguments specially. */
299 if (argv[i][0] == '\0')
300 {
301 *out++ = '\'';
302 *out++ = '\'';
303 }
304 else
305 {
306 for (cp = argv[i]; *cp; ++cp)
307 {
308 if (*cp == '\n')
309 {
310 /* A newline cannot be quoted with a backslash (it
311 just disappears), only by putting it inside
312 quotes. */
313 *out++ = '\'';
314 *out++ = '\n';
315 *out++ = '\'';
316 }
317 else
318 {
319 if (strchr (special, *cp) != NULL)
320 *out++ = '\\';
321 *out++ = *cp;
322 }
323 }
324 }
325 }
326 *out = '\0';
327 }
328 else
329 {
330 /* In this case we can't handle arguments that contain spaces,
331 tabs, or newlines -- see breakup_args(). */
332 int i;
333 int length = 0;
334
335 for (i = 0; i < argc; ++i)
336 {
337 char *cp = strchr (argv[i], ' ');
338 if (cp == NULL)
339 cp = strchr (argv[i], '\t');
340 if (cp == NULL)
341 cp = strchr (argv[i], '\n');
342 if (cp != NULL)
343 error (_("can't handle command-line "
344 "argument containing whitespace"));
345 length += strlen (argv[i]) + 1;
346 }
347
348 result = (char *) xmalloc (length);
349 result[0] = '\0';
350 for (i = 0; i < argc; ++i)
351 {
352 if (i > 0)
353 strcat (result, " ");
354 strcat (result, argv[i]);
355 }
356 }
357
358 return result;
359 }
360 \f
361
362 /* This function detects whether or not a '&' character (indicating
363 background execution) has been added as *the last* of the arguments ARGS
364 of a command. If it has, it removes it and returns 1. Otherwise it
365 does nothing and returns 0. */
366 static int
367 strip_bg_char (char **args)
368 {
369 char *p = NULL;
370
371 p = strchr (*args, '&');
372
373 if (p)
374 {
375 if (p == (*args + strlen (*args) - 1))
376 {
377 if (strlen (*args) > 1)
378 {
379 do
380 p--;
381 while (*p == ' ' || *p == '\t');
382 *(p + 1) = '\0';
383 }
384 else
385 *args = 0;
386 return 1;
387 }
388 }
389 return 0;
390 }
391
392 /* Common actions to take after creating any sort of inferior, by any
393 means (running, attaching, connecting, et cetera). The target
394 should be stopped. */
395
396 void
397 post_create_inferior (struct target_ops *target, int from_tty)
398 {
399 volatile struct gdb_exception ex;
400
401 /* Be sure we own the terminal in case write operations are performed. */
402 target_terminal_ours ();
403
404 /* If the target hasn't taken care of this already, do it now.
405 Targets which need to access registers during to_open,
406 to_create_inferior, or to_attach should do it earlier; but many
407 don't need to. */
408 target_find_description ();
409
410 /* Now that we know the register layout, retrieve current PC. But
411 if the PC is unavailable (e.g., we're opening a core file with
412 missing registers info), ignore it. */
413 stop_pc = 0;
414 TRY_CATCH (ex, RETURN_MASK_ERROR)
415 {
416 stop_pc = regcache_read_pc (get_current_regcache ());
417 }
418 if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
419 throw_exception (ex);
420
421 if (exec_bfd)
422 {
423 /* Create the hooks to handle shared library load and unload
424 events. */
425 #ifdef SOLIB_CREATE_INFERIOR_HOOK
426 SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid));
427 #else
428 solib_create_inferior_hook (from_tty);
429 #endif
430 }
431
432 /* If the solist is global across processes, there's no need to
433 refetch it here. */
434 if (exec_bfd && !gdbarch_has_global_solist (target_gdbarch))
435 {
436 /* Sometimes the platform-specific hook loads initial shared
437 libraries, and sometimes it doesn't. If it doesn't FROM_TTY will be
438 incorrectly 0 but such solib targets should be fixed anyway. If we
439 made all the inferior hook methods consistent, this call could be
440 removed. Call it only after the solib target has been initialized by
441 solib_create_inferior_hook. */
442
443 #ifdef SOLIB_ADD
444 SOLIB_ADD (NULL, 0, target, auto_solib_add);
445 #else
446 solib_add (NULL, 0, target, auto_solib_add);
447 #endif
448 }
449
450 /* If the user sets watchpoints before execution having started,
451 then she gets software watchpoints, because GDB can't know which
452 target will end up being pushed, or if it supports hardware
453 watchpoints or not. breakpoint_re_set takes care of promoting
454 watchpoints to hardware watchpoints if possible, however, if this
455 new inferior doesn't load shared libraries or we don't pull in
456 symbols from any other source on this target/arch,
457 breakpoint_re_set is never called. Call it now so that software
458 watchpoints get a chance to be promoted to hardware watchpoints
459 if the now pushed target supports hardware watchpoints. */
460 breakpoint_re_set ();
461
462 observer_notify_inferior_created (target, from_tty);
463 }
464
465 /* Kill the inferior if already running. This function is designed
466 to be called when we are about to start the execution of the program
467 from the beginning. Ask the user to confirm that he wants to restart
468 the program being debugged when FROM_TTY is non-null. */
469
470 static void
471 kill_if_already_running (int from_tty)
472 {
473 if (! ptid_equal (inferior_ptid, null_ptid) && target_has_execution)
474 {
475 /* Bail out before killing the program if we will not be able to
476 restart it. */
477 target_require_runnable ();
478
479 if (from_tty
480 && !query (_("The program being debugged has been started already.\n\
481 Start it from the beginning? ")))
482 error (_("Program not restarted."));
483 target_kill ();
484 }
485 }
486
487 /* Implement the "run" command. If TBREAK_AT_MAIN is set, then insert
488 a temporary breakpoint at the begining of the main program before
489 running the program. */
490
491 static void
492 run_command_1 (char *args, int from_tty, int tbreak_at_main)
493 {
494 char *exec_file;
495 struct cleanup *old_chain;
496 ptid_t ptid;
497
498 dont_repeat ();
499
500 kill_if_already_running (from_tty);
501
502 init_wait_for_inferior ();
503 clear_breakpoint_hit_counts ();
504
505 /* Clean up any leftovers from other runs. Some other things from
506 this function should probably be moved into target_pre_inferior. */
507 target_pre_inferior (from_tty);
508
509 /* The comment here used to read, "The exec file is re-read every
510 time we do a generic_mourn_inferior, so we just have to worry
511 about the symbol file." The `generic_mourn_inferior' function
512 gets called whenever the program exits. However, suppose the
513 program exits, and *then* the executable file changes? We need
514 to check again here. Since reopen_exec_file doesn't do anything
515 if the timestamp hasn't changed, I don't see the harm. */
516 reopen_exec_file ();
517 reread_symbols ();
518
519 /* Insert the temporary breakpoint if a location was specified. */
520 if (tbreak_at_main)
521 tbreak_command (main_name (), 0);
522
523 exec_file = (char *) get_exec_file (0);
524
525 if (non_stop && !target_supports_non_stop ())
526 error (_("The target does not support running in non-stop mode."));
527
528 /* We keep symbols from add-symbol-file, on the grounds that the
529 user might want to add some symbols before running the program
530 (right?). But sometimes (dynamic loading where the user manually
531 introduces the new symbols with add-symbol-file), the code which
532 the symbols describe does not persist between runs. Currently
533 the user has to manually nuke all symbols between runs if they
534 want them to go away (PR 2207). This is probably reasonable. */
535
536 if (!args)
537 {
538 if (target_can_async_p ())
539 async_disable_stdin ();
540 }
541 else
542 {
543 int async_exec = strip_bg_char (&args);
544
545 /* If we get a request for running in the bg but the target
546 doesn't support it, error out. */
547 if (async_exec && !target_can_async_p ())
548 error (_("Asynchronous execution not supported on this target."));
549
550 /* If we don't get a request of running in the bg, then we need
551 to simulate synchronous (fg) execution. */
552 if (!async_exec && target_can_async_p ())
553 {
554 /* Simulate synchronous execution. */
555 async_disable_stdin ();
556 }
557
558 /* If there were other args, beside '&', process them. */
559 if (args)
560 set_inferior_args (args);
561 }
562
563 if (from_tty)
564 {
565 ui_out_field_string (uiout, NULL, "Starting program");
566 ui_out_text (uiout, ": ");
567 if (exec_file)
568 ui_out_field_string (uiout, "execfile", exec_file);
569 ui_out_spaces (uiout, 1);
570 /* We call get_inferior_args() because we might need to compute
571 the value now. */
572 ui_out_field_string (uiout, "infargs", get_inferior_args ());
573 ui_out_text (uiout, "\n");
574 ui_out_flush (uiout);
575 }
576
577 /* We call get_inferior_args() because we might need to compute
578 the value now. */
579 target_create_inferior (exec_file, get_inferior_args (),
580 environ_vector (current_inferior ()->environment),
581 from_tty);
582
583 /* We're starting off a new process. When we get out of here, in
584 non-stop mode, finish the state of all threads of that process,
585 but leave other threads alone, as they may be stopped in internal
586 events --- the frontend shouldn't see them as stopped. In
587 all-stop, always finish the state of all threads, as we may be
588 resuming more than just the new process. */
589 if (non_stop)
590 ptid = pid_to_ptid (ptid_get_pid (inferior_ptid));
591 else
592 ptid = minus_one_ptid;
593 old_chain = make_cleanup (finish_thread_state_cleanup, &ptid);
594
595 /* Pass zero for FROM_TTY, because at this point the "run" command
596 has done its thing; now we are setting up the running program. */
597 post_create_inferior (&current_target, 0);
598
599 /* Start the target running. Do not use -1 continuation as it would skip
600 breakpoint right at the entry point. */
601 proceed (regcache_read_pc (get_current_regcache ()), TARGET_SIGNAL_0, 0);
602
603 /* Since there was no error, there's no need to finish the thread
604 states here. */
605 discard_cleanups (old_chain);
606 }
607
608 static void
609 run_command (char *args, int from_tty)
610 {
611 run_command_1 (args, from_tty, 0);
612 }
613
614 static void
615 run_no_args_command (char *args, int from_tty)
616 {
617 set_inferior_args ("");
618 }
619 \f
620
621 /* Start the execution of the program up until the beginning of the main
622 program. */
623
624 static void
625 start_command (char *args, int from_tty)
626 {
627 /* Some languages such as Ada need to search inside the program
628 minimal symbols for the location where to put the temporary
629 breakpoint before starting. */
630 if (!have_minimal_symbols ())
631 error (_("No symbol table loaded. Use the \"file\" command."));
632
633 /* Run the program until reaching the main procedure... */
634 run_command_1 (args, from_tty, 1);
635 }
636
637 static int
638 proceed_thread_callback (struct thread_info *thread, void *arg)
639 {
640 /* We go through all threads individually instead of compressing
641 into a single target `resume_all' request, because some threads
642 may be stopped in internal breakpoints/events, or stopped waiting
643 for its turn in the displaced stepping queue (that is, they are
644 running && !executing). The target side has no idea about why
645 the thread is stopped, so a `resume_all' command would resume too
646 much. If/when GDB gains a way to tell the target `hold this
647 thread stopped until I say otherwise', then we can optimize
648 this. */
649 if (!is_stopped (thread->ptid))
650 return 0;
651
652 switch_to_thread (thread->ptid);
653 clear_proceed_status ();
654 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
655 return 0;
656 }
657
658 void
659 ensure_valid_thread (void)
660 {
661 if (ptid_equal (inferior_ptid, null_ptid)
662 || is_exited (inferior_ptid))
663 error (_("Cannot execute this command without a live selected thread."));
664 }
665
666 /* If the user is looking at trace frames, any resumption of execution
667 is likely to mix up recorded and live target data. So simply
668 disallow those commands. */
669
670 void
671 ensure_not_tfind_mode (void)
672 {
673 if (get_traceframe_number () >= 0)
674 error (_("Cannot execute this command while looking at trace frames."));
675 }
676
677 void
678 continue_1 (int all_threads)
679 {
680 ERROR_NO_INFERIOR;
681 ensure_not_tfind_mode ();
682
683 if (non_stop && all_threads)
684 {
685 /* Don't error out if the current thread is running, because
686 there may be other stopped threads. */
687 struct cleanup *old_chain;
688
689 /* Backup current thread and selected frame. */
690 old_chain = make_cleanup_restore_current_thread ();
691
692 iterate_over_threads (proceed_thread_callback, NULL);
693
694 /* Restore selected ptid. */
695 do_cleanups (old_chain);
696 }
697 else
698 {
699 ensure_valid_thread ();
700 ensure_not_running ();
701 clear_proceed_status ();
702 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
703 }
704 }
705
706 /* continue [-a] [proceed-count] [&] */
707 void
708 continue_command (char *args, int from_tty)
709 {
710 int async_exec = 0;
711 int all_threads = 0;
712 ERROR_NO_INFERIOR;
713
714 /* Find out whether we must run in the background. */
715 if (args != NULL)
716 async_exec = strip_bg_char (&args);
717
718 /* If we must run in the background, but the target can't do it,
719 error out. */
720 if (async_exec && !target_can_async_p ())
721 error (_("Asynchronous execution not supported on this target."));
722
723 /* If we are not asked to run in the bg, then prepare to run in the
724 foreground, synchronously. */
725 if (!async_exec && target_can_async_p ())
726 {
727 /* Simulate synchronous execution. */
728 async_disable_stdin ();
729 }
730
731 if (args != NULL)
732 {
733 if (strncmp (args, "-a", sizeof ("-a") - 1) == 0)
734 {
735 all_threads = 1;
736 args += sizeof ("-a") - 1;
737 if (*args == '\0')
738 args = NULL;
739 }
740 }
741
742 if (!non_stop && all_threads)
743 error (_("`-a' is meaningless in all-stop mode."));
744
745 if (args != NULL && all_threads)
746 error (_("Can't resume all threads and specify "
747 "proceed count simultaneously."));
748
749 /* If we have an argument left, set proceed count of breakpoint we
750 stopped at. */
751 if (args != NULL)
752 {
753 bpstat bs = NULL;
754 int num, stat;
755 int stopped = 0;
756 struct thread_info *tp;
757
758 if (non_stop)
759 tp = find_thread_ptid (inferior_ptid);
760 else
761 {
762 ptid_t last_ptid;
763 struct target_waitstatus ws;
764
765 get_last_target_status (&last_ptid, &ws);
766 tp = find_thread_ptid (last_ptid);
767 }
768 if (tp != NULL)
769 bs = tp->control.stop_bpstat;
770
771 while ((stat = bpstat_num (&bs, &num)) != 0)
772 if (stat > 0)
773 {
774 set_ignore_count (num,
775 parse_and_eval_long (args) - 1,
776 from_tty);
777 /* set_ignore_count prints a message ending with a period.
778 So print two spaces before "Continuing.". */
779 if (from_tty)
780 printf_filtered (" ");
781 stopped = 1;
782 }
783
784 if (!stopped && from_tty)
785 {
786 printf_filtered
787 ("Not stopped at any breakpoint; argument ignored.\n");
788 }
789 }
790
791 if (from_tty)
792 printf_filtered (_("Continuing.\n"));
793
794 continue_1 (all_threads);
795 }
796 \f
797 /* Record the starting point of a "step" or "next" command. */
798
799 static void
800 set_step_frame (void)
801 {
802 struct symtab_and_line sal;
803
804 find_frame_sal (get_current_frame (), &sal);
805 set_step_info (get_current_frame (), sal);
806 }
807
808 /* Step until outside of current statement. */
809
810 static void
811 step_command (char *count_string, int from_tty)
812 {
813 step_1 (0, 0, count_string);
814 }
815
816 /* Likewise, but skip over subroutine calls as if single instructions. */
817
818 static void
819 next_command (char *count_string, int from_tty)
820 {
821 step_1 (1, 0, count_string);
822 }
823
824 /* Likewise, but step only one instruction. */
825
826 void
827 stepi_command (char *count_string, int from_tty)
828 {
829 step_1 (0, 1, count_string);
830 }
831
832 void
833 nexti_command (char *count_string, int from_tty)
834 {
835 step_1 (1, 1, count_string);
836 }
837
838 void
839 delete_longjmp_breakpoint_cleanup (void *arg)
840 {
841 int thread = * (int *) arg;
842 delete_longjmp_breakpoint (thread);
843 }
844
845 static void
846 step_1 (int skip_subroutines, int single_inst, char *count_string)
847 {
848 int count = 1;
849 struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
850 int async_exec = 0;
851 int thread = -1;
852
853 ERROR_NO_INFERIOR;
854 ensure_not_tfind_mode ();
855 ensure_valid_thread ();
856 ensure_not_running ();
857
858 if (count_string)
859 async_exec = strip_bg_char (&count_string);
860
861 /* If we get a request for running in the bg but the target
862 doesn't support it, error out. */
863 if (async_exec && !target_can_async_p ())
864 error (_("Asynchronous execution not supported on this target."));
865
866 /* If we don't get a request of running in the bg, then we need
867 to simulate synchronous (fg) execution. */
868 if (!async_exec && target_can_async_p ())
869 {
870 /* Simulate synchronous execution. */
871 async_disable_stdin ();
872 }
873
874 count = count_string ? parse_and_eval_long (count_string) : 1;
875
876 if (!single_inst || skip_subroutines) /* Leave si command alone. */
877 {
878 struct thread_info *tp = inferior_thread ();
879
880 if (in_thread_list (inferior_ptid))
881 thread = pid_to_thread_id (inferior_ptid);
882
883 set_longjmp_breakpoint (tp, get_frame_id (get_current_frame ()));
884
885 make_cleanup (delete_longjmp_breakpoint_cleanup, &thread);
886 }
887
888 /* In synchronous case, all is well; each step_once call will step once. */
889 if (!target_can_async_p ())
890 {
891 for (; count > 0; count--)
892 {
893 step_once (skip_subroutines, single_inst, count, thread);
894
895 if (!target_has_execution)
896 break;
897 else
898 {
899 struct thread_info *tp = inferior_thread ();
900
901 if (!tp->control.stop_step || !tp->step_multi)
902 {
903 /* If we stopped for some reason that is not stepping
904 there are no further steps to make. */
905 tp->step_multi = 0;
906 break;
907 }
908 }
909 }
910
911 do_cleanups (cleanups);
912 }
913 else
914 {
915 /* In the case of an asynchronous target things get complicated;
916 do only one step for now, before returning control to the
917 event loop. Let the continuation figure out how many other
918 steps we need to do, and handle them one at the time, through
919 step_once. */
920 step_once (skip_subroutines, single_inst, count, thread);
921
922 /* We are running, and the continuation is installed. It will
923 disable the longjmp breakpoint as appropriate. */
924 discard_cleanups (cleanups);
925 }
926 }
927
928 struct step_1_continuation_args
929 {
930 int count;
931 int skip_subroutines;
932 int single_inst;
933 int thread;
934 };
935
936 /* Called after we are done with one step operation, to check whether
937 we need to step again, before we print the prompt and return control
938 to the user. If count is > 1, we will need to do one more call to
939 proceed(), via step_once(). Basically it is like step_once and
940 step_1_continuation are co-recursive. */
941 static void
942 step_1_continuation (void *args)
943 {
944 struct step_1_continuation_args *a = args;
945
946 if (target_has_execution)
947 {
948 struct thread_info *tp;
949
950 tp = inferior_thread ();
951 if (tp->step_multi && tp->control.stop_step)
952 {
953 /* There are more steps to make, and we did stop due to
954 ending a stepping range. Do another step. */
955 step_once (a->skip_subroutines, a->single_inst,
956 a->count - 1, a->thread);
957 return;
958 }
959 tp->step_multi = 0;
960 }
961
962 /* We either stopped for some reason that is not stepping, or there
963 are no further steps to make. Cleanup. */
964 if (!a->single_inst || a->skip_subroutines)
965 delete_longjmp_breakpoint (a->thread);
966 }
967
968 /* Do just one step operation. This is useful to implement the 'step
969 n' kind of commands. In case of asynchronous targets, we will have
970 to set up a continuation to be done after the target stops (after
971 this one step). For synch targets, the caller handles further
972 stepping. */
973
974 static void
975 step_once (int skip_subroutines, int single_inst, int count, int thread)
976 {
977 struct frame_info *frame = get_current_frame ();
978
979 if (count > 0)
980 {
981 /* Don't assume THREAD is a valid thread id. It is set to -1 if
982 the longjmp breakpoint was not required. Use the
983 INFERIOR_PTID thread instead, which is the same thread when
984 THREAD is set. */
985 struct thread_info *tp = inferior_thread ();
986
987 clear_proceed_status ();
988 set_step_frame ();
989
990 if (!single_inst)
991 {
992 CORE_ADDR pc;
993
994 /* Step at an inlined function behaves like "down". */
995 if (!skip_subroutines && !single_inst
996 && inline_skipped_frames (inferior_ptid))
997 {
998 ptid_t resume_ptid;
999
1000 /* Pretend that we've ran. */
1001 resume_ptid = user_visible_resume_ptid (1);
1002 set_running (resume_ptid, 1);
1003
1004 step_into_inline_frame (inferior_ptid);
1005 if (count > 1)
1006 step_once (skip_subroutines, single_inst, count - 1, thread);
1007 else
1008 {
1009 /* Pretend that we've stopped. */
1010 normal_stop ();
1011
1012 if (target_can_async_p ())
1013 inferior_event_handler (INF_EXEC_COMPLETE, NULL);
1014 }
1015 return;
1016 }
1017
1018 pc = get_frame_pc (frame);
1019 find_pc_line_pc_range (pc,
1020 &tp->control.step_range_start,
1021 &tp->control.step_range_end);
1022
1023 /* If we have no line info, switch to stepi mode. */
1024 if (tp->control.step_range_end == 0 && step_stop_if_no_debug)
1025 tp->control.step_range_start = tp->control.step_range_end = 1;
1026 else if (tp->control.step_range_end == 0)
1027 {
1028 char *name;
1029
1030 if (find_pc_partial_function (pc, &name,
1031 &tp->control.step_range_start,
1032 &tp->control.step_range_end) == 0)
1033 error (_("Cannot find bounds of current function"));
1034
1035 target_terminal_ours ();
1036 printf_filtered (_("Single stepping until exit from function %s,"
1037 "\nwhich has no line number information.\n"),
1038 name);
1039 }
1040 }
1041 else
1042 {
1043 /* Say we are stepping, but stop after one insn whatever it does. */
1044 tp->control.step_range_start = tp->control.step_range_end = 1;
1045 if (!skip_subroutines)
1046 /* It is stepi.
1047 Don't step over function calls, not even to functions lacking
1048 line numbers. */
1049 tp->control.step_over_calls = STEP_OVER_NONE;
1050 }
1051
1052 if (skip_subroutines)
1053 tp->control.step_over_calls = STEP_OVER_ALL;
1054
1055 tp->step_multi = (count > 1);
1056 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
1057
1058 /* For async targets, register a continuation to do any
1059 additional steps. For sync targets, the caller will handle
1060 further stepping. */
1061 if (target_can_async_p ())
1062 {
1063 struct step_1_continuation_args *args;
1064
1065 args = xmalloc (sizeof (*args));
1066 args->skip_subroutines = skip_subroutines;
1067 args->single_inst = single_inst;
1068 args->count = count;
1069 args->thread = thread;
1070
1071 add_intermediate_continuation (tp, step_1_continuation, args, xfree);
1072 }
1073 }
1074 }
1075
1076 \f
1077 /* Continue program at specified address. */
1078
1079 static void
1080 jump_command (char *arg, int from_tty)
1081 {
1082 struct gdbarch *gdbarch = get_current_arch ();
1083 CORE_ADDR addr;
1084 struct symtabs_and_lines sals;
1085 struct symtab_and_line sal;
1086 struct symbol *fn;
1087 struct symbol *sfn;
1088 int async_exec = 0;
1089
1090 ERROR_NO_INFERIOR;
1091 ensure_not_tfind_mode ();
1092 ensure_valid_thread ();
1093 ensure_not_running ();
1094
1095 /* Find out whether we must run in the background. */
1096 if (arg != NULL)
1097 async_exec = strip_bg_char (&arg);
1098
1099 /* If we must run in the background, but the target can't do it,
1100 error out. */
1101 if (async_exec && !target_can_async_p ())
1102 error (_("Asynchronous execution not supported on this target."));
1103
1104 if (!arg)
1105 error_no_arg (_("starting address"));
1106
1107 sals = decode_line_spec_1 (arg, 1);
1108 if (sals.nelts != 1)
1109 {
1110 error (_("Unreasonable jump request"));
1111 }
1112
1113 sal = sals.sals[0];
1114 xfree (sals.sals);
1115
1116 if (sal.symtab == 0 && sal.pc == 0)
1117 error (_("No source file has been specified."));
1118
1119 resolve_sal_pc (&sal); /* May error out. */
1120
1121 /* See if we are trying to jump to another function. */
1122 fn = get_frame_function (get_current_frame ());
1123 sfn = find_pc_function (sal.pc);
1124 if (fn != NULL && sfn != fn)
1125 {
1126 if (!query (_("Line %d is not in `%s'. Jump anyway? "), sal.line,
1127 SYMBOL_PRINT_NAME (fn)))
1128 {
1129 error (_("Not confirmed."));
1130 /* NOTREACHED */
1131 }
1132 }
1133
1134 if (sfn != NULL)
1135 {
1136 fixup_symbol_section (sfn, 0);
1137 if (section_is_overlay (SYMBOL_OBJ_SECTION (sfn)) &&
1138 !section_is_mapped (SYMBOL_OBJ_SECTION (sfn)))
1139 {
1140 if (!query (_("WARNING!!! Destination is in "
1141 "unmapped overlay! Jump anyway? ")))
1142 {
1143 error (_("Not confirmed."));
1144 /* NOTREACHED */
1145 }
1146 }
1147 }
1148
1149 addr = sal.pc;
1150
1151 if (from_tty)
1152 {
1153 printf_filtered (_("Continuing at "));
1154 fputs_filtered (paddress (gdbarch, addr), gdb_stdout);
1155 printf_filtered (".\n");
1156 }
1157
1158 /* If we are not asked to run in the bg, then prepare to run in the
1159 foreground, synchronously. */
1160 if (!async_exec && target_can_async_p ())
1161 {
1162 /* Simulate synchronous execution. */
1163 async_disable_stdin ();
1164 }
1165
1166 clear_proceed_status ();
1167 proceed (addr, TARGET_SIGNAL_0, 0);
1168 }
1169 \f
1170
1171 /* Go to line or address in current procedure. */
1172 static void
1173 go_command (char *line_no, int from_tty)
1174 {
1175 if (line_no == (char *) NULL || !*line_no)
1176 printf_filtered (_("Usage: go <location>\n"));
1177 else
1178 {
1179 tbreak_command (line_no, from_tty);
1180 jump_command (line_no, from_tty);
1181 }
1182 }
1183 \f
1184
1185 /* Continue program giving it specified signal. */
1186
1187 static void
1188 signal_command (char *signum_exp, int from_tty)
1189 {
1190 enum target_signal oursig;
1191 int async_exec = 0;
1192
1193 dont_repeat (); /* Too dangerous. */
1194 ERROR_NO_INFERIOR;
1195 ensure_not_tfind_mode ();
1196 ensure_valid_thread ();
1197 ensure_not_running ();
1198
1199 /* Find out whether we must run in the background. */
1200 if (signum_exp != NULL)
1201 async_exec = strip_bg_char (&signum_exp);
1202
1203 /* If we must run in the background, but the target can't do it,
1204 error out. */
1205 if (async_exec && !target_can_async_p ())
1206 error (_("Asynchronous execution not supported on this target."));
1207
1208 /* If we are not asked to run in the bg, then prepare to run in the
1209 foreground, synchronously. */
1210 if (!async_exec && target_can_async_p ())
1211 {
1212 /* Simulate synchronous execution. */
1213 async_disable_stdin ();
1214 }
1215
1216 if (!signum_exp)
1217 error_no_arg (_("signal number"));
1218
1219 /* It would be even slicker to make signal names be valid expressions,
1220 (the type could be "enum $signal" or some such), then the user could
1221 assign them to convenience variables. */
1222 oursig = target_signal_from_name (signum_exp);
1223
1224 if (oursig == TARGET_SIGNAL_UNKNOWN)
1225 {
1226 /* No, try numeric. */
1227 int num = parse_and_eval_long (signum_exp);
1228
1229 if (num == 0)
1230 oursig = TARGET_SIGNAL_0;
1231 else
1232 oursig = target_signal_from_command (num);
1233 }
1234
1235 if (from_tty)
1236 {
1237 if (oursig == TARGET_SIGNAL_0)
1238 printf_filtered (_("Continuing with no signal.\n"));
1239 else
1240 printf_filtered (_("Continuing with signal %s.\n"),
1241 target_signal_to_name (oursig));
1242 }
1243
1244 clear_proceed_status ();
1245 proceed ((CORE_ADDR) -1, oursig, 0);
1246 }
1247
1248 /* A continuation callback for until_next_command. */
1249
1250 static void
1251 until_next_continuation (void *arg)
1252 {
1253 struct thread_info *tp = arg;
1254
1255 delete_longjmp_breakpoint (tp->num);
1256 }
1257
1258 /* Proceed until we reach a different source line with pc greater than
1259 our current one or exit the function. We skip calls in both cases.
1260
1261 Note that eventually this command should probably be changed so
1262 that only source lines are printed out when we hit the breakpoint
1263 we set. This may involve changes to wait_for_inferior and the
1264 proceed status code. */
1265
1266 static void
1267 until_next_command (int from_tty)
1268 {
1269 struct frame_info *frame;
1270 CORE_ADDR pc;
1271 struct symbol *func;
1272 struct symtab_and_line sal;
1273 struct thread_info *tp = inferior_thread ();
1274 int thread = tp->num;
1275 struct cleanup *old_chain;
1276
1277 clear_proceed_status ();
1278 set_step_frame ();
1279
1280 frame = get_current_frame ();
1281
1282 /* Step until either exited from this function or greater
1283 than the current line (if in symbolic section) or pc (if
1284 not). */
1285
1286 pc = get_frame_pc (frame);
1287 func = find_pc_function (pc);
1288
1289 if (!func)
1290 {
1291 struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (pc);
1292
1293 if (msymbol == NULL)
1294 error (_("Execution is not within a known function."));
1295
1296 tp->control.step_range_start = SYMBOL_VALUE_ADDRESS (msymbol);
1297 tp->control.step_range_end = pc;
1298 }
1299 else
1300 {
1301 sal = find_pc_line (pc, 0);
1302
1303 tp->control.step_range_start = BLOCK_START (SYMBOL_BLOCK_VALUE (func));
1304 tp->control.step_range_end = sal.end;
1305 }
1306
1307 tp->control.step_over_calls = STEP_OVER_ALL;
1308
1309 tp->step_multi = 0; /* Only one call to proceed */
1310
1311 set_longjmp_breakpoint (tp, get_frame_id (frame));
1312 old_chain = make_cleanup (delete_longjmp_breakpoint_cleanup, &thread);
1313
1314 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
1315
1316 if (target_can_async_p () && is_running (inferior_ptid))
1317 {
1318 discard_cleanups (old_chain);
1319 add_continuation (tp, until_next_continuation, tp, NULL);
1320 }
1321 else
1322 do_cleanups (old_chain);
1323 }
1324
1325 static void
1326 until_command (char *arg, int from_tty)
1327 {
1328 int async_exec = 0;
1329
1330 ERROR_NO_INFERIOR;
1331 ensure_not_tfind_mode ();
1332 ensure_valid_thread ();
1333 ensure_not_running ();
1334
1335 /* Find out whether we must run in the background. */
1336 if (arg != NULL)
1337 async_exec = strip_bg_char (&arg);
1338
1339 /* If we must run in the background, but the target can't do it,
1340 error out. */
1341 if (async_exec && !target_can_async_p ())
1342 error (_("Asynchronous execution not supported on this target."));
1343
1344 /* If we are not asked to run in the bg, then prepare to run in the
1345 foreground, synchronously. */
1346 if (!async_exec && target_can_async_p ())
1347 {
1348 /* Simulate synchronous execution. */
1349 async_disable_stdin ();
1350 }
1351
1352 if (arg)
1353 until_break_command (arg, from_tty, 0);
1354 else
1355 until_next_command (from_tty);
1356 }
1357
1358 static void
1359 advance_command (char *arg, int from_tty)
1360 {
1361 int async_exec = 0;
1362
1363 ERROR_NO_INFERIOR;
1364 ensure_not_tfind_mode ();
1365 ensure_valid_thread ();
1366 ensure_not_running ();
1367
1368 if (arg == NULL)
1369 error_no_arg (_("a location"));
1370
1371 /* Find out whether we must run in the background. */
1372 if (arg != NULL)
1373 async_exec = strip_bg_char (&arg);
1374
1375 /* If we must run in the background, but the target can't do it,
1376 error out. */
1377 if (async_exec && !target_can_async_p ())
1378 error (_("Asynchronous execution not supported on this target."));
1379
1380 /* If we are not asked to run in the bg, then prepare to run in the
1381 foreground, synchronously. */
1382 if (!async_exec && target_can_async_p ())
1383 {
1384 /* Simulate synchronous execution. */
1385 async_disable_stdin ();
1386 }
1387
1388 until_break_command (arg, from_tty, 1);
1389 }
1390 \f
1391 /* Print the result of a function at the end of a 'finish' command. */
1392
1393 static void
1394 print_return_value (struct type *func_type, struct type *value_type)
1395 {
1396 struct gdbarch *gdbarch = get_regcache_arch (stop_registers);
1397 struct cleanup *old_chain;
1398 struct ui_stream *stb;
1399 struct value *value;
1400
1401 CHECK_TYPEDEF (value_type);
1402 gdb_assert (TYPE_CODE (value_type) != TYPE_CODE_VOID);
1403
1404 /* FIXME: 2003-09-27: When returning from a nested inferior function
1405 call, it's possible (with no help from the architecture vector)
1406 to locate and return/print a "struct return" value. This is just
1407 a more complicated case of what is already being done in the
1408 inferior function call code. In fact, when inferior function
1409 calls are made async, this will likely be made the norm. */
1410
1411 switch (gdbarch_return_value (gdbarch, func_type, value_type,
1412 NULL, NULL, NULL))
1413 {
1414 case RETURN_VALUE_REGISTER_CONVENTION:
1415 case RETURN_VALUE_ABI_RETURNS_ADDRESS:
1416 case RETURN_VALUE_ABI_PRESERVES_ADDRESS:
1417 value = allocate_value (value_type);
1418 gdbarch_return_value (gdbarch, func_type, value_type, stop_registers,
1419 value_contents_raw (value), NULL);
1420 break;
1421 case RETURN_VALUE_STRUCT_CONVENTION:
1422 value = NULL;
1423 break;
1424 default:
1425 internal_error (__FILE__, __LINE__, _("bad switch"));
1426 }
1427
1428 if (value)
1429 {
1430 struct value_print_options opts;
1431
1432 /* Print it. */
1433 stb = ui_out_stream_new (uiout);
1434 old_chain = make_cleanup_ui_out_stream_delete (stb);
1435 ui_out_text (uiout, "Value returned is ");
1436 ui_out_field_fmt (uiout, "gdb-result-var", "$%d",
1437 record_latest_value (value));
1438 ui_out_text (uiout, " = ");
1439 get_raw_print_options (&opts);
1440 value_print (value, stb->stream, &opts);
1441 ui_out_field_stream (uiout, "return-value", stb);
1442 ui_out_text (uiout, "\n");
1443 do_cleanups (old_chain);
1444 }
1445 else
1446 {
1447 ui_out_text (uiout, "Value returned has type: ");
1448 ui_out_field_string (uiout, "return-type", TYPE_NAME (value_type));
1449 ui_out_text (uiout, ".");
1450 ui_out_text (uiout, " Cannot determine contents\n");
1451 }
1452 }
1453
1454 /* Stuff that needs to be done by the finish command after the target
1455 has stopped. In asynchronous mode, we wait for the target to stop
1456 in the call to poll or select in the event loop, so it is
1457 impossible to do all the stuff as part of the finish_command
1458 function itself. The only chance we have to complete this command
1459 is in fetch_inferior_event, which is called by the event loop as
1460 soon as it detects that the target has stopped. This function is
1461 called via the cmd_continuation pointer. */
1462
1463 struct finish_command_continuation_args
1464 {
1465 struct breakpoint *breakpoint;
1466 struct symbol *function;
1467 };
1468
1469 static void
1470 finish_command_continuation (void *arg)
1471 {
1472 struct finish_command_continuation_args *a = arg;
1473 struct thread_info *tp = NULL;
1474 bpstat bs = NULL;
1475
1476 if (!ptid_equal (inferior_ptid, null_ptid)
1477 && target_has_execution
1478 && is_stopped (inferior_ptid))
1479 {
1480 tp = inferior_thread ();
1481 bs = tp->control.stop_bpstat;
1482 }
1483
1484 if (bpstat_find_breakpoint (bs, a->breakpoint) != NULL
1485 && a->function != NULL)
1486 {
1487 struct type *value_type;
1488
1489 value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (a->function));
1490 if (!value_type)
1491 internal_error (__FILE__, __LINE__,
1492 _("finish_command: function has no target type"));
1493
1494 if (TYPE_CODE (value_type) != TYPE_CODE_VOID)
1495 {
1496 volatile struct gdb_exception ex;
1497
1498 TRY_CATCH (ex, RETURN_MASK_ALL)
1499 {
1500 /* print_return_value can throw an exception in some
1501 circumstances. We need to catch this so that we still
1502 delete the breakpoint. */
1503 print_return_value (SYMBOL_TYPE (a->function), value_type);
1504 }
1505 if (ex.reason < 0)
1506 exception_print (gdb_stdout, ex);
1507 }
1508 }
1509
1510 /* We suppress normal call of normal_stop observer and do it here so
1511 that the *stopped notification includes the return value. */
1512 if (bs != NULL && tp->control.proceed_to_finish)
1513 observer_notify_normal_stop (bs, 1 /* print frame */);
1514 delete_breakpoint (a->breakpoint);
1515 delete_longjmp_breakpoint (inferior_thread ()->num);
1516 }
1517
1518 static void
1519 finish_command_continuation_free_arg (void *arg)
1520 {
1521 xfree (arg);
1522 }
1523
1524 /* finish_backward -- helper function for finish_command. */
1525
1526 static void
1527 finish_backward (struct symbol *function)
1528 {
1529 struct symtab_and_line sal;
1530 struct thread_info *tp = inferior_thread ();
1531 CORE_ADDR pc;
1532 CORE_ADDR func_addr;
1533
1534 pc = get_frame_pc (get_current_frame ());
1535
1536 if (find_pc_partial_function (pc, NULL, &func_addr, NULL) == 0)
1537 internal_error (__FILE__, __LINE__,
1538 _("Finish: couldn't find function."));
1539
1540 sal = find_pc_line (func_addr, 0);
1541
1542 tp->control.proceed_to_finish = 1;
1543 /* Special case: if we're sitting at the function entry point,
1544 then all we need to do is take a reverse singlestep. We
1545 don't need to set a breakpoint, and indeed it would do us
1546 no good to do so.
1547
1548 Note that this can only happen at frame #0, since there's
1549 no way that a function up the stack can have a return address
1550 that's equal to its entry point. */
1551
1552 if (sal.pc != pc)
1553 {
1554 struct frame_info *frame = get_selected_frame (NULL);
1555 struct gdbarch *gdbarch = get_frame_arch (frame);
1556 struct symtab_and_line sr_sal;
1557
1558 /* Set a step-resume at the function's entry point. Once that's
1559 hit, we'll do one more step backwards. */
1560 init_sal (&sr_sal);
1561 sr_sal.pc = sal.pc;
1562 sr_sal.pspace = get_frame_program_space (frame);
1563 insert_step_resume_breakpoint_at_sal (gdbarch,
1564 sr_sal, null_frame_id);
1565
1566 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
1567 }
1568 else
1569 {
1570 /* We're almost there -- we just need to back up by one more
1571 single-step. */
1572 tp->control.step_range_start = tp->control.step_range_end = 1;
1573 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
1574 }
1575 }
1576
1577 /* finish_forward -- helper function for finish_command. */
1578
1579 static void
1580 finish_forward (struct symbol *function, struct frame_info *frame)
1581 {
1582 struct gdbarch *gdbarch = get_frame_arch (frame);
1583 struct symtab_and_line sal;
1584 struct thread_info *tp = inferior_thread ();
1585 struct breakpoint *breakpoint;
1586 struct cleanup *old_chain;
1587 struct finish_command_continuation_args *cargs;
1588 int thread = tp->num;
1589
1590 sal = find_pc_line (get_frame_pc (frame), 0);
1591 sal.pc = get_frame_pc (frame);
1592
1593 breakpoint = set_momentary_breakpoint (gdbarch, sal,
1594 get_stack_frame_id (frame),
1595 bp_finish);
1596
1597 old_chain = make_cleanup_delete_breakpoint (breakpoint);
1598
1599 set_longjmp_breakpoint (tp, get_frame_id (frame));
1600 make_cleanup (delete_longjmp_breakpoint_cleanup, &thread);
1601
1602 /* We want stop_registers, please... */
1603 tp->control.proceed_to_finish = 1;
1604 cargs = xmalloc (sizeof (*cargs));
1605
1606 cargs->breakpoint = breakpoint;
1607 cargs->function = function;
1608 add_continuation (tp, finish_command_continuation, cargs,
1609 finish_command_continuation_free_arg);
1610 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
1611
1612 discard_cleanups (old_chain);
1613 if (!target_can_async_p ())
1614 do_all_continuations ();
1615 }
1616
1617 /* "finish": Set a temporary breakpoint at the place the selected
1618 frame will return to, then continue. */
1619
1620 static void
1621 finish_command (char *arg, int from_tty)
1622 {
1623 struct frame_info *frame;
1624 struct symbol *function;
1625
1626 int async_exec = 0;
1627
1628 ERROR_NO_INFERIOR;
1629 ensure_not_tfind_mode ();
1630 ensure_valid_thread ();
1631 ensure_not_running ();
1632
1633 /* Find out whether we must run in the background. */
1634 if (arg != NULL)
1635 async_exec = strip_bg_char (&arg);
1636
1637 /* If we must run in the background, but the target can't do it,
1638 error out. */
1639 if (async_exec && !target_can_async_p ())
1640 error (_("Asynchronous execution not supported on this target."));
1641
1642 /* Don't try to async in reverse. */
1643 if (async_exec && execution_direction == EXEC_REVERSE)
1644 error (_("Asynchronous 'finish' not supported in reverse."));
1645
1646 /* If we are not asked to run in the bg, then prepare to run in the
1647 foreground, synchronously. */
1648 if (!async_exec && target_can_async_p ())
1649 {
1650 /* Simulate synchronous execution. */
1651 async_disable_stdin ();
1652 }
1653
1654 if (arg)
1655 error (_("The \"finish\" command does not take any arguments."));
1656
1657 frame = get_prev_frame (get_selected_frame (_("No selected frame.")));
1658 if (frame == 0)
1659 error (_("\"finish\" not meaningful in the outermost frame."));
1660
1661 clear_proceed_status ();
1662
1663 /* Finishing from an inline frame is completely different. We don't
1664 try to show the "return value" - no way to locate it. So we do
1665 not need a completion. */
1666 if (get_frame_type (get_selected_frame (_("No selected frame.")))
1667 == INLINE_FRAME)
1668 {
1669 /* Claim we are stepping in the calling frame. An empty step
1670 range means that we will stop once we aren't in a function
1671 called by that frame. We don't use the magic "1" value for
1672 step_range_end, because then infrun will think this is nexti,
1673 and not step over the rest of this inlined function call. */
1674 struct thread_info *tp = inferior_thread ();
1675 struct symtab_and_line empty_sal;
1676
1677 init_sal (&empty_sal);
1678 set_step_info (frame, empty_sal);
1679 tp->control.step_range_start = get_frame_pc (frame);
1680 tp->control.step_range_end = tp->control.step_range_start;
1681 tp->control.step_over_calls = STEP_OVER_ALL;
1682
1683 /* Print info on the selected frame, including level number but not
1684 source. */
1685 if (from_tty)
1686 {
1687 printf_filtered (_("Run till exit from "));
1688 print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
1689 }
1690
1691 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
1692 return;
1693 }
1694
1695 /* Find the function we will return from. */
1696
1697 function = find_pc_function (get_frame_pc (get_selected_frame (NULL)));
1698
1699 /* Print info on the selected frame, including level number but not
1700 source. */
1701 if (from_tty)
1702 {
1703 if (execution_direction == EXEC_REVERSE)
1704 printf_filtered (_("Run back to call of "));
1705 else
1706 printf_filtered (_("Run till exit from "));
1707
1708 print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
1709 }
1710
1711 if (execution_direction == EXEC_REVERSE)
1712 finish_backward (function);
1713 else
1714 finish_forward (function, frame);
1715 }
1716 \f
1717
1718 static void
1719 program_info (char *args, int from_tty)
1720 {
1721 bpstat bs;
1722 int num, stat;
1723 struct thread_info *tp;
1724 ptid_t ptid;
1725
1726 if (!target_has_execution)
1727 {
1728 printf_filtered (_("The program being debugged is not being run.\n"));
1729 return;
1730 }
1731
1732 if (non_stop)
1733 ptid = inferior_ptid;
1734 else
1735 {
1736 struct target_waitstatus ws;
1737
1738 get_last_target_status (&ptid, &ws);
1739 }
1740
1741 if (ptid_equal (ptid, null_ptid) || is_exited (ptid))
1742 error (_("Invalid selected thread."));
1743 else if (is_running (ptid))
1744 error (_("Selected thread is running."));
1745
1746 tp = find_thread_ptid (ptid);
1747 bs = tp->control.stop_bpstat;
1748 stat = bpstat_num (&bs, &num);
1749
1750 target_files_info ();
1751 printf_filtered (_("Program stopped at %s.\n"),
1752 paddress (target_gdbarch, stop_pc));
1753 if (tp->control.stop_step)
1754 printf_filtered (_("It stopped after being stepped.\n"));
1755 else if (stat != 0)
1756 {
1757 /* There may be several breakpoints in the same place, so this
1758 isn't as strange as it seems. */
1759 while (stat != 0)
1760 {
1761 if (stat < 0)
1762 {
1763 printf_filtered (_("It stopped at a breakpoint "
1764 "that has since been deleted.\n"));
1765 }
1766 else
1767 printf_filtered (_("It stopped at breakpoint %d.\n"), num);
1768 stat = bpstat_num (&bs, &num);
1769 }
1770 }
1771 else if (tp->suspend.stop_signal != TARGET_SIGNAL_0)
1772 {
1773 printf_filtered (_("It stopped with signal %s, %s.\n"),
1774 target_signal_to_name (tp->suspend.stop_signal),
1775 target_signal_to_string (tp->suspend.stop_signal));
1776 }
1777
1778 if (!from_tty)
1779 {
1780 printf_filtered (_("Type \"info stack\" or \"info "
1781 "registers\" for more information.\n"));
1782 }
1783 }
1784 \f
1785 static void
1786 environment_info (char *var, int from_tty)
1787 {
1788 if (var)
1789 {
1790 char *val = get_in_environ (current_inferior ()->environment, var);
1791
1792 if (val)
1793 {
1794 puts_filtered (var);
1795 puts_filtered (" = ");
1796 puts_filtered (val);
1797 puts_filtered ("\n");
1798 }
1799 else
1800 {
1801 puts_filtered ("Environment variable \"");
1802 puts_filtered (var);
1803 puts_filtered ("\" not defined.\n");
1804 }
1805 }
1806 else
1807 {
1808 char **vector = environ_vector (current_inferior ()->environment);
1809
1810 while (*vector)
1811 {
1812 puts_filtered (*vector++);
1813 puts_filtered ("\n");
1814 }
1815 }
1816 }
1817
1818 static void
1819 set_environment_command (char *arg, int from_tty)
1820 {
1821 char *p, *val, *var;
1822 int nullset = 0;
1823
1824 if (arg == 0)
1825 error_no_arg (_("environment variable and value"));
1826
1827 /* Find seperation between variable name and value. */
1828 p = (char *) strchr (arg, '=');
1829 val = (char *) strchr (arg, ' ');
1830
1831 if (p != 0 && val != 0)
1832 {
1833 /* We have both a space and an equals. If the space is before the
1834 equals, walk forward over the spaces til we see a nonspace
1835 (possibly the equals). */
1836 if (p > val)
1837 while (*val == ' ')
1838 val++;
1839
1840 /* Now if the = is after the char following the spaces,
1841 take the char following the spaces. */
1842 if (p > val)
1843 p = val - 1;
1844 }
1845 else if (val != 0 && p == 0)
1846 p = val;
1847
1848 if (p == arg)
1849 error_no_arg (_("environment variable to set"));
1850
1851 if (p == 0 || p[1] == 0)
1852 {
1853 nullset = 1;
1854 if (p == 0)
1855 p = arg + strlen (arg); /* So that savestring below will work. */
1856 }
1857 else
1858 {
1859 /* Not setting variable value to null. */
1860 val = p + 1;
1861 while (*val == ' ' || *val == '\t')
1862 val++;
1863 }
1864
1865 while (p != arg && (p[-1] == ' ' || p[-1] == '\t'))
1866 p--;
1867
1868 var = savestring (arg, p - arg);
1869 if (nullset)
1870 {
1871 printf_filtered (_("Setting environment variable "
1872 "\"%s\" to null value.\n"),
1873 var);
1874 set_in_environ (current_inferior ()->environment, var, "");
1875 }
1876 else
1877 set_in_environ (current_inferior ()->environment, var, val);
1878 xfree (var);
1879 }
1880
1881 static void
1882 unset_environment_command (char *var, int from_tty)
1883 {
1884 if (var == 0)
1885 {
1886 /* If there is no argument, delete all environment variables.
1887 Ask for confirmation if reading from the terminal. */
1888 if (!from_tty || query (_("Delete all environment variables? ")))
1889 {
1890 free_environ (current_inferior ()->environment);
1891 current_inferior ()->environment = make_environ ();
1892 }
1893 }
1894 else
1895 unset_in_environ (current_inferior ()->environment, var);
1896 }
1897
1898 /* Handle the execution path (PATH variable). */
1899
1900 static const char path_var_name[] = "PATH";
1901
1902 static void
1903 path_info (char *args, int from_tty)
1904 {
1905 puts_filtered ("Executable and object file path: ");
1906 puts_filtered (get_in_environ (current_inferior ()->environment,
1907 path_var_name));
1908 puts_filtered ("\n");
1909 }
1910
1911 /* Add zero or more directories to the front of the execution path. */
1912
1913 static void
1914 path_command (char *dirname, int from_tty)
1915 {
1916 char *exec_path;
1917 char *env;
1918
1919 dont_repeat ();
1920 env = get_in_environ (current_inferior ()->environment, path_var_name);
1921 /* Can be null if path is not set. */
1922 if (!env)
1923 env = "";
1924 exec_path = xstrdup (env);
1925 mod_path (dirname, &exec_path);
1926 set_in_environ (current_inferior ()->environment, path_var_name, exec_path);
1927 xfree (exec_path);
1928 if (from_tty)
1929 path_info ((char *) NULL, from_tty);
1930 }
1931 \f
1932
1933 /* Print out the machine register regnum. If regnum is -1, print all
1934 registers (print_all == 1) or all non-float and non-vector
1935 registers (print_all == 0).
1936
1937 For most machines, having all_registers_info() print the
1938 register(s) one per line is good enough. If a different format is
1939 required, (eg, for MIPS or Pyramid 90x, which both have lots of
1940 regs), or there is an existing convention for showing all the
1941 registers, define the architecture method PRINT_REGISTERS_INFO to
1942 provide that format. */
1943
1944 void
1945 default_print_registers_info (struct gdbarch *gdbarch,
1946 struct ui_file *file,
1947 struct frame_info *frame,
1948 int regnum, int print_all)
1949 {
1950 int i;
1951 const int numregs = gdbarch_num_regs (gdbarch)
1952 + gdbarch_num_pseudo_regs (gdbarch);
1953
1954 for (i = 0; i < numregs; i++)
1955 {
1956 struct type *regtype;
1957 struct value *val;
1958
1959 /* Decide between printing all regs, non-float / vector regs, or
1960 specific reg. */
1961 if (regnum == -1)
1962 {
1963 if (print_all)
1964 {
1965 if (!gdbarch_register_reggroup_p (gdbarch, i, all_reggroup))
1966 continue;
1967 }
1968 else
1969 {
1970 if (!gdbarch_register_reggroup_p (gdbarch, i, general_reggroup))
1971 continue;
1972 }
1973 }
1974 else
1975 {
1976 if (i != regnum)
1977 continue;
1978 }
1979
1980 /* If the register name is empty, it is undefined for this
1981 processor, so don't display anything. */
1982 if (gdbarch_register_name (gdbarch, i) == NULL
1983 || *(gdbarch_register_name (gdbarch, i)) == '\0')
1984 continue;
1985
1986 fputs_filtered (gdbarch_register_name (gdbarch, i), file);
1987 print_spaces_filtered (15 - strlen (gdbarch_register_name
1988 (gdbarch, i)), file);
1989
1990 regtype = register_type (gdbarch, i);
1991 val = allocate_value (regtype);
1992
1993 /* Get the data in raw format. */
1994 if (! frame_register_read (frame, i, value_contents_raw (val)))
1995 {
1996 fprintf_filtered (file, "*value not available*\n");
1997 continue;
1998 }
1999
2000 /* If virtual format is floating, print it that way, and in raw
2001 hex. */
2002 if (TYPE_CODE (regtype) == TYPE_CODE_FLT
2003 || TYPE_CODE (regtype) == TYPE_CODE_DECFLOAT)
2004 {
2005 int j;
2006 struct value_print_options opts;
2007 const gdb_byte *valaddr = value_contents_for_printing (val);
2008
2009 get_user_print_options (&opts);
2010 opts.deref_ref = 1;
2011
2012 val_print (regtype,
2013 value_contents_for_printing (val),
2014 value_embedded_offset (val), 0,
2015 file, 0, val, &opts, current_language);
2016
2017 fprintf_filtered (file, "\t(raw 0x");
2018 for (j = 0; j < register_size (gdbarch, i); j++)
2019 {
2020 int idx;
2021
2022 if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
2023 idx = j;
2024 else
2025 idx = register_size (gdbarch, i) - 1 - j;
2026 fprintf_filtered (file, "%02x", (unsigned char) valaddr[idx]);
2027 }
2028 fprintf_filtered (file, ")");
2029 }
2030 else
2031 {
2032 struct value_print_options opts;
2033
2034 /* Print the register in hex. */
2035 get_formatted_print_options (&opts, 'x');
2036 opts.deref_ref = 1;
2037 val_print (regtype,
2038 value_contents_for_printing (val),
2039 value_embedded_offset (val), 0,
2040 file, 0, val, &opts, current_language);
2041 /* If not a vector register, print it also according to its
2042 natural format. */
2043 if (TYPE_VECTOR (regtype) == 0)
2044 {
2045 get_user_print_options (&opts);
2046 opts.deref_ref = 1;
2047 fprintf_filtered (file, "\t");
2048 val_print (regtype,
2049 value_contents_for_printing (val),
2050 value_embedded_offset (val), 0,
2051 file, 0, val, &opts, current_language);
2052 }
2053 }
2054
2055 fprintf_filtered (file, "\n");
2056 }
2057 }
2058
2059 void
2060 registers_info (char *addr_exp, int fpregs)
2061 {
2062 struct frame_info *frame;
2063 struct gdbarch *gdbarch;
2064
2065 if (!target_has_registers)
2066 error (_("The program has no registers now."));
2067 frame = get_selected_frame (NULL);
2068 gdbarch = get_frame_arch (frame);
2069
2070 if (!addr_exp)
2071 {
2072 gdbarch_print_registers_info (gdbarch, gdb_stdout,
2073 frame, -1, fpregs);
2074 return;
2075 }
2076
2077 while (*addr_exp != '\0')
2078 {
2079 char *start;
2080 const char *end;
2081
2082 /* Keep skipping leading white space. */
2083 if (isspace ((*addr_exp)))
2084 {
2085 addr_exp++;
2086 continue;
2087 }
2088
2089 /* Discard any leading ``$''. Check that there is something
2090 resembling a register following it. */
2091 if (addr_exp[0] == '$')
2092 addr_exp++;
2093 if (isspace ((*addr_exp)) || (*addr_exp) == '\0')
2094 error (_("Missing register name"));
2095
2096 /* Find the start/end of this register name/num/group. */
2097 start = addr_exp;
2098 while ((*addr_exp) != '\0' && !isspace ((*addr_exp)))
2099 addr_exp++;
2100 end = addr_exp;
2101
2102 /* Figure out what we've found and display it. */
2103
2104 /* A register name? */
2105 {
2106 int regnum = user_reg_map_name_to_regnum (gdbarch, start, end - start);
2107
2108 if (regnum >= 0)
2109 {
2110 /* User registers lie completely outside of the range of
2111 normal registers. Catch them early so that the target
2112 never sees them. */
2113 if (regnum >= gdbarch_num_regs (gdbarch)
2114 + gdbarch_num_pseudo_regs (gdbarch))
2115 {
2116 struct value_print_options opts;
2117 struct value *val = value_of_user_reg (regnum, frame);
2118
2119 printf_filtered ("%s: ", start);
2120 get_formatted_print_options (&opts, 'x');
2121 val_print_scalar_formatted (check_typedef (value_type (val)),
2122 value_contents_for_printing (val),
2123 value_embedded_offset (val),
2124 val,
2125 &opts, 0, gdb_stdout);
2126 printf_filtered ("\n");
2127 }
2128 else
2129 gdbarch_print_registers_info (gdbarch, gdb_stdout,
2130 frame, regnum, fpregs);
2131 continue;
2132 }
2133 }
2134
2135 /* A register group? */
2136 {
2137 struct reggroup *group;
2138
2139 for (group = reggroup_next (gdbarch, NULL);
2140 group != NULL;
2141 group = reggroup_next (gdbarch, group))
2142 {
2143 /* Don't bother with a length check. Should the user
2144 enter a short register group name, go with the first
2145 group that matches. */
2146 if (strncmp (start, reggroup_name (group), end - start) == 0)
2147 break;
2148 }
2149 if (group != NULL)
2150 {
2151 int regnum;
2152
2153 for (regnum = 0;
2154 regnum < gdbarch_num_regs (gdbarch)
2155 + gdbarch_num_pseudo_regs (gdbarch);
2156 regnum++)
2157 {
2158 if (gdbarch_register_reggroup_p (gdbarch, regnum, group))
2159 gdbarch_print_registers_info (gdbarch,
2160 gdb_stdout, frame,
2161 regnum, fpregs);
2162 }
2163 continue;
2164 }
2165 }
2166
2167 /* Nothing matched. */
2168 error (_("Invalid register `%.*s'"), (int) (end - start), start);
2169 }
2170 }
2171
2172 void
2173 all_registers_info (char *addr_exp, int from_tty)
2174 {
2175 registers_info (addr_exp, 1);
2176 }
2177
2178 static void
2179 nofp_registers_info (char *addr_exp, int from_tty)
2180 {
2181 registers_info (addr_exp, 0);
2182 }
2183
2184 static void
2185 print_vector_info (struct ui_file *file,
2186 struct frame_info *frame, const char *args)
2187 {
2188 struct gdbarch *gdbarch = get_frame_arch (frame);
2189
2190 if (gdbarch_print_vector_info_p (gdbarch))
2191 gdbarch_print_vector_info (gdbarch, file, frame, args);
2192 else
2193 {
2194 int regnum;
2195 int printed_something = 0;
2196
2197 for (regnum = 0;
2198 regnum < gdbarch_num_regs (gdbarch)
2199 + gdbarch_num_pseudo_regs (gdbarch);
2200 regnum++)
2201 {
2202 if (gdbarch_register_reggroup_p (gdbarch, regnum, vector_reggroup))
2203 {
2204 printed_something = 1;
2205 gdbarch_print_registers_info (gdbarch, file, frame, regnum, 1);
2206 }
2207 }
2208 if (!printed_something)
2209 fprintf_filtered (file, "No vector information\n");
2210 }
2211 }
2212
2213 static void
2214 vector_info (char *args, int from_tty)
2215 {
2216 if (!target_has_registers)
2217 error (_("The program has no registers now."));
2218
2219 print_vector_info (gdb_stdout, get_selected_frame (NULL), args);
2220 }
2221 \f
2222 /* Kill the inferior process. Make us have no inferior. */
2223
2224 static void
2225 kill_command (char *arg, int from_tty)
2226 {
2227 /* FIXME: This should not really be inferior_ptid (or target_has_execution).
2228 It should be a distinct flag that indicates that a target is active, cuz
2229 some targets don't have processes! */
2230
2231 if (ptid_equal (inferior_ptid, null_ptid))
2232 error (_("The program is not being run."));
2233 if (!query (_("Kill the program being debugged? ")))
2234 error (_("Not confirmed."));
2235 target_kill ();
2236
2237 /* If we still have other inferiors to debug, then don't mess with
2238 with their threads. */
2239 if (!have_inferiors ())
2240 {
2241 init_thread_list (); /* Destroy thread info. */
2242
2243 /* Killing off the inferior can leave us with a core file. If
2244 so, print the state we are left in. */
2245 if (target_has_stack)
2246 {
2247 printf_filtered (_("In %s,\n"), target_longname);
2248 print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
2249 }
2250 }
2251 bfd_cache_close_all ();
2252 }
2253
2254 /* Used in `attach&' command. ARG is a point to an integer
2255 representing a process id. Proceed threads of this process iff
2256 they stopped due to debugger request, and when they did, they
2257 reported a clean stop (TARGET_SIGNAL_0). Do not proceed threads
2258 that have been explicitly been told to stop. */
2259
2260 static int
2261 proceed_after_attach_callback (struct thread_info *thread,
2262 void *arg)
2263 {
2264 int pid = * (int *) arg;
2265
2266 if (ptid_get_pid (thread->ptid) == pid
2267 && !is_exited (thread->ptid)
2268 && !is_executing (thread->ptid)
2269 && !thread->stop_requested
2270 && thread->suspend.stop_signal == TARGET_SIGNAL_0)
2271 {
2272 switch_to_thread (thread->ptid);
2273 clear_proceed_status ();
2274 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
2275 }
2276
2277 return 0;
2278 }
2279
2280 static void
2281 proceed_after_attach (int pid)
2282 {
2283 /* Don't error out if the current thread is running, because
2284 there may be other stopped threads. */
2285 struct cleanup *old_chain;
2286
2287 /* Backup current thread and selected frame. */
2288 old_chain = make_cleanup_restore_current_thread ();
2289
2290 iterate_over_threads (proceed_after_attach_callback, &pid);
2291
2292 /* Restore selected ptid. */
2293 do_cleanups (old_chain);
2294 }
2295
2296 /*
2297 * TODO:
2298 * Should save/restore the tty state since it might be that the
2299 * program to be debugged was started on this tty and it wants
2300 * the tty in some state other than what we want. If it's running
2301 * on another terminal or without a terminal, then saving and
2302 * restoring the tty state is a harmless no-op.
2303 * This only needs to be done if we are attaching to a process.
2304 */
2305
2306 /* attach_command --
2307 takes a program started up outside of gdb and ``attaches'' to it.
2308 This stops it cold in its tracks and allows us to start debugging it.
2309 and wait for the trace-trap that results from attaching. */
2310
2311 static void
2312 attach_command_post_wait (char *args, int from_tty, int async_exec)
2313 {
2314 char *exec_file;
2315 char *full_exec_path = NULL;
2316 struct inferior *inferior;
2317
2318 inferior = current_inferior ();
2319 inferior->control.stop_soon = NO_STOP_QUIETLY;
2320
2321 /* If no exec file is yet known, try to determine it from the
2322 process itself. */
2323 exec_file = (char *) get_exec_file (0);
2324 if (!exec_file)
2325 {
2326 exec_file = target_pid_to_exec_file (PIDGET (inferior_ptid));
2327 if (exec_file)
2328 {
2329 /* It's possible we don't have a full path, but rather just a
2330 filename. Some targets, such as HP-UX, don't provide the
2331 full path, sigh.
2332
2333 Attempt to qualify the filename against the source path.
2334 (If that fails, we'll just fall back on the original
2335 filename. Not much more we can do...) */
2336
2337 if (!source_full_path_of (exec_file, &full_exec_path))
2338 full_exec_path = xstrdup (exec_file);
2339
2340 exec_file_attach (full_exec_path, from_tty);
2341 symbol_file_add_main (full_exec_path, from_tty);
2342 }
2343 }
2344 else
2345 {
2346 reopen_exec_file ();
2347 reread_symbols ();
2348 }
2349
2350 /* Take any necessary post-attaching actions for this platform. */
2351 target_post_attach (PIDGET (inferior_ptid));
2352
2353 post_create_inferior (&current_target, from_tty);
2354
2355 /* Install inferior's terminal modes. */
2356 target_terminal_inferior ();
2357
2358 if (async_exec)
2359 {
2360 /* The user requested an `attach&', so be sure to leave threads
2361 that didn't get a signal running. */
2362
2363 /* Immediatelly resume all suspended threads of this inferior,
2364 and this inferior only. This should have no effect on
2365 already running threads. If a thread has been stopped with a
2366 signal, leave it be. */
2367 if (non_stop)
2368 proceed_after_attach (inferior->pid);
2369 else
2370 {
2371 if (inferior_thread ()->suspend.stop_signal == TARGET_SIGNAL_0)
2372 {
2373 clear_proceed_status ();
2374 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
2375 }
2376 }
2377 }
2378 else
2379 {
2380 /* The user requested a plain `attach', so be sure to leave
2381 the inferior stopped. */
2382
2383 if (target_can_async_p ())
2384 async_enable_stdin ();
2385
2386 /* At least the current thread is already stopped. */
2387
2388 /* In all-stop, by definition, all threads have to be already
2389 stopped at this point. In non-stop, however, although the
2390 selected thread is stopped, others may still be executing.
2391 Be sure to explicitly stop all threads of the process. This
2392 should have no effect on already stopped threads. */
2393 if (non_stop)
2394 target_stop (pid_to_ptid (inferior->pid));
2395
2396 /* Tell the user/frontend where we're stopped. */
2397 normal_stop ();
2398 if (deprecated_attach_hook)
2399 deprecated_attach_hook ();
2400 }
2401 }
2402
2403 struct attach_command_continuation_args
2404 {
2405 char *args;
2406 int from_tty;
2407 int async_exec;
2408 };
2409
2410 static void
2411 attach_command_continuation (void *args)
2412 {
2413 struct attach_command_continuation_args *a = args;
2414
2415 attach_command_post_wait (a->args, a->from_tty, a->async_exec);
2416 }
2417
2418 static void
2419 attach_command_continuation_free_args (void *args)
2420 {
2421 struct attach_command_continuation_args *a = args;
2422
2423 xfree (a->args);
2424 xfree (a);
2425 }
2426
2427 void
2428 attach_command (char *args, int from_tty)
2429 {
2430 int async_exec = 0;
2431 struct cleanup *back_to = make_cleanup (null_cleanup, NULL);
2432
2433 dont_repeat (); /* Not for the faint of heart */
2434
2435 if (gdbarch_has_global_solist (target_gdbarch))
2436 /* Don't complain if all processes share the same symbol
2437 space. */
2438 ;
2439 else if (target_has_execution)
2440 {
2441 if (query (_("A program is being debugged already. Kill it? ")))
2442 target_kill ();
2443 else
2444 error (_("Not killed."));
2445 }
2446
2447 /* Clean up any leftovers from other runs. Some other things from
2448 this function should probably be moved into target_pre_inferior. */
2449 target_pre_inferior (from_tty);
2450
2451 if (non_stop && !target_supports_non_stop ())
2452 error (_("Cannot attach to this target in non-stop mode"));
2453
2454 if (args)
2455 {
2456 async_exec = strip_bg_char (&args);
2457
2458 /* If we get a request for running in the bg but the target
2459 doesn't support it, error out. */
2460 if (async_exec && !target_can_async_p ())
2461 error (_("Asynchronous execution not supported on this target."));
2462 }
2463
2464 /* If we don't get a request of running in the bg, then we need
2465 to simulate synchronous (fg) execution. */
2466 if (!async_exec && target_can_async_p ())
2467 {
2468 /* Simulate synchronous execution. */
2469 async_disable_stdin ();
2470 make_cleanup ((make_cleanup_ftype *)async_enable_stdin, NULL);
2471 }
2472
2473 target_attach (args, from_tty);
2474
2475 /* Set up the "saved terminal modes" of the inferior
2476 based on what modes we are starting it with. */
2477 target_terminal_init ();
2478
2479 /* Set up execution context to know that we should return from
2480 wait_for_inferior as soon as the target reports a stop. */
2481 init_wait_for_inferior ();
2482 clear_proceed_status ();
2483
2484 if (non_stop)
2485 {
2486 /* If we find that the current thread isn't stopped, explicitly
2487 do so now, because we're going to install breakpoints and
2488 poke at memory. */
2489
2490 if (async_exec)
2491 /* The user requested an `attach&'; stop just one thread. */
2492 target_stop (inferior_ptid);
2493 else
2494 /* The user requested an `attach', so stop all threads of this
2495 inferior. */
2496 target_stop (pid_to_ptid (ptid_get_pid (inferior_ptid)));
2497 }
2498
2499 /* Some system don't generate traps when attaching to inferior.
2500 E.g. Mach 3 or GNU hurd. */
2501 if (!target_attach_no_wait)
2502 {
2503 struct inferior *inferior = current_inferior ();
2504
2505 /* Careful here. See comments in inferior.h. Basically some
2506 OSes don't ignore SIGSTOPs on continue requests anymore. We
2507 need a way for handle_inferior_event to reset the stop_signal
2508 variable after an attach, and this is what
2509 STOP_QUIETLY_NO_SIGSTOP is for. */
2510 inferior->control.stop_soon = STOP_QUIETLY_NO_SIGSTOP;
2511
2512 if (target_can_async_p ())
2513 {
2514 /* sync_execution mode. Wait for stop. */
2515 struct attach_command_continuation_args *a;
2516
2517 a = xmalloc (sizeof (*a));
2518 a->args = xstrdup (args);
2519 a->from_tty = from_tty;
2520 a->async_exec = async_exec;
2521 add_inferior_continuation (attach_command_continuation, a,
2522 attach_command_continuation_free_args);
2523 discard_cleanups (back_to);
2524 return;
2525 }
2526
2527 wait_for_inferior ();
2528 }
2529
2530 attach_command_post_wait (args, from_tty, async_exec);
2531 discard_cleanups (back_to);
2532 }
2533
2534 /* We had just found out that the target was already attached to an
2535 inferior. PTID points at a thread of this new inferior, that is
2536 the most likely to be stopped right now, but not necessarily so.
2537 The new inferior is assumed to be already added to the inferior
2538 list at this point. If LEAVE_RUNNING, then leave the threads of
2539 this inferior running, except those we've explicitly seen reported
2540 as stopped. */
2541
2542 void
2543 notice_new_inferior (ptid_t ptid, int leave_running, int from_tty)
2544 {
2545 struct cleanup* old_chain;
2546 int async_exec;
2547
2548 old_chain = make_cleanup (null_cleanup, NULL);
2549
2550 /* If in non-stop, leave threads as running as they were. If
2551 they're stopped for some reason other than us telling it to, the
2552 target reports a signal != TARGET_SIGNAL_0. We don't try to
2553 resume threads with such a stop signal. */
2554 async_exec = non_stop;
2555
2556 if (!ptid_equal (inferior_ptid, null_ptid))
2557 make_cleanup_restore_current_thread ();
2558
2559 switch_to_thread (ptid);
2560
2561 /* When we "notice" a new inferior we need to do all the things we
2562 would normally do if we had just attached to it. */
2563
2564 if (is_executing (inferior_ptid))
2565 {
2566 struct inferior *inferior = current_inferior ();
2567
2568 /* We're going to install breakpoints, and poke at memory,
2569 ensure that the inferior is stopped for a moment while we do
2570 that. */
2571 target_stop (inferior_ptid);
2572
2573 inferior->control.stop_soon = STOP_QUIETLY_REMOTE;
2574
2575 /* Wait for stop before proceeding. */
2576 if (target_can_async_p ())
2577 {
2578 struct attach_command_continuation_args *a;
2579
2580 a = xmalloc (sizeof (*a));
2581 a->args = xstrdup ("");
2582 a->from_tty = from_tty;
2583 a->async_exec = async_exec;
2584 add_inferior_continuation (attach_command_continuation, a,
2585 attach_command_continuation_free_args);
2586
2587 do_cleanups (old_chain);
2588 return;
2589 }
2590 else
2591 wait_for_inferior ();
2592 }
2593
2594 async_exec = leave_running;
2595 attach_command_post_wait ("" /* args */, from_tty, async_exec);
2596
2597 do_cleanups (old_chain);
2598 }
2599
2600 /*
2601 * detach_command --
2602 * takes a program previously attached to and detaches it.
2603 * The program resumes execution and will no longer stop
2604 * on signals, etc. We better not have left any breakpoints
2605 * in the program or it'll die when it hits one. For this
2606 * to work, it may be necessary for the process to have been
2607 * previously attached. It *might* work if the program was
2608 * started via the normal ptrace (PTRACE_TRACEME).
2609 */
2610
2611 void
2612 detach_command (char *args, int from_tty)
2613 {
2614 dont_repeat (); /* Not for the faint of heart. */
2615
2616 if (ptid_equal (inferior_ptid, null_ptid))
2617 error (_("The program is not being run."));
2618
2619 disconnect_tracing (from_tty);
2620
2621 target_detach (args, from_tty);
2622
2623 /* If the solist is global across inferiors, don't clear it when we
2624 detach from a single inferior. */
2625 if (!gdbarch_has_global_solist (target_gdbarch))
2626 no_shared_libraries (NULL, from_tty);
2627
2628 /* If we still have inferiors to debug, then don't mess with their
2629 threads. */
2630 if (!have_inferiors ())
2631 init_thread_list ();
2632
2633 if (deprecated_detach_hook)
2634 deprecated_detach_hook ();
2635 }
2636
2637 /* Disconnect from the current target without resuming it (leaving it
2638 waiting for a debugger).
2639
2640 We'd better not have left any breakpoints in the program or the
2641 next debugger will get confused. Currently only supported for some
2642 remote targets, since the normal attach mechanisms don't work on
2643 stopped processes on some native platforms (e.g. GNU/Linux). */
2644
2645 static void
2646 disconnect_command (char *args, int from_tty)
2647 {
2648 dont_repeat (); /* Not for the faint of heart. */
2649 target_disconnect (args, from_tty);
2650 no_shared_libraries (NULL, from_tty);
2651 init_thread_list ();
2652 if (deprecated_detach_hook)
2653 deprecated_detach_hook ();
2654 }
2655
2656 void
2657 interrupt_target_1 (int all_threads)
2658 {
2659 ptid_t ptid;
2660
2661 if (all_threads)
2662 ptid = minus_one_ptid;
2663 else
2664 ptid = inferior_ptid;
2665 target_stop (ptid);
2666
2667 /* Tag the thread as having been explicitly requested to stop, so
2668 other parts of gdb know not to resume this thread automatically,
2669 if it was stopped due to an internal event. Limit this to
2670 non-stop mode, as when debugging a multi-threaded application in
2671 all-stop mode, we will only get one stop event --- it's undefined
2672 which thread will report the event. */
2673 if (non_stop)
2674 set_stop_requested (ptid, 1);
2675 }
2676
2677 /* Stop the execution of the target while running in async mode, in
2678 the backgound. In all-stop, stop the whole process. In non-stop
2679 mode, stop the current thread only by default, or stop all threads
2680 if the `-a' switch is used. */
2681
2682 /* interrupt [-a] */
2683 void
2684 interrupt_target_command (char *args, int from_tty)
2685 {
2686 if (target_can_async_p ())
2687 {
2688 int all_threads = 0;
2689
2690 dont_repeat (); /* Not for the faint of heart. */
2691
2692 if (args != NULL
2693 && strncmp (args, "-a", sizeof ("-a") - 1) == 0)
2694 all_threads = 1;
2695
2696 if (!non_stop && all_threads)
2697 error (_("-a is meaningless in all-stop mode."));
2698
2699 interrupt_target_1 (all_threads);
2700 }
2701 }
2702
2703 static void
2704 print_float_info (struct ui_file *file,
2705 struct frame_info *frame, const char *args)
2706 {
2707 struct gdbarch *gdbarch = get_frame_arch (frame);
2708
2709 if (gdbarch_print_float_info_p (gdbarch))
2710 gdbarch_print_float_info (gdbarch, file, frame, args);
2711 else
2712 {
2713 int regnum;
2714 int printed_something = 0;
2715
2716 for (regnum = 0;
2717 regnum < gdbarch_num_regs (gdbarch)
2718 + gdbarch_num_pseudo_regs (gdbarch);
2719 regnum++)
2720 {
2721 if (gdbarch_register_reggroup_p (gdbarch, regnum, float_reggroup))
2722 {
2723 printed_something = 1;
2724 gdbarch_print_registers_info (gdbarch, file, frame, regnum, 1);
2725 }
2726 }
2727 if (!printed_something)
2728 fprintf_filtered (file, "No floating-point info "
2729 "available for this processor.\n");
2730 }
2731 }
2732
2733 static void
2734 float_info (char *args, int from_tty)
2735 {
2736 if (!target_has_registers)
2737 error (_("The program has no registers now."));
2738
2739 print_float_info (gdb_stdout, get_selected_frame (NULL), args);
2740 }
2741 \f
2742 static void
2743 unset_command (char *args, int from_tty)
2744 {
2745 printf_filtered (_("\"unset\" must be followed by the "
2746 "name of an unset subcommand.\n"));
2747 help_list (unsetlist, "unset ", -1, gdb_stdout);
2748 }
2749
2750 void
2751 _initialize_infcmd (void)
2752 {
2753 struct cmd_list_element *c = NULL;
2754
2755 /* Add the filename of the terminal connected to inferior I/O. */
2756 add_setshow_filename_cmd ("inferior-tty", class_run,
2757 &inferior_io_terminal_scratch, _("\
2758 Set terminal for future runs of program being debugged."), _("\
2759 Show terminal for future runs of program being debugged."), _("\
2760 Usage: set inferior-tty /dev/pts/1"),
2761 set_inferior_tty_command,
2762 show_inferior_tty_command,
2763 &setlist, &showlist);
2764 add_com_alias ("tty", "set inferior-tty", class_alias, 0);
2765
2766 add_setshow_optional_filename_cmd ("args", class_run,
2767 &inferior_args_scratch, _("\
2768 Set argument list to give program being debugged when it is started."), _("\
2769 Show argument list to give program being debugged when it is started."), _("\
2770 Follow this command with any number of args, to be passed to the program."),
2771 set_args_command,
2772 show_args_command,
2773 &setlist, &showlist);
2774
2775 c = add_cmd ("environment", no_class, environment_info, _("\
2776 The environment to give the program, or one variable's value.\n\
2777 With an argument VAR, prints the value of environment variable VAR to\n\
2778 give the program being debugged. With no arguments, prints the entire\n\
2779 environment to be given to the program."), &showlist);
2780 set_cmd_completer (c, noop_completer);
2781
2782 add_prefix_cmd ("unset", no_class, unset_command,
2783 _("Complement to certain \"set\" commands."),
2784 &unsetlist, "unset ", 0, &cmdlist);
2785
2786 c = add_cmd ("environment", class_run, unset_environment_command, _("\
2787 Cancel environment variable VAR for the program.\n\
2788 This does not affect the program until the next \"run\" command."),
2789 &unsetlist);
2790 set_cmd_completer (c, noop_completer);
2791
2792 c = add_cmd ("environment", class_run, set_environment_command, _("\
2793 Set environment variable value to give the program.\n\
2794 Arguments are VAR VALUE where VAR is variable name and VALUE is value.\n\
2795 VALUES of environment variables are uninterpreted strings.\n\
2796 This does not affect the program until the next \"run\" command."),
2797 &setlist);
2798 set_cmd_completer (c, noop_completer);
2799
2800 c = add_com ("path", class_files, path_command, _("\
2801 Add directory DIR(s) to beginning of search path for object files.\n\
2802 $cwd in the path means the current working directory.\n\
2803 This path is equivalent to the $PATH shell variable. It is a list of\n\
2804 directories, separated by colons. These directories are searched to find\n\
2805 fully linked executable files and separately compiled object files as \
2806 needed."));
2807 set_cmd_completer (c, filename_completer);
2808
2809 c = add_cmd ("paths", no_class, path_info, _("\
2810 Current search path for finding object files.\n\
2811 $cwd in the path means the current working directory.\n\
2812 This path is equivalent to the $PATH shell variable. It is a list of\n\
2813 directories, separated by colons. These directories are searched to find\n\
2814 fully linked executable files and separately compiled object files as \
2815 needed."),
2816 &showlist);
2817 set_cmd_completer (c, noop_completer);
2818
2819 add_prefix_cmd ("kill", class_run, kill_command,
2820 _("Kill execution of program being debugged."),
2821 &killlist, "kill ", 0, &cmdlist);
2822
2823 add_com ("attach", class_run, attach_command, _("\
2824 Attach to a process or file outside of GDB.\n\
2825 This command attaches to another target, of the same type as your last\n\
2826 \"target\" command (\"info files\" will show your target stack).\n\
2827 The command may take as argument a process id or a device file.\n\
2828 For a process id, you must have permission to send the process a signal,\n\
2829 and it must have the same effective uid as the debugger.\n\
2830 When using \"attach\" with a process id, the debugger finds the\n\
2831 program running in the process, looking first in the current working\n\
2832 directory, or (if not found there) using the source file search path\n\
2833 (see the \"directory\" command). You can also use the \"file\" command\n\
2834 to specify the program, and to load its symbol table."));
2835
2836 add_prefix_cmd ("detach", class_run, detach_command, _("\
2837 Detach a process or file previously attached.\n\
2838 If a process, it is no longer traced, and it continues its execution. If\n\
2839 you were debugging a file, the file is closed and gdb no longer accesses it."),
2840 &detachlist, "detach ", 0, &cmdlist);
2841
2842 add_com ("disconnect", class_run, disconnect_command, _("\
2843 Disconnect from a target.\n\
2844 The target will wait for another debugger to connect. Not available for\n\
2845 all targets."));
2846
2847 add_com ("signal", class_run, signal_command, _("\
2848 Continue program giving it signal specified by the argument.\n\
2849 An argument of \"0\" means continue program without giving it a signal."));
2850
2851 add_com ("stepi", class_run, stepi_command, _("\
2852 Step one instruction exactly.\n\
2853 Argument N means do this N times (or till program stops for another \
2854 reason)."));
2855 add_com_alias ("si", "stepi", class_alias, 0);
2856
2857 add_com ("nexti", class_run, nexti_command, _("\
2858 Step one instruction, but proceed through subroutine calls.\n\
2859 Argument N means do this N times (or till program stops for another \
2860 reason)."));
2861 add_com_alias ("ni", "nexti", class_alias, 0);
2862
2863 add_com ("finish", class_run, finish_command, _("\
2864 Execute until selected stack frame returns.\n\
2865 Upon return, the value returned is printed and put in the value history."));
2866 add_com_alias ("fin", "finish", class_run, 1);
2867
2868 add_com ("next", class_run, next_command, _("\
2869 Step program, proceeding through subroutine calls.\n\
2870 Like the \"step\" command as long as subroutine calls do not happen;\n\
2871 when they do, the call is treated as one instruction.\n\
2872 Argument N means do this N times (or till program stops for another \
2873 reason)."));
2874 add_com_alias ("n", "next", class_run, 1);
2875 if (xdb_commands)
2876 add_com_alias ("S", "next", class_run, 1);
2877
2878 add_com ("step", class_run, step_command, _("\
2879 Step program until it reaches a different source line.\n\
2880 Argument N means do this N times (or till program stops for another \
2881 reason)."));
2882 add_com_alias ("s", "step", class_run, 1);
2883
2884 c = add_com ("until", class_run, until_command, _("\
2885 Execute until the program reaches a source line greater than the current\n\
2886 or a specified location (same args as break command) within the current \
2887 frame."));
2888 set_cmd_completer (c, location_completer);
2889 add_com_alias ("u", "until", class_run, 1);
2890
2891 c = add_com ("advance", class_run, advance_command, _("\
2892 Continue the program up to the given location (same form as args for break \
2893 command).\n\
2894 Execution will also stop upon exit from the current stack frame."));
2895 set_cmd_completer (c, location_completer);
2896
2897 c = add_com ("jump", class_run, jump_command, _("\
2898 Continue program being debugged at specified line or address.\n\
2899 Give as argument either LINENUM or *ADDR, where ADDR is an expression\n\
2900 for an address to start at."));
2901 set_cmd_completer (c, location_completer);
2902
2903 if (xdb_commands)
2904 {
2905 c = add_com ("go", class_run, go_command, _("\
2906 Usage: go <location>\n\
2907 Continue program being debugged, stopping at specified line or \n\
2908 address.\n\
2909 Give as argument either LINENUM or *ADDR, where ADDR is an \n\
2910 expression for an address to start at.\n\
2911 This command is a combination of tbreak and jump."));
2912 set_cmd_completer (c, location_completer);
2913 }
2914
2915 if (xdb_commands)
2916 add_com_alias ("g", "go", class_run, 1);
2917
2918 add_com ("continue", class_run, continue_command, _("\
2919 Continue program being debugged, after signal or breakpoint.\n\
2920 If proceeding from breakpoint, a number N may be used as an argument,\n\
2921 which means to set the ignore count of that breakpoint to N - 1 (so that\n\
2922 the breakpoint won't break until the Nth time it is reached).\n\
2923 \n\
2924 If non-stop mode is enabled, continue only the current thread,\n\
2925 otherwise all the threads in the program are continued. To \n\
2926 continue all stopped threads in non-stop mode, use the -a option.\n\
2927 Specifying -a and an ignore count simultaneously is an error."));
2928 add_com_alias ("c", "cont", class_run, 1);
2929 add_com_alias ("fg", "cont", class_run, 1);
2930
2931 c = add_com ("run", class_run, run_command, _("\
2932 Start debugged program. You may specify arguments to give it.\n\
2933 Args may include \"*\", or \"[...]\"; they are expanded using \"sh\".\n\
2934 Input and output redirection with \">\", \"<\", or \">>\" are also \
2935 allowed.\n\n\
2936 With no arguments, uses arguments last specified (with \"run\" \
2937 or \"set args\").\n\
2938 To cancel previous arguments and run with no arguments,\n\
2939 use \"set args\" without arguments."));
2940 set_cmd_completer (c, filename_completer);
2941 add_com_alias ("r", "run", class_run, 1);
2942 if (xdb_commands)
2943 add_com ("R", class_run, run_no_args_command,
2944 _("Start debugged program with no arguments."));
2945
2946 c = add_com ("start", class_run, start_command, _("\
2947 Run the debugged program until the beginning of the main procedure.\n\
2948 You may specify arguments to give to your program, just as with the\n\
2949 \"run\" command."));
2950 set_cmd_completer (c, filename_completer);
2951
2952 add_com ("interrupt", class_run, interrupt_target_command,
2953 _("Interrupt the execution of the debugged program.\n\
2954 If non-stop mode is enabled, interrupt only the current thread,\n\
2955 otherwise all the threads in the program are stopped. To \n\
2956 interrupt all running threads in non-stop mode, use the -a option."));
2957
2958 add_info ("registers", nofp_registers_info, _("\
2959 List of integer registers and their contents, for selected stack frame.\n\
2960 Register name as argument means describe only that register."));
2961 add_info_alias ("r", "registers", 1);
2962
2963 if (xdb_commands)
2964 add_com ("lr", class_info, nofp_registers_info, _("\
2965 List of integer registers and their contents, for selected stack frame.\n\
2966 Register name as argument means describe only that register."));
2967 add_info ("all-registers", all_registers_info, _("\
2968 List of all registers and their contents, for selected stack frame.\n\
2969 Register name as argument means describe only that register."));
2970
2971 add_info ("program", program_info,
2972 _("Execution status of the program."));
2973
2974 add_info ("float", float_info,
2975 _("Print the status of the floating point unit\n"));
2976
2977 add_info ("vector", vector_info,
2978 _("Print the status of the vector unit\n"));
2979 }
This page took 0.137296 seconds and 4 git commands to generate.