1 /* Top level for GDB, the GNU debugger.
2 Copyright (C) 1986, 1987, 1988, 1989, 1990 Free Software Foundation, Inc.
4 This file is part of GDB.
6 GDB is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 1, or (at your option)
11 GDB is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GDB; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
29 #include "breakpoint.h"
32 #include <readline/readline.h>
33 #include <readline/history.h>
35 /* readline defines this. */
39 #include <sys/types.h>
46 #include <sys/param.h>
49 #ifdef SET_STACK_LIMIT_HUGE
51 #include <sys/resource.h>
54 int original_stack_limit
;
58 /* If this definition isn't overridden by the header files, assume
59 that isatty and fileno exist on this system. */
61 #define ISATTY(FP) (isatty (fileno (FP)))
64 /* Initialization file name for gdb. This is overridden in some configs. */
66 #ifndef GDBINIT_FILENAME
67 #define GDBINIT_FILENAME ".gdbinit"
69 char gdbinit
[] = GDBINIT_FILENAME
;
71 /* Version number of GDB, as a string. */
75 /* Flag for whether we want all the "from_tty" gubbish printed. */
77 int caution
= 1; /* Default is yes, sigh. */
80 * Define all cmd_list_element's
83 /* Chain containing all defined commands. */
85 struct cmd_list_element
*cmdlist
;
87 /* Chain containing all defined info subcommands. */
89 struct cmd_list_element
*infolist
;
91 /* Chain containing all defined enable subcommands. */
93 struct cmd_list_element
*enablelist
;
95 /* Chain containing all defined disable subcommands. */
97 struct cmd_list_element
*disablelist
;
99 /* Chain containing all defined delete subcommands. */
101 struct cmd_list_element
*deletelist
;
103 /* Chain containing all defined "enable breakpoint" subcommands. */
105 struct cmd_list_element
*enablebreaklist
;
107 /* Chain containing all defined set subcommands */
109 struct cmd_list_element
*setlist
;
111 /* Chain containing all defined show subcommands. */
112 struct cmd_list_element
*showlist
;
114 /* Chain containing all defined \"set history\". */
116 struct cmd_list_element
*sethistlist
;
118 /* Chain containing all defined \"show history\". */
119 struct cmd_list_element
*showhistlist
;
121 /* Chain containing all defined \"unset history\". */
123 struct cmd_list_element
*unsethistlist
;
125 /* stdio stream that command input is being read from. */
129 /* Current working directory. */
131 char *current_directory
;
133 /* The directory name is actually stored here (usually). */
134 static char dirbuf
[MAXPATHLEN
];
136 /* Function to call before reading a command, if nonzero.
137 The function receives two args: an input stream,
138 and a prompt string. */
140 void (*window_hook
) ();
142 extern int frame_file_full_name
;
146 /* The external commands we call... */
147 extern void init_source_path ();
148 extern void directory_command ();
149 extern void exec_file_command ();
150 extern void symbol_file_command ();
151 extern void core_file_command ();
152 extern void tty_command ();
154 extern void help_list ();
155 extern void initialize_all_files ();
156 extern void init_malloc ();
158 /* Forward declarations for this file */
159 void free_command_lines ();
160 char *gdb_readline ();
161 char *command_line_input ();
162 static void initialize_main ();
163 static void initialize_cmd_lists ();
164 static void init_signals ();
165 static void quit_command ();
166 void command_loop ();
167 static void source_command ();
168 static void print_gdb_version ();
169 static void float_handler ();
170 static void cd_command ();
171 static void read_command_file ();
175 /* gdb prints this when reading a command interactively */
178 /* Buffer used for reading command lines, and the size
179 allocated for it so far. */
184 /* Baud rate specified for talking to serial target systems. Default
185 is left as a zero pointer, so targets can choose their own defaults. */
189 /* Signal to catch ^Z typed while reading a command: SIGTSTP or SIGCONT. */
193 #define STOP_SIGNAL SIGTSTP
197 /* This is how `error' returns to command level. */
199 jmp_buf to_top_level
;
202 return_to_top_level ()
206 bpstat_clear_actions(stop_bpstat
); /* Clear queued breakpoint commands */
207 clear_momentary_breakpoints ();
208 disable_current_display ();
210 longjmp (to_top_level
, 1);
213 /* Call FUNC with arg ARGS, catching any errors.
214 If there is no error, return the value returned by FUNC.
215 If there is an error, return zero after printing ERRSTRING
216 (which is in addition to the specific error message already printed). */
219 catch_errors (func
, args
, errstring
)
226 struct cleanup
*saved_cleanup_chain
;
228 saved_cleanup_chain
= save_cleanups ();
230 bcopy (to_top_level
, saved
, sizeof (jmp_buf));
232 if (setjmp (to_top_level
) == 0)
233 val
= (*func
) (args
);
237 fprintf (stderr
, "%s\n", errstring
);
241 restore_cleanups (saved_cleanup_chain
);
243 bcopy (saved
, to_top_level
, sizeof (jmp_buf));
247 /* Handler for SIGHUP. */
252 kill_inferior_fast ();
253 signal (SIGHUP
, SIG_DFL
);
254 kill (getpid (), SIGHUP
);
257 /* Clean up on error during a "source" command (or execution of a
258 user-defined command). */
261 source_cleanup (stream
)
264 /* Restore the previous input stream. */
268 /* Read commands from STREAM. */
270 read_command_file (stream
)
273 struct cleanup
*cleanups
;
275 cleanups
= make_cleanup (source_cleanup
, instream
);
278 do_cleanups (cleanups
);
287 static int inhibit_gdbinit
= 0;
288 static int quiet
= 0;
289 static int batch
= 0;
291 /* Pointers to various arguments from command line. */
293 char *execarg
= NULL
;
294 char *corearg
= NULL
;
298 /* Pointers to all arguments of +command option. */
300 /* Allocated size of cmdarg. */
302 /* Number of elements of cmdarg used. */
305 /* Indices of all arguments of +directory option. */
307 /* Allocated size. */
309 /* Number of elements used. */
314 /* This needs to happen before the first use of malloc. */
317 #if defined (ALIGN_STACK_ON_STARTUP)
318 i
= (int) &count
& 0x3;
324 cmdarg
= (char **) xmalloc (cmdsize
* sizeof (*cmdarg
));
327 dirarg
= (char **) xmalloc (dirsize
* sizeof (*dirarg
));
331 line
= (char *) xmalloc (linesize
);
332 line
[0] = '\0'; /* Terminate saved (now empty) cmd line */
336 current_directory
= dirbuf
;
338 #ifdef SET_STACK_LIMIT_HUGE
342 /* Set the stack limit huge so that alloca (particularly stringtab
343 * in dbxread.c) does not fail. */
344 getrlimit (RLIMIT_STACK
, &rlim
);
345 original_stack_limit
= rlim
.rlim_cur
;
346 rlim
.rlim_cur
= rlim
.rlim_max
;
347 setrlimit (RLIMIT_STACK
, &rlim
);
349 #endif /* SET_STACK_LIMIT_HUGE */
351 /* Parse arguments and options. */
354 static int print_help
;
355 /* When var field is 0, use flag field to record the equivalent
356 short option (or arbitrary numbers starting at 10 for those
357 with no equivalent). */
358 static struct option long_options
[] =
360 {"quiet", 0, &quiet
, 1},
361 {"nx", 0, &inhibit_gdbinit
, 1},
362 {"batch", 0, &batch
, 1},
363 {"epoch", 0, &epoch_interface
, 1},
364 {"fullname", 0, &frame_file_full_name
, 1},
365 {"help", 0, &print_help
, 1},
367 {"symbols", 1, 0, 's'},
372 {"command", 1, 0, 'x'},
374 {"directory", 1, 0, 'd'},
378 /* Allow machine descriptions to add more options... */
379 #ifdef ADDITIONAL_OPTIONS
386 c
= getopt_long_only (argc
, argv
, "",
387 long_options
, &option_index
);
391 /* Long option that takes an argument. */
392 if (c
== 0 && long_options
[option_index
].flag
== 0)
393 c
= long_options
[option_index
].val
;
398 /* Long option that just sets a flag. */
417 cmdarg
[ncmd
++] = optarg
;
421 cmdarg
= (char **) xrealloc ((char *)cmdarg
,
422 cmdsize
* sizeof (*cmdarg
));
426 dirarg
[ndir
++] = optarg
;
430 dirarg
= (char **) xrealloc ((char *)dirarg
,
431 dirsize
* sizeof (*dirarg
));
443 #ifdef ADDITIONAL_OPTION_CASES
444 ADDITIONAL_OPTION_CASES
448 "Use `%s +help' for a complete list of options.\n",
457 This is GDB, the GNU debugger. Use the command\n\
458 gdb [options] [executable [core-file]]\n\
459 to enter the debugger.\n\
461 Options available are:\n\
462 -help Print this message.\n\
463 -quiet Do not print version number on startup.\n\
464 -fullname Output information used by emacs-GDB interface.\n\
465 -epoch Output information used by epoch emacs-GDB interface.\n\
466 -batch Exit after processing options.\n\
467 -nx Do not read .gdbinit file.\n\
468 -tty=TTY Use TTY for input/output by the program being debugged.\n\
469 -cd=DIR Change current directory to DIR.\n\
470 -directory=DIR Search for source files in DIR.\n\
471 -command=FILE Execute GDB commands from FILE.\n\
472 -symbols=SYMFILE Read symbols from SYMFILE.\n\
473 -exec=EXECFILE Use EXECFILE as the executable.\n\
474 -se=FILE Use FILE as symbol file and executable file.\n\
475 -core=COREFILE Analyze the core dump COREFILE.\n\
476 -b BAUDRATE Set serial port baud rate used for remote debugging\n\
478 #ifdef ADDITIONAL_OPTION_HELP
479 fputs (ADDITIONAL_OPTION_HELP
, stderr
);
482 For more information, type \"help\" from within GDB, or consult the\n\
483 GDB manual (available as on-line info or a printed manual).\n", stderr
);
484 /* Exiting after printing this message seems like
485 the most useful thing to do. */
489 /* OK, that's all the options. The other arguments are filenames. */
491 for (; optind
< argc
; optind
++)
495 symarg
= argv
[optind
];
496 execarg
= argv
[optind
];
499 corearg
= argv
[optind
];
503 "Excess command line arguments ignored. (%s%s)\n",
504 argv
[optind
], (optind
== argc
- 1) ? "" : " ...");
511 /* Run the init function of each source file */
513 initialize_cmd_lists (); /* This needs to be done first */
514 initialize_all_files ();
515 initialize_main (); /* But that omits this file! Do it now */
520 /* Print all the junk in one place, with a blank line after it
521 to separate it from important stuff like "no such file".
522 Also, we skip most of the noise, like Emacs, if started with
523 a file name rather than with no arguments. */
525 print_gdb_version (1);
526 printf ("Type \"help\" for a list of commands.\n\n");
530 /* Now perform all the actions indicated by the arguments. */
533 if (!setjmp (to_top_level
))
535 cd_command (cdarg
, 0);
539 for (i
= 0; i
< ndir
; i
++)
540 if (!setjmp (to_top_level
))
541 directory_command (dirarg
[i
], 0);
545 && strcmp (execarg
, symarg
) == 0)
547 /* The exec file and the symbol-file are the same. If we can't open
548 it, better only print one error message. */
549 if (!setjmp (to_top_level
))
551 exec_file_command (execarg
, !batch
);
552 symbol_file_command (symarg
, !batch
);
558 if (!setjmp (to_top_level
))
559 exec_file_command (execarg
, !batch
);
561 if (!setjmp (to_top_level
))
562 symbol_file_command (symarg
, !batch
);
565 if (!setjmp (to_top_level
))
566 core_file_command (corearg
, !batch
);
567 else if (!setjmp (to_top_level
))
568 attach_command (corearg
, !batch
);
571 if (!setjmp (to_top_level
))
572 tty_command (ttyarg
, !batch
);
574 #ifdef ADDITIONAL_OPTION_HANDLER
575 ADDITIONAL_OPTION_HANDLER
;
579 struct stat homebuf
, cwdbuf
;
580 char *homedir
, *homeinit
;
582 /* Read init file, if it exists in home directory */
583 homedir
= getenv ("HOME");
586 homeinit
= (char *) alloca (strlen (getenv ("HOME")) +
587 strlen (gdbinit
) + 10);
588 strcpy (homeinit
, getenv ("HOME"));
589 strcat (homeinit
, "/");
590 strcat (homeinit
, gdbinit
);
591 if (!inhibit_gdbinit
&& access (homeinit
, R_OK
) == 0)
592 if (!setjmp (to_top_level
))
593 source_command (homeinit
, 0);
595 /* Do stats; no need to do them elsewhere since we'll only
596 need them if homedir is set. Make sure that they are
597 zero in case one of them fails (this guarantees that they
598 won't match if either exists). */
600 bzero (&homebuf
, sizeof (struct stat
));
601 bzero (&cwdbuf
, sizeof (struct stat
));
603 stat (homeinit
, &homebuf
);
604 stat (gdbinit
, &cwdbuf
); /* We'll only need this if
608 /* Read the input file in the current directory, *if* it isn't
609 the same file (it should exist, also). */
612 || bcmp ((char *) &homebuf
,
614 sizeof (struct stat
)))
615 if (!inhibit_gdbinit
&& access (gdbinit
, R_OK
) == 0)
616 if (!setjmp (to_top_level
))
617 source_command (gdbinit
, 0);
620 for (i
= 0; i
< ncmd
; i
++)
621 if (!setjmp (to_top_level
))
623 if (cmdarg
[i
][0] == '-' && cmdarg
[i
][1] == '\0')
624 read_command_file (stdin
);
626 source_command (cmdarg
[i
], !batch
);
632 /* We have hit the end of the batch file. */
636 /* Do any host- or target-specific hacks. This is used for i960 targets
637 to force the user to set a nindy target and spec its parameters. */
639 #ifdef BEFORE_MAIN_LOOP_HOOK
640 BEFORE_MAIN_LOOP_HOOK
;
643 /* The command loop. */
647 if (!setjmp (to_top_level
))
650 quit_command ((char *)0, instream
== stdin
);
653 /* No exit -- exit is through quit_command. */
656 /* Execute the line P as a command.
657 Pass FROM_TTY as second argument to the defining function. */
660 execute_command (p
, from_tty
)
664 register struct cmd_list_element
*c
;
665 register struct command_line
*cmdlines
;
669 /* This can happen when command_line_input hits end of file. */
673 while (*p
== ' ' || *p
== '\t') p
++;
678 c
= lookup_cmd (&p
, cmdlist
, "", 0, 1);
679 /* Pass null arg rather than an empty one. */
681 if (c
->class == class_user
)
683 struct cleanup
*old_chain
;
686 error ("User-defined commands cannot take arguments.");
687 cmdlines
= c
->user_commands
;
692 /* Set the instream to 0, indicating execution of a
693 user-defined function. */
694 old_chain
= make_cleanup (source_cleanup
, instream
);
695 instream
= (FILE *) 0;
698 execute_command (cmdlines
->line
, 0);
699 cmdlines
= cmdlines
->next
;
701 do_cleanups (old_chain
);
703 else if (c
->type
== set_cmd
|| c
->type
== show_cmd
)
704 do_setshow_command (arg
, from_tty
& caution
, c
);
705 else if (c
->function
== NO_FUNCTION
)
706 error ("That is not a command, just a help topic.");
708 (*c
->function
) (arg
, from_tty
& caution
);
719 /* Read commands from `instream' and execute them
720 until end of file or error reading instream. */
724 struct cleanup
*old_chain
;
726 int stdin_is_tty
= ISATTY (stdin
);
728 while (!feof (instream
))
730 if (window_hook
&& instream
== stdin
)
731 (*window_hook
) (instream
, prompt
);
734 if (instream
== stdin
&& stdin_is_tty
)
735 reinitialize_more_filter ();
736 old_chain
= make_cleanup (do_nothing
, 0);
737 command
= command_line_input (instream
== stdin
? prompt
: 0,
741 execute_command (command
, instream
== stdin
);
742 /* Do any commands attached to breakpoint we stopped at. */
743 bpstat_do_actions (&stop_bpstat
);
744 do_cleanups (old_chain
);
748 /* Commands call this if they do not want to be repeated by null lines. */
753 /* If we aren't reading from standard input, we are saving the last
754 thing read from stdin in line and don't want to delete it. Null lines
755 won't repeat here in any case. */
756 if (instream
== stdin
)
760 /* Read a line from the stream "instream" without command line editing.
762 It prints PRROMPT once at the start.
764 If RETURN_RESULT is set it allocates
765 space for whatever the user types and returns the result.
766 If not, it just discards what the user types and returns a garbage
769 No matter what return_result is, a NULL return means end of file. */
771 gdb_readline (prrompt
, return_result
)
778 int result_size
= 80;
787 result
= (char *) xmalloc (result_size
);
791 /* Read from stdin if we are executing a user defined command.
792 This is the right thing for prompt_for_continue, at least. */
793 c
= fgetc (instream
? instream
: stdin
);
794 if (c
== EOF
|| c
== '\n')
798 result
[input_index
++] = c
;
799 while (input_index
>= result_size
)
802 result
= (char *) xrealloc (result
, result_size
);
816 result
[input_index
++] = '\0';
820 /* Return any old non-NULL pointer. */
821 return (char *) "non-NULL";
824 /* Declaration for fancy readline with command line editing. */
827 /* Variables which control command line editing and history
828 substitution. These variables are given default values at the end
830 static int command_editing_p
;
831 static int history_expansion_p
;
832 static int write_history_p
;
833 static int history_size
;
834 static char *history_filename
;
836 /* Variables which are necessary for fancy command line editing. */
837 char *gdb_completer_word_break_characters
=
838 " \t\n!@#$%^&*()-+=|~`}{[]\"';:?/>.<,";
840 /* Functions that are used as part of the fancy command line editing. */
842 /* This can be used for functions which don't want to complete on symbols
843 but don't want to complete on anything else either. */
846 noop_completer (text
)
852 /* Generate symbol names one by one for the completer. If STATE is
853 zero, then we need to initialize, otherwise the initialization has
854 already taken place. TEXT is what we expect the symbol to start
855 with. RL_LINE_BUFFER is available to be looked at; it contains the
856 entire text of the line. RL_POINT is the offset in that line of
857 the cursor. You should pretend that the line ends at RL_POINT.
858 The result is NULL if there are no more completions, else a char
859 string which is a possible completion. */
861 symbol_completion_function (text
, state
)
865 static char **list
= (char **)NULL
;
868 extern char *rl_line_buffer
;
870 char *tmp_command
, *p
;
871 struct cmd_list_element
*c
, *result_list
;
875 /* Free the storage used by LIST, but not by the strings inside. This is
876 because rl_complete_internal () frees the strings. */
882 /* Decide whether to complete on a list of gdb commands or on
884 tmp_command
= (char *) alloca (rl_point
+ 1);
887 strncpy (tmp_command
, rl_line_buffer
, rl_point
);
888 tmp_command
[rl_point
] = '\0';
892 /* An empty line we want to consider ambiguous; that is,
893 it could be any command. */
894 c
= (struct cmd_list_element
*) -1;
898 c
= lookup_cmd_1 (&p
, cmdlist
, &result_list
, 1);
900 /* Move p up to the next interesting thing. */
901 while (*p
== ' ' || *p
== '\t')
905 /* He's typed something unrecognizable. Sigh. */
907 else if (c
== (struct cmd_list_element
*) -1)
909 /* If we didn't recognize everything up to the thing that
910 needs completing, and we don't know what command it is
911 yet, we are in trouble. Part of the trouble might be
912 that the list of delimiters used by readline includes
913 '-', which we use in commands. Check for this. */
914 if (p
+ strlen(text
) != tmp_command
+ rl_point
) {
915 if (tmp_command
[rl_point
- strlen(text
) - 1] == '-')
918 /* This really should not produce an error. Better would
919 be to pretend to hit RETURN here; this would produce a
920 response like "Ambiguous command: foo, foobar, etc",
921 and leave the line available for re-entry with ^P. Instead,
922 this error blows away the user's typed input without
923 any way to get it back. */
924 error (" Unrecognized command.");
928 /* He's typed something ambiguous. This is easier. */
930 list
= complete_on_cmdlist (*result_list
->prefixlist
, text
);
932 list
= complete_on_cmdlist (cmdlist
, text
);
936 /* If we've gotten this far, gdb has recognized a full
937 command. There are several possibilities:
939 1) We need to complete on the command.
940 2) We need to complete on the possibilities coming after
942 2) We need to complete the text of what comes after the
946 /* Always (might be longer versions of thie command). */
947 list
= complete_on_cmdlist (result_list
, text
);
948 else if (!*p
&& !*text
)
951 list
= complete_on_cmdlist (*c
->prefixlist
, "");
953 list
= (*c
->completer
) ("");
957 if (c
->prefixlist
&& !c
->allow_unknown
)
960 /* Something like "info adsfkdj". But error() is not
961 the proper response; just return no completions
964 error ("\"%s\" command requires a subcommand.",
971 list
= (*c
->completer
) (text
);
976 /* If the debugged program wasn't compiled with symbols, or if we're
977 clearly completing on a command and no command matches, return
980 return ((char *)NULL
);
982 output
= list
[index
];
993 #if STOP_SIGNAL == SIGTSTP
994 signal (SIGTSTP
, SIG_DFL
);
996 kill (getpid (), SIGTSTP
);
997 signal (SIGTSTP
, stop_sig
);
999 signal (STOP_SIGNAL
, stop_sig
);
1001 printf ("%s", prompt
);
1004 /* Forget about any previous command -- null line now will do nothing. */
1007 #endif /* STOP_SIGNAL */
1010 Writing the history file upon a terminating signal is
not useful
,
1011 because the info is rarely relevant
and is in the core dump anyway
.
1012 It is an annoyance to have the file cluttering up the place
.
1013 /* The list of signals that would terminate us if not caught.
1014 We catch them, but just so that we can write the history file,
1016 int terminating_signals
[] = {
1017 SIGHUP
, SIGINT
, SIGILL
, SIGTRAP
, SIGIOT
,
1018 SIGEMT
, SIGFPE
, SIGKILL
, SIGBUS
, SIGSEGV
, SIGSYS
,
1019 SIGPIPE
, SIGALRM
, SIGTERM
,
1040 #define TERMSIGS_LENGTH (sizeof (terminating_signals) / sizeof (int))
1043 catch_termination (sig
)
1046 /* We are probably here because GDB has a bug. Write out the history
1047 so that we might have a better chance of reproducing it. */
1048 /* Tell the user what we are doing so he can delete the file if
1050 write_history (history_filename
);
1051 printf ("\n%s written.\n", history_filename
);
1052 signal (sig
, SIG_DFL
);
1053 kill (getpid (), sig
);
1057 /* Initialize signal handlers. */
1061 extern void request_quit ();
1065 for (i
= 0; i
< TERMSIGS_LENGTH
; i
++)
1066 signal (terminating_signals
[i
], catch_termination
);
1069 signal (SIGINT
, request_quit
);
1071 /* If we initialize SIGQUIT to SIG_IGN, then the SIG_IGN will get
1072 passed to the inferior, which we don't want. It would be
1073 possible to do a "signal (SIGQUIT, SIG_DFL)" after we fork, but
1074 on BSD4.3 systems using vfork, that will (apparently) affect the
1075 GDB process as well as the inferior (the signal handling tables
1076 being shared between the two, apparently). Since we establish
1077 a handler for SIGQUIT, when we call exec it will set the signal
1078 to SIG_DFL for us. */
1079 signal (SIGQUIT
, do_nothing
);
1080 if (signal (SIGHUP
, do_nothing
) != SIG_IGN
)
1081 signal (SIGHUP
, disconnect
);
1082 signal (SIGFPE
, float_handler
);
1085 /* Read one line from the command input stream `instream'
1086 into the local static buffer `linebuffer' (whose current length
1088 The buffer is made bigger as necessary.
1089 Returns the address of the start of the line.
1091 NULL is returned for end of file.
1093 *If* the instream == stdin & stdin is a terminal, the line read
1094 is copied into the file line saver (global var char *line,
1095 length linesize) so that it can be duplicated.
1097 This routine either uses fancy command line editing or
1098 simple input as the user has requested. */
1101 command_line_input (prrompt
, repeat
)
1105 static char *linebuffer
= 0;
1106 static int linelength
= 0;
1110 char *local_prompt
= prrompt
;
1115 if (linebuffer
== 0)
1118 linebuffer
= (char *) xmalloc (linelength
);
1123 /* Control-C quits instantly if typed while in this loop
1124 since it should not wait until the user types a newline. */
1127 signal (STOP_SIGNAL
, stop_sig
);
1132 /* Don't use fancy stuff if not talking to stdin. */
1133 if (command_editing_p
&& instream
== stdin
1134 && ISATTY (instream
))
1135 rl
= readline (local_prompt
);
1137 rl
= gdb_readline (local_prompt
, 1);
1139 if (!rl
|| rl
== (char *) EOF
)
1144 if (strlen(rl
) + 1 + (p
- linebuffer
) > linelength
)
1146 linelength
= strlen(rl
) + 1 + (p
- linebuffer
);
1147 nline
= (char *) xrealloc (linebuffer
, linelength
);
1148 p
+= nline
- linebuffer
;
1152 /* Copy line. Don't copy null at end. (Leaves line alone
1153 if this was just a newline) */
1157 free (rl
); /* Allocated in readline. */
1159 if (p
== linebuffer
|| *(p
- 1) != '\\')
1162 p
--; /* Put on top of '\'. */
1163 local_prompt
= (char *) 0;
1167 signal (SIGTSTP
, SIG_DFL
);
1174 /* Do history expansion if that is wished. */
1175 if (history_expansion_p
&& instream
== stdin
1176 && ISATTY (instream
))
1178 char *history_value
;
1181 *p
= '\0'; /* Insert null now. */
1182 expanded
= history_expand (linebuffer
, &history_value
);
1185 /* Print the changes. */
1186 printf ("%s\n", history_value
);
1188 /* If there was an error, call this function again. */
1191 free (history_value
);
1192 return command_line_input (prrompt
, repeat
);
1194 if (strlen (history_value
) > linelength
)
1196 linelength
= strlen (history_value
) + 1;
1197 linebuffer
= (char *) xrealloc (linebuffer
, linelength
);
1199 strcpy (linebuffer
, history_value
);
1200 p
= linebuffer
+ strlen(linebuffer
);
1201 free (history_value
);
1205 /* If we just got an empty line, and that is supposed
1206 to repeat the previous command, return the value in the
1210 if (p
== linebuffer
)
1213 while (*p1
== ' ' || *p1
== '\t')
1221 /* Add line to history if appropriate. */
1222 if (instream
== stdin
1223 && ISATTY (stdin
) && *linebuffer
)
1224 add_history (linebuffer
);
1226 /* Note: lines consisting soley of comments are added to the command
1227 history. This is useful when you type a command, and then
1228 realize you don't want to execute it quite yet. You can comment
1229 out the command and then later fetch it from the value history
1230 and remove the '#'. The kill ring is probably better, but some
1231 people are in the habit of commenting things out. */
1233 while ((c
= *p1
++) != '\0')
1236 while ((c
= *p1
++) != '"')
1238 /* Make sure an escaped '"' doesn't make us think the string
1246 while ((c
= *p1
++) != '\'')
1248 /* Make sure an escaped '\'' doesn't make us think the string
1257 /* Found a comment. */
1263 /* Save into global buffer if appropriate. */
1266 if (linelength
> linesize
)
1268 line
= xrealloc (line
, linelength
);
1269 linesize
= linelength
;
1271 strcpy (line
, linebuffer
);
1278 /* Read lines from the input stream
1279 and accumulate them in a chain of struct command_line's
1280 which is then returned. */
1282 struct command_line
*
1283 read_command_lines ()
1285 struct command_line
*first
= 0;
1286 register struct command_line
*next
, *tail
= 0;
1287 register char *p
, *p1
;
1288 struct cleanup
*old_chain
= 0;
1293 p
= command_line_input (0, instream
== stdin
);
1295 /* Treat end of file like "end". */
1298 /* Remove leading and trailing blanks. */
1299 while (*p
== ' ' || *p
== '\t') p
++;
1300 p1
= p
+ strlen (p
);
1301 while (p1
!= p
&& (p1
[-1] == ' ' || p1
[-1] == '\t')) p1
--;
1303 /* Is this "end"? */
1304 if (p1
- p
== 3 && !strncmp (p
, "end", 3))
1307 /* No => add this line to the chain of command lines. */
1308 next
= (struct command_line
*) xmalloc (sizeof (struct command_line
));
1309 next
->line
= savestring (p
, p1
- p
);
1317 /* We just read the first line.
1318 From now on, arrange to throw away the lines we have
1319 if we quit or get an error while inside this function. */
1321 old_chain
= make_cleanup (free_command_lines
, &first
);
1328 /* Now we are about to return the chain to our caller,
1329 so freeing it becomes his responsibility. */
1331 discard_cleanups (old_chain
);
1335 /* Free a chain of struct command_line's. */
1338 free_command_lines (lptr
)
1339 struct command_line
**lptr
;
1341 register struct command_line
*l
= *lptr
;
1342 register struct command_line
*next
;
1353 /* Add an element to the list of info subcommands. */
1356 add_info (name
, fun
, doc
)
1361 add_cmd (name
, no_class
, fun
, doc
, &infolist
);
1364 /* Add an alias to the list of info subcommands. */
1367 add_info_alias (name
, oldname
, abbrev_flag
)
1372 add_alias_cmd (name
, oldname
, 0, abbrev_flag
, &infolist
);
1375 /* The "info" command is defined as a prefix, with allow_unknown = 0.
1376 Therefore, its own definition is called only for "info" with no args. */
1380 info_command (arg
, from_tty
)
1384 printf ("\"info\" must be followed by the name of an info command.\n");
1385 help_list (infolist
, "info ", -1, stdout
);
1388 /* The "show" command with no arguments shows all the settings. */
1392 show_command (arg
, from_tty
)
1396 cmd_show_list (showlist
, from_tty
, "");
1399 /* Add an element to the list of commands. */
1402 add_com (name
, class, fun
, doc
)
1404 enum command_class
class;
1408 add_cmd (name
, class, fun
, doc
, &cmdlist
);
1411 /* Add an alias or abbreviation command to the list of commands. */
1414 add_com_alias (name
, oldname
, class, abbrev_flag
)
1417 enum command_class
class;
1420 add_alias_cmd (name
, oldname
, class, abbrev_flag
, &cmdlist
);
1427 error ("Argument required (%s).", why
);
1431 help_command (command
, from_tty
)
1433 int from_tty
; /* Ignored */
1435 help_cmd (command
, stdout
);
1439 validate_comname (comname
)
1445 error_no_arg ("name of command to define");
1450 if (!(*p
>= 'A' && *p
<= 'Z')
1451 && !(*p
>= 'a' && *p
<= 'z')
1452 && !(*p
>= '0' && *p
<= '9')
1454 error ("Junk in argument list: \"%s\"", p
);
1460 define_command (comname
, from_tty
)
1464 register struct command_line
*cmds
;
1465 register struct cmd_list_element
*c
, *newc
;
1466 char *tem
= comname
;
1467 extern void not_just_help_class_command ();
1469 validate_comname (comname
);
1471 c
= lookup_cmd (&tem
, cmdlist
, "", -1, 1);
1474 if (c
->class == class_user
|| c
->class == class_alias
)
1475 tem
= "Redefine command \"%s\"? ";
1477 tem
= "Really redefine built-in command \"%s\"? ";
1478 if (!query (tem
, comname
))
1479 error ("Command \"%s\" not redefined.", comname
);
1484 printf ("Type commands for definition of \"%s\".\n\
1485 End with a line saying just \"end\".\n", comname
);
1488 comname
= savestring (comname
, strlen (comname
));
1490 cmds
= read_command_lines ();
1492 if (c
&& c
->class == class_user
)
1493 free_command_lines (&c
->user_commands
);
1495 newc
= add_cmd (comname
, class_user
, not_just_help_class_command
,
1496 (c
&& c
->class == class_user
)
1497 ? c
->doc
: savestring ("User-defined.", 13), &cmdlist
);
1498 newc
->user_commands
= cmds
;
1502 document_command (comname
, from_tty
)
1506 struct command_line
*doclines
;
1507 register struct cmd_list_element
*c
;
1508 char *tem
= comname
;
1510 validate_comname (comname
);
1512 c
= lookup_cmd (&tem
, cmdlist
, "", 0, 1);
1514 if (c
->class != class_user
)
1515 error ("Command \"%s\" is built-in.", comname
);
1518 printf ("Type documentation for \"%s\".\n\
1519 End with a line saying just \"end\".\n", comname
);
1521 doclines
= read_command_lines ();
1523 if (c
->doc
) free (c
->doc
);
1526 register struct command_line
*cl1
;
1527 register int len
= 0;
1529 for (cl1
= doclines
; cl1
; cl1
= cl1
->next
)
1530 len
+= strlen (cl1
->line
) + 1;
1532 c
->doc
= (char *) xmalloc (len
+ 1);
1535 for (cl1
= doclines
; cl1
; cl1
= cl1
->next
)
1537 strcat (c
->doc
, cl1
->line
);
1539 strcat (c
->doc
, "\n");
1543 free_command_lines (&doclines
);
1547 print_gdb_version (shout
)
1550 printf ("GDB %s, Copyright (C) 1991 Free Software Foundation, Inc.\n",
1554 There is ABSOLUTELY NO WARRANTY for GDB; type \"info warranty\" for details.\n\
1555 GDB is free software and you are welcome to distribute copies of it\n\
1556 under certain conditions; type \"info copying\" to see the conditions.\n");
1560 version_info (args
, from_tty
)
1565 print_gdb_version (0);
1569 /* xgdb calls this to reprint the usual GDB prompt. */
1574 printf ("%s", prompt
);
1579 quit_command (args
, from_tty
)
1583 if (inferior_pid
!= 0)
1585 if (query ("The program is running. Quit anyway? "))
1587 target_kill (args
, from_tty
);
1590 error ("Not confirmed.");
1592 /* Save the history information if it is appropriate to do so. */
1593 if (write_history_p
&& history_filename
)
1594 write_history (history_filename
);
1599 input_from_terminal_p ()
1601 return (instream
== stdin
) & caution
;
1605 pwd_command (args
, from_tty
)
1609 if (args
) error ("The \"pwd\" command does not take an argument: %s", args
);
1612 if (strcmp (dirbuf
, current_directory
))
1613 printf ("Working directory %s\n (canonically %s).\n",
1614 current_directory
, dirbuf
);
1616 printf ("Working directory %s.\n", current_directory
);
1620 cd_command (dir
, from_tty
)
1628 error_no_arg ("new working directory");
1630 dir
= tilde_expand (dir
);
1631 make_cleanup (free
, dir
);
1634 dir
= savestring (dir
, len
- (len
> 1 && dir
[len
-1] == '/'));
1636 current_directory
= dir
;
1639 current_directory
= concat (current_directory
, "/", dir
);
1643 /* Now simplify any occurrences of `.' and `..' in the pathname. */
1651 for (p
= current_directory
; *p
;)
1653 if (!strncmp (p
, "/./", 2)
1654 && (p
[2] == 0 || p
[2] == '/'))
1656 else if (!strncmp (p
, "/..", 3)
1657 && (p
[3] == 0 || p
[3] == '/')
1658 && p
!= current_directory
)
1661 while (q
!= current_directory
&& q
[-1] != '/') q
--;
1662 if (q
!= current_directory
)
1672 if (chdir (dir
) < 0)
1673 perror_with_name (dir
);
1675 forget_cached_source_info ();
1678 pwd_command ((char *) 0, 1);
1682 source_command (args
, from_tty
)
1687 struct cleanup
*cleanups
;
1691 /* Let source without arguments read .gdbinit. */
1694 file
= tilde_expand (file
);
1695 make_cleanup (free
, file
);
1697 stream
= fopen (file
, "r");
1699 perror_with_name (file
);
1701 cleanups
= make_cleanup (fclose
, stream
);
1703 read_command_file (stream
);
1705 do_cleanups (cleanups
);
1710 echo_command (text
, from_tty
)
1722 /* \ at end of argument is used after spaces
1723 so they won't be lost. */
1727 c
= parse_escape (&p
);
1738 dump_me_command (args
, from_tty
)
1742 if (query ("Should GDB dump core? "))
1744 signal (SIGQUIT
, SIG_DFL
);
1745 kill (getpid (), SIGQUIT
);
1749 /* Functions to manipulate command line editing control variables. */
1751 /* Number of commands to print in each call to editing_info. */
1752 #define Hist_print 10
1754 editing_info (args
, from_tty
)
1758 /* Index for history commands. Relative to history_base. */
1761 /* Number of the history entry which we are planning to display next.
1762 Relative to history_base. */
1765 /* The first command in the history which doesn't exist (i.e. one more
1766 than the number of the last command). Relative to history_base. */
1769 struct _hist_entry
*history_get();
1770 extern int history_base
;
1773 /* This is all reported by individual "show" commands. */
1774 printf_filtered ("Interactive command editing is %s.\n",
1775 command_editing_p
? "on" : "off");
1777 printf_filtered ("History expansion of command input is %s.\n",
1778 history_expansion_p
? "on" : "off");
1779 printf_filtered ("Writing of a history record upon exit is %s.\n",
1780 write_history_p
? "enabled" : "disabled");
1781 printf_filtered ("The size of the history list (number of stored commands) is %d.\n",
1783 printf_filtered ("The name of the history record is \"%s\".\n\n",
1784 history_filename
? history_filename
: "");
1787 /* Print out some of the commands from the command history. */
1788 /* First determine the length of the history list. */
1789 hist_len
= history_size
;
1790 for (offset
= 0; offset
< history_size
; offset
++)
1792 if (!history_get (history_base
+ offset
))
1801 if (args
[0] == '+' && args
[1] == '\0')
1802 /* "info editing +" should print from the stored position. */
1805 /* "info editing <exp>" should print around command number <exp>. */
1806 num
= (parse_and_eval_address (args
) - history_base
) - Hist_print
/ 2;
1808 /* "info editing" means print the last Hist_print commands. */
1811 num
= hist_len
- Hist_print
;
1817 /* If there are at least Hist_print commands, we want to display the last
1818 Hist_print rather than, say, the last 6. */
1819 if (hist_len
- num
< Hist_print
)
1821 num
= hist_len
- Hist_print
;
1827 /* No need for a header now that "info editing" only prints one thing. */
1828 if (num
== hist_len
- Hist_print
)
1829 printf_filtered ("The list of the last %d commands is:\n\n", Hist_print
);
1831 printf_filtered ("Some of the stored commands are:\n\n");
1834 for (offset
= num
; offset
< num
+ Hist_print
&& offset
< hist_len
; offset
++)
1836 printf_filtered ("%5d %s\n", history_base
+ offset
,
1837 (history_get (history_base
+ offset
))->line
);
1840 /* The next command we want to display is the next one that we haven't
1844 /* If the user repeats this command with return, it should do what
1845 "info editing +" does. This is unnecessary if arg is null,
1846 because "info editing +" is not useful after "info editing". */
1847 if (from_tty
&& args
)
1854 /* Called by do_setshow_command. */
1856 set_history_size_command (args
, from_tty
, c
)
1859 struct cmd_list_element
*c
;
1861 if (history_size
== UINT_MAX
)
1862 unstifle_history ();
1864 stifle_history (history_size
);
1868 set_history (args
, from_tty
)
1872 printf ("\"set history\" must be followed by the name of a history subcommand.\n");
1873 help_list (sethistlist
, "set history ", -1, stdout
);
1877 show_history (args
, from_tty
)
1881 cmd_show_list (showhistlist
, from_tty
);
1884 int info_verbose
= 0; /* Default verbose msgs off */
1886 /* Called by do_setshow_command. An elaborate joke. */
1888 set_verbose (args
, from_tty
, c
)
1891 struct cmd_list_element
*c
;
1893 char *cmdname
= "verbose";
1894 struct cmd_list_element
*showcmd
;
1896 showcmd
= lookup_cmd_1 (&cmdname
, showlist
, NULL
, 1);
1900 c
->doc
= "Set verbose printing of informational messages.";
1901 showcmd
->doc
= "Show verbose printing of informational messages.";
1905 c
->doc
= "Set verbosity.";
1906 showcmd
->doc
= "Show verbosity.";
1913 /* This message is based on ANSI C, section 4.7. Note that integer
1914 divide by zero causes this, so "float" is a misnomer. */
1915 error ("Erroneous arithmetic operation.");
1918 /* Return whether we are running a batch file or from terminal. */
1922 return !(instream
== stdin
&& ISATTY (stdin
));
1927 initialize_cmd_lists ()
1929 cmdlist
= (struct cmd_list_element
*) 0;
1930 infolist
= (struct cmd_list_element
*) 0;
1931 enablelist
= (struct cmd_list_element
*) 0;
1932 disablelist
= (struct cmd_list_element
*) 0;
1933 deletelist
= (struct cmd_list_element
*) 0;
1934 enablebreaklist
= (struct cmd_list_element
*) 0;
1935 setlist
= (struct cmd_list_element
*) 0;
1937 sethistlist
= (struct cmd_list_element
*) 0;
1938 showhistlist
= NULL
;
1939 unsethistlist
= (struct cmd_list_element
*) 0;
1945 struct cmd_list_element
*c
;
1949 #ifdef DEFAULT_PROMPT
1950 prompt
= savestring (DEFAULT_PROMPT
, strlen(DEFAULT_PROMPT
));
1952 prompt
= savestring ("(gdb) ", 6);
1955 /* Set the important stuff up for command editing. */
1956 command_editing_p
= 1;
1957 history_expansion_p
= 0;
1958 write_history_p
= 0;
1960 if (tmpenv
= getenv ("HISTSIZE"))
1961 history_size
= atoi (tmpenv
);
1965 stifle_history (history_size
);
1967 if (tmpenv
= getenv ("GDBHISTFILE"))
1968 history_filename
= savestring (tmpenv
, strlen(tmpenv
));
1970 /* We include the current directory so that if the user changes
1971 directories the file written will be the same as the one
1973 history_filename
= concat (current_directory
, "/.gdb_history", "");
1975 read_history (history_filename
);
1977 /* Setup important stuff for command line editing. */
1978 rl_completion_entry_function
= (int (*)()) symbol_completion_function
;
1979 rl_completer_word_break_characters
= gdb_completer_word_break_characters
;
1980 rl_readline_name
= "gdb";
1982 /* Define the classes of commands.
1983 They will appear in the help list in the reverse of this order. */
1985 add_cmd ("obscure", class_obscure
, NO_FUNCTION
, "Obscure features.", &cmdlist
);
1986 add_cmd ("aliases", class_alias
, NO_FUNCTION
, "Aliases of other commands.", &cmdlist
);
1987 add_cmd ("user-defined", class_user
, NO_FUNCTION
, "User-defined commands.\n\
1988 The commands in this class are those defined by the user.\n\
1989 Use the \"define\" command to define a command.", &cmdlist
);
1990 add_cmd ("support", class_support
, NO_FUNCTION
, "Support facilities.", &cmdlist
);
1991 add_cmd ("status", class_info
, NO_FUNCTION
, "Status inquiries.", &cmdlist
);
1992 add_cmd ("files", class_files
, NO_FUNCTION
, "Specifying and examining files.", &cmdlist
);
1993 add_cmd ("breakpoints", class_breakpoint
, NO_FUNCTION
, "Making program stop at certain points.", &cmdlist
);
1994 add_cmd ("data", class_vars
, NO_FUNCTION
, "Examining data.", &cmdlist
);
1995 add_cmd ("stack", class_stack
, NO_FUNCTION
, "Examining the stack.\n\
1996 The stack is made up of stack frames. Gdb assigns numbers to stack frames\n\
1997 counting from zero for the innermost (currently executing) frame.\n\n\
1998 At any time gdb identifies one frame as the \"selected\" frame.\n\
1999 Variable lookups are done with respect to the selected frame.\n\
2000 When the program being debugged stops, gdb selects the innermost frame.\n\
2001 The commands below can be used to select other frames by number or address.",
2003 add_cmd ("running", class_run
, NO_FUNCTION
, "Running the program.", &cmdlist
);
2005 add_com ("pwd", class_files
, pwd_command
,
2006 "Print working directory. This is used for your program as well.");
2007 add_com ("cd", class_files
, cd_command
,
2008 "Set working directory to DIR for debugger and program being debugged.\n\
2009 The change does not take effect for the program being debugged\n\
2010 until the next time it is started.");
2013 (add_set_cmd ("prompt", class_support
, var_string
, (char *)&prompt
,
2018 add_com ("echo", class_support
, echo_command
,
2019 "Print a constant string. Give string as argument.\n\
2020 C escape sequences may be used in the argument.\n\
2021 No newline is added at the end of the argument;\n\
2022 use \"\\n\" if you want a newline to be printed.\n\
2023 Since leading and trailing whitespace are ignored in command arguments,\n\
2024 if you want to print some you must use \"\\\" before leading whitespace\n\
2025 to be printed or after trailing whitespace.");
2026 add_com ("document", class_support
, document_command
,
2027 "Document a user-defined command.\n\
2028 Give command name as argument. Give documentation on following lines.\n\
2029 End with a line of just \"end\".");
2030 add_com ("define", class_support
, define_command
,
2031 "Define a new command name. Command name is argument.\n\
2032 Definition appears on following lines, one command per line.\n\
2033 End with a line of just \"end\".\n\
2034 Use the \"document\" command to give documentation for the new command.\n\
2035 Commands defined in this way do not take arguments.");
2038 add_com ("source", class_support
, source_command
,
2039 "Read commands from a file named FILE.\n\
2040 Note that the file \"" GDBINIT_FILENAME
"\" is read automatically in this way\n\
2041 when gdb is started.");
2043 /* Punt file name, we can't help it easily. */
2044 add_com ("source", class_support
, source_command
,
2045 "Read commands from a file named FILE.\n\
2046 Note that the file \".gdbinit\" is read automatically in this way\n\
2047 when gdb is started.");
2050 add_com ("quit", class_support
, quit_command
, "Exit gdb.");
2051 add_com ("help", class_support
, help_command
, "Print list of commands.");
2052 add_com_alias ("q", "quit", class_support
, 1);
2053 add_com_alias ("h", "help", class_support
, 1);
2056 c
= add_set_cmd ("verbose", class_support
, var_boolean
, (char *)&info_verbose
,
2059 add_show_from_set (c
, &showlist
);
2060 c
->function
= set_verbose
;
2061 set_verbose (NULL
, 0, c
);
2063 add_com ("dump-me", class_obscure
, dump_me_command
,
2064 "Get fatal error; make debugger dump its core.");
2067 (add_set_cmd ("editing", class_support
, var_boolean
, (char *)&command_editing_p
,
2068 "Set command line editing.\n\
2069 Use \"on\" to enable to enable the editing, and \"off\" to disable it.\n\
2070 Without an argument, command line editing is enabled.", &setlist
),
2073 add_prefix_cmd ("history", class_support
, set_history
,
2074 "Generic command for setting command history parameters.",
2075 &sethistlist
, "set history ", 0, &setlist
);
2076 add_prefix_cmd ("history", class_support
, show_history
,
2077 "Generic command for showing command history parameters.",
2078 &showhistlist
, "show history ", 0, &showlist
);
2081 (add_set_cmd ("expansion", no_class
, var_boolean
, (char *)&history_expansion_p
,
2082 "Set history expansion on command input.\n\
2083 Without an argument, history expansion is enabled.", &sethistlist
),
2087 (add_set_cmd ("write", no_class
, var_boolean
, (char *)&write_history_p
,
2088 "Set saving of the history record on exit.\n\
2089 Use \"on\" to enable to enable the saving, and \"off\" to disable it.\n\
2090 Without an argument, saving is enabled.", &sethistlist
),
2093 c
= add_set_cmd ("size", no_class
, var_uinteger
, (char *)&history_size
,
2094 "Set the size of the command history, \n\
2095 ie. the number of previous commands to keep a record of.", &sethistlist
);
2096 add_show_from_set (c
, &showhistlist
);
2097 c
->function
= set_history_size_command
;
2100 (add_set_cmd ("filename", no_class
, var_filename
, (char *)&history_filename
,
2101 "Set the filename in which to record the command history\n\
2102 (the list of previous commands of which a record is kept).", &sethistlist
),
2106 (add_set_cmd ("caution", class_support
, var_boolean
,
2108 "Set expected caution of user.\n\
2109 If on (the default), more warnings are printed, and the user is asked whether\n\
2110 they really want to do various major commands.", &setlist
),
2113 add_prefix_cmd ("info", class_info
, info_command
,
2114 "Generic command for printing status.",
2115 &infolist
, "info ", 0, &cmdlist
);
2116 add_com_alias ("i", "info", class_info
, 1);
2118 add_prefix_cmd ("show", class_info
, show_command
,
2119 "Generic command for showing things set with \"set\".",
2120 &showlist
, "show ", 0, &cmdlist
);
2121 /* Another way to get at the same thing. */
2122 add_info ("set", show_command
, "Show all GDB settings.");
2124 add_info ("editing", editing_info
, "Status of command editor.");
2126 add_info ("version", version_info
, "Report what version of GDB this is.");