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 This program 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 2 of the License, or
9 (at your option) any later version.
11 This program 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 this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
29 #include "breakpoint.h"
33 /* readline include files */
37 /* readline defines this. */
41 #include <sys/types.h>
48 #include <sys/param.h>
52 #ifdef SET_STACK_LIMIT_HUGE
54 #include <sys/resource.h>
56 int original_stack_limit
;
60 /* If this definition isn't overridden by the header files, assume
61 that isatty and fileno exist on this system. */
63 #define ISATTY(FP) (isatty (fileno (FP)))
66 /* Initialization file name for gdb. This is overridden in some configs. */
68 #ifndef GDBINIT_FILENAME
69 #define GDBINIT_FILENAME ".gdbinit"
71 char gdbinit
[] = GDBINIT_FILENAME
;
73 #define ALL_CLEANUPS ((struct cleanup *)0)
75 /* Version number of GDB, as a string. */
79 /* Message to be printed before the error message, when an error occurs. */
81 extern char *error_pre_print
;
83 /* Flag for whether we want all the "from_tty" gubbish printed. */
85 int caution
= 1; /* Default is yes, sigh. */
88 * Define all cmd_list_element's
91 /* Chain containing all defined commands. */
93 struct cmd_list_element
*cmdlist
;
95 /* Chain containing all defined info subcommands. */
97 struct cmd_list_element
*infolist
;
99 /* Chain containing all defined enable subcommands. */
101 struct cmd_list_element
*enablelist
;
103 /* Chain containing all defined disable subcommands. */
105 struct cmd_list_element
*disablelist
;
107 /* Chain containing all defined delete subcommands. */
109 struct cmd_list_element
*deletelist
;
111 /* Chain containing all defined "enable breakpoint" subcommands. */
113 struct cmd_list_element
*enablebreaklist
;
115 /* Chain containing all defined set subcommands */
117 struct cmd_list_element
*setlist
;
119 /* Chain containing all defined show subcommands. */
120 struct cmd_list_element
*showlist
;
122 /* Chain containing all defined \"set history\". */
124 struct cmd_list_element
*sethistlist
;
126 /* Chain containing all defined \"show history\". */
127 struct cmd_list_element
*showhistlist
;
129 /* Chain containing all defined \"unset history\". */
131 struct cmd_list_element
*unsethistlist
;
133 /* stdio stream that command input is being read from. */
137 /* Current working directory. */
139 char *current_directory
;
141 /* The directory name is actually stored here (usually). */
142 static char dirbuf
[MAXPATHLEN
];
144 /* Function to call before reading a command, if nonzero.
145 The function receives two args: an input stream,
146 and a prompt string. */
148 void (*window_hook
) ();
150 extern int frame_file_full_name
;
154 /* The external commands we call... */
155 extern void init_source_path ();
156 extern void directory_command ();
157 extern void exec_file_command ();
158 extern void symbol_file_command ();
159 extern void core_file_command ();
160 extern void tty_command ();
162 extern void help_list ();
163 extern void initialize_all_files ();
164 extern void init_malloc ();
166 /* Forward declarations for this file */
167 void free_command_lines ();
168 char *gdb_readline ();
169 char *command_line_input ();
170 static void initialize_main ();
171 static void initialize_cmd_lists ();
172 static void init_signals ();
173 static void quit_command ();
174 void command_loop ();
175 static void source_command ();
176 static void print_gdb_version ();
177 static void print_gnu_advertisement ();
178 static void float_handler ();
179 static void cd_command ();
180 static void read_command_file ();
184 /* gdb prints this when reading a command interactively */
187 /* Buffer used for reading command lines, and the size
188 allocated for it so far. */
193 /* Baud rate specified for talking to serial target systems. Default
194 is left as a zero pointer, so targets can choose their own defaults. */
198 /* Signal to catch ^Z typed while reading a command: SIGTSTP or SIGCONT. */
202 #define STOP_SIGNAL SIGTSTP
206 /* Some System V have job control but not sigsetmask(). */
207 #if !defined (HAVE_SIGSETMASK)
208 #define HAVE_SIGSETMASK !defined (USG)
212 #define sigsetmask(n)
215 /* This is how `error' returns to command level. */
217 jmp_buf to_top_level
;
220 return_to_top_level ()
224 bpstat_clear_actions(stop_bpstat
); /* Clear queued breakpoint commands */
225 clear_momentary_breakpoints ();
226 disable_current_display ();
227 do_cleanups (ALL_CLEANUPS
);
228 longjmp (to_top_level
, 1);
231 /* Call FUNC with arg ARGS, catching any errors.
232 If there is no error, return the value returned by FUNC.
233 If there is an error, print ERRSTRING, print the specific error message,
237 catch_errors (func
, args
, errstring
)
244 struct cleanup
*saved_cleanup_chain
;
245 char *saved_error_pre_print
;
247 saved_cleanup_chain
= save_cleanups ();
248 saved_error_pre_print
= error_pre_print
;
250 bcopy (to_top_level
, saved
, sizeof (jmp_buf));
251 error_pre_print
= errstring
;
253 if (setjmp (to_top_level
) == 0)
254 val
= (*func
) (args
);
258 restore_cleanups (saved_cleanup_chain
);
260 error_pre_print
= saved_error_pre_print
;
261 bcopy (saved
, to_top_level
, sizeof (jmp_buf));
265 /* Handler for SIGHUP. */
270 kill_inferior_fast ();
271 signal (SIGHUP
, SIG_DFL
);
272 kill (getpid (), SIGHUP
);
275 /* Clean up on error during a "source" command (or execution of a
276 user-defined command). */
279 source_cleanup (stream
)
282 /* Restore the previous input stream. */
286 /* Read commands from STREAM. */
288 read_command_file (stream
)
291 struct cleanup
*cleanups
;
293 cleanups
= make_cleanup (source_cleanup
, instream
);
296 do_cleanups (cleanups
);
305 static int inhibit_gdbinit
= 0;
306 static int quiet
= 0;
307 static int batch
= 0;
309 /* Pointers to various arguments from command line. */
311 char *execarg
= NULL
;
312 char *corearg
= NULL
;
316 /* Pointers to all arguments of +command option. */
318 /* Allocated size of cmdarg. */
320 /* Number of elements of cmdarg used. */
323 /* Indices of all arguments of +directory option. */
325 /* Allocated size. */
327 /* Number of elements used. */
332 /* This needs to happen before the first use of malloc. */
335 #if defined (ALIGN_STACK_ON_STARTUP)
336 i
= (int) &count
& 0x3;
342 cmdarg
= (char **) xmalloc (cmdsize
* sizeof (*cmdarg
));
345 dirarg
= (char **) xmalloc (dirsize
* sizeof (*dirarg
));
349 line
= (char *) xmalloc (linesize
);
350 line
[0] = '\0'; /* Terminate saved (now empty) cmd line */
354 current_directory
= dirbuf
;
356 #ifdef SET_STACK_LIMIT_HUGE
360 /* Set the stack limit huge so that alloca (particularly stringtab
361 * in dbxread.c) does not fail. */
362 getrlimit (RLIMIT_STACK
, &rlim
);
363 original_stack_limit
= rlim
.rlim_cur
;
364 rlim
.rlim_cur
= rlim
.rlim_max
;
365 setrlimit (RLIMIT_STACK
, &rlim
);
367 #endif /* SET_STACK_LIMIT_HUGE */
369 /* Parse arguments and options. */
372 static int print_help
;
373 /* When var field is 0, use flag field to record the equivalent
374 short option (or arbitrary numbers starting at 10 for those
375 with no equivalent). */
376 static struct option long_options
[] =
378 {"quiet", 0, &quiet
, 1},
379 {"nx", 0, &inhibit_gdbinit
, 1},
380 {"batch", 0, &batch
, 1},
381 {"epoch", 0, &epoch_interface
, 1},
382 {"fullname", 0, &frame_file_full_name
, 1},
383 {"help", 0, &print_help
, 1},
385 {"symbols", 1, 0, 's'},
390 {"command", 1, 0, 'x'},
392 {"directory", 1, 0, 'd'},
396 /* Allow machine descriptions to add more options... */
397 #ifdef ADDITIONAL_OPTIONS
405 c
= getopt_long_only (argc
, argv
, "",
406 long_options
, &option_index
);
410 /* Long option that takes an argument. */
411 if (c
== 0 && long_options
[option_index
].flag
== 0)
412 c
= long_options
[option_index
].val
;
417 /* Long option that just sets a flag. */
436 cmdarg
[ncmd
++] = optarg
;
440 cmdarg
= (char **) xrealloc ((char *)cmdarg
,
441 cmdsize
* sizeof (*cmdarg
));
445 dirarg
[ndir
++] = optarg
;
449 dirarg
= (char **) xrealloc ((char *)dirarg
,
450 dirsize
* sizeof (*dirarg
));
462 #ifdef ADDITIONAL_OPTION_CASES
463 ADDITIONAL_OPTION_CASES
467 "Use `%s +help' for a complete list of options.\n",
476 This is GDB, the GNU debugger. Use the command\n\
477 gdb [options] [executable [core-file]]\n\
478 to enter the debugger.\n\
480 Options available are:\n\
481 -help Print this message.\n\
482 -quiet Do not print version number on startup.\n\
483 -fullname Output information used by emacs-GDB interface.\n\
484 -epoch Output information used by epoch emacs-GDB interface.\n\
485 -batch Exit after processing options.\n\
486 -nx Do not read .gdbinit file.\n\
487 -tty=TTY Use TTY for input/output by the program being debugged.\n\
488 -cd=DIR Change current directory to DIR.\n\
489 -directory=DIR Search for source files in DIR.\n\
490 -command=FILE Execute GDB commands from FILE.\n\
491 -symbols=SYMFILE Read symbols from SYMFILE.\n\
492 -exec=EXECFILE Use EXECFILE as the executable.\n\
493 -se=FILE Use FILE as symbol file and executable file.\n\
494 -core=COREFILE Analyze the core dump COREFILE.\n\
495 -b BAUDRATE Set serial port baud rate used for remote debugging\n\
497 #ifdef ADDITIONAL_OPTION_HELP
498 fputs (ADDITIONAL_OPTION_HELP
, stderr
);
501 For more information, type \"help\" from within GDB, or consult the\n\
502 GDB manual (available as on-line info or a printed manual).\n", stderr
);
503 /* Exiting after printing this message seems like
504 the most useful thing to do. */
508 /* OK, that's all the options. The other arguments are filenames. */
510 for (; optind
< argc
; optind
++)
514 symarg
= argv
[optind
];
515 execarg
= argv
[optind
];
518 corearg
= argv
[optind
];
522 "Excess command line arguments ignored. (%s%s)\n",
523 argv
[optind
], (optind
== argc
- 1) ? "" : " ...");
530 /* Run the init function of each source file */
532 initialize_cmd_lists (); /* This needs to be done first */
533 initialize_all_files ();
534 initialize_main (); /* But that omits this file! Do it now */
539 /* Print all the junk at the top, with trailing "..." if we are about
540 to read a symbol file (possibly slowly). */
541 print_gnu_advertisement ();
542 print_gdb_version ();
544 printf_filtered ("..");
546 fflush (stdout
); /* Force to screen during slow operations */
549 error_pre_print
= "\n\n";
551 /* Now perform all the actions indicated by the arguments. */
554 if (!setjmp (to_top_level
))
556 cd_command (cdarg
, 0);
560 do_cleanups (ALL_CLEANUPS
);
562 for (i
= 0; i
< ndir
; i
++)
563 if (!setjmp (to_top_level
))
564 directory_command (dirarg
[i
], 0);
566 do_cleanups (ALL_CLEANUPS
);
570 && strcmp (execarg
, symarg
) == 0)
572 /* The exec file and the symbol-file are the same. If we can't open
573 it, better only print one error message. */
574 if (!setjmp (to_top_level
))
576 exec_file_command (execarg
, !batch
);
577 symbol_file_command (symarg
, 0);
583 if (!setjmp (to_top_level
))
584 exec_file_command (execarg
, !batch
);
586 if (!setjmp (to_top_level
))
587 symbol_file_command (symarg
, 0);
589 do_cleanups (ALL_CLEANUPS
);
591 /* After the symbol file has been read, print a newline to get us
592 beyond the copyright line... But errors should still set off
593 the error message with a (single) blank line. */
594 printf_filtered ("\n");
595 error_pre_print
= "\n";
598 if (!setjmp (to_top_level
))
599 core_file_command (corearg
, !batch
);
600 else if (isdigit (corearg
[0]) && !setjmp (to_top_level
))
601 attach_command (corearg
, !batch
);
602 do_cleanups (ALL_CLEANUPS
);
605 if (!setjmp (to_top_level
))
606 tty_command (ttyarg
, !batch
);
607 do_cleanups (ALL_CLEANUPS
);
609 #ifdef ADDITIONAL_OPTION_HANDLER
610 ADDITIONAL_OPTION_HANDLER
;
613 /* Error messages should no longer be distinguished with extra output. */
617 struct stat homebuf
, cwdbuf
;
618 char *homedir
, *homeinit
;
620 /* Read init file, if it exists in home directory */
621 homedir
= getenv ("HOME");
624 homeinit
= (char *) alloca (strlen (getenv ("HOME")) +
625 strlen (gdbinit
) + 10);
626 strcpy (homeinit
, getenv ("HOME"));
627 strcat (homeinit
, "/");
628 strcat (homeinit
, gdbinit
);
629 if (!inhibit_gdbinit
&& access (homeinit
, R_OK
) == 0)
630 if (!setjmp (to_top_level
))
631 source_command (homeinit
, 0);
632 do_cleanups (ALL_CLEANUPS
);
634 /* Do stats; no need to do them elsewhere since we'll only
635 need them if homedir is set. Make sure that they are
636 zero in case one of them fails (this guarantees that they
637 won't match if either exists). */
639 bzero (&homebuf
, sizeof (struct stat
));
640 bzero (&cwdbuf
, sizeof (struct stat
));
642 stat (homeinit
, &homebuf
);
643 stat (gdbinit
, &cwdbuf
); /* We'll only need this if
647 /* Read the input file in the current directory, *if* it isn't
648 the same file (it should exist, also). */
651 || bcmp ((char *) &homebuf
,
653 sizeof (struct stat
)))
654 if (!inhibit_gdbinit
&& access (gdbinit
, R_OK
) == 0)
655 if (!setjmp (to_top_level
))
656 source_command (gdbinit
, 0);
657 do_cleanups (ALL_CLEANUPS
);
660 for (i
= 0; i
< ncmd
; i
++)
661 if (!setjmp (to_top_level
))
663 if (cmdarg
[i
][0] == '-' && cmdarg
[i
][1] == '\0')
664 read_command_file (stdin
);
666 source_command (cmdarg
[i
], !batch
);
667 do_cleanups (ALL_CLEANUPS
);
673 /* We have hit the end of the batch file. */
677 /* Do any host- or target-specific hacks. This is used for i960 targets
678 to force the user to set a nindy target and spec its parameters. */
680 #ifdef BEFORE_MAIN_LOOP_HOOK
681 BEFORE_MAIN_LOOP_HOOK
;
684 /* The command loop. */
688 if (!setjmp (to_top_level
))
690 do_cleanups (ALL_CLEANUPS
); /* Do complete cleanup */
692 quit_command ((char *)0, instream
== stdin
);
695 /* No exit -- exit is through quit_command. */
698 /* Execute the line P as a command.
699 Pass FROM_TTY as second argument to the defining function. */
702 execute_command (p
, from_tty
)
706 register struct cmd_list_element
*c
;
707 register struct command_line
*cmdlines
;
711 /* This can happen when command_line_input hits end of file. */
715 while (*p
== ' ' || *p
== '\t') p
++;
720 c
= lookup_cmd (&p
, cmdlist
, "", 0, 1);
721 /* Pass null arg rather than an empty one. */
723 if (c
->class == class_user
)
725 struct cleanup
*old_chain
;
728 error ("User-defined commands cannot take arguments.");
729 cmdlines
= c
->user_commands
;
734 /* Set the instream to 0, indicating execution of a
735 user-defined function. */
736 old_chain
= make_cleanup (source_cleanup
, instream
);
737 instream
= (FILE *) 0;
740 execute_command (cmdlines
->line
, 0);
741 cmdlines
= cmdlines
->next
;
743 do_cleanups (old_chain
);
745 else if (c
->type
== set_cmd
|| c
->type
== show_cmd
)
746 do_setshow_command (arg
, from_tty
& caution
, c
);
747 else if (c
->function
== NO_FUNCTION
)
748 error ("That is not a command, just a help topic.");
750 (*c
->function
) (arg
, from_tty
& caution
);
756 command_loop_marker (foo
)
761 /* Read commands from `instream' and execute them
762 until end of file or error reading instream. */
766 struct cleanup
*old_chain
;
768 int stdin_is_tty
= ISATTY (stdin
);
770 while (!feof (instream
))
772 if (window_hook
&& instream
== stdin
)
773 (*window_hook
) (instream
, prompt
);
776 if (instream
== stdin
&& stdin_is_tty
)
777 reinitialize_more_filter ();
778 old_chain
= make_cleanup (command_loop_marker
, 0);
779 command
= command_line_input (instream
== stdin
? prompt
: 0,
783 execute_command (command
, instream
== stdin
);
784 /* Do any commands attached to breakpoint we stopped at. */
785 bpstat_do_actions (&stop_bpstat
);
786 do_cleanups (old_chain
);
790 /* Commands call this if they do not want to be repeated by null lines. */
795 /* If we aren't reading from standard input, we are saving the last
796 thing read from stdin in line and don't want to delete it. Null lines
797 won't repeat here in any case. */
798 if (instream
== stdin
)
802 /* Read a line from the stream "instream" without command line editing.
804 It prints PRROMPT once at the start.
805 Action is compatible with "readline", e.g. space for the result is
806 malloc'd and should be freed by the caller.
808 A NULL return means end of file. */
810 gdb_readline (prrompt
)
816 int result_size
= 80;
824 result
= (char *) xmalloc (result_size
);
828 /* Read from stdin if we are executing a user defined command.
829 This is the right thing for prompt_for_continue, at least. */
830 c
= fgetc (instream
? instream
: stdin
);
841 result
[input_index
++] = c
;
842 while (input_index
>= result_size
)
845 result
= (char *) xrealloc (result
, result_size
);
849 result
[input_index
++] = '\0';
853 /* Declaration for fancy readline with command line editing. */
856 /* Variables which control command line editing and history
857 substitution. These variables are given default values at the end
859 static int command_editing_p
;
860 static int history_expansion_p
;
861 static int write_history_p
;
862 static int history_size
;
863 static char *history_filename
;
865 /* Variables which are necessary for fancy command line editing. */
866 char *gdb_completer_word_break_characters
=
867 " \t\n!@#$%^&*()-+=|~`}{[]\"';:?/>.<,";
869 /* Functions that are used as part of the fancy command line editing. */
871 /* This can be used for functions which don't want to complete on symbols
872 but don't want to complete on anything else either. */
875 noop_completer (text
)
881 /* Generate symbol names one by one for the completer. If STATE is
882 zero, then we need to initialize, otherwise the initialization has
883 already taken place. TEXT is what we expect the symbol to start
884 with. RL_LINE_BUFFER is available to be looked at; it contains the
885 entire text of the line. RL_POINT is the offset in that line of
886 the cursor. You should pretend that the line ends at RL_POINT.
887 The result is NULL if there are no more completions, else a char
888 string which is a possible completion. */
890 symbol_completion_function (text
, state
)
894 static char **list
= (char **)NULL
;
897 extern char *rl_line_buffer
;
899 char *tmp_command
, *p
;
900 struct cmd_list_element
*c
, *result_list
;
904 /* Free the storage used by LIST, but not by the strings inside. This is
905 because rl_complete_internal () frees the strings. */
911 /* Decide whether to complete on a list of gdb commands or on
913 tmp_command
= (char *) alloca (rl_point
+ 1);
916 strncpy (tmp_command
, rl_line_buffer
, rl_point
);
917 tmp_command
[rl_point
] = '\0';
921 /* An empty line we want to consider ambiguous; that is,
922 it could be any command. */
923 c
= (struct cmd_list_element
*) -1;
927 c
= lookup_cmd_1 (&p
, cmdlist
, &result_list
, 1);
929 /* Move p up to the next interesting thing. */
930 while (*p
== ' ' || *p
== '\t')
934 /* He's typed something unrecognizable. Sigh. */
936 else if (c
== (struct cmd_list_element
*) -1)
938 /* If we didn't recognize everything up to the thing that
939 needs completing, and we don't know what command it is
940 yet, we are in trouble. Part of the trouble might be
941 that the list of delimiters used by readline includes
942 '-', which we use in commands. Check for this. */
943 if (p
+ strlen(text
) != tmp_command
+ rl_point
) {
944 if (tmp_command
[rl_point
- strlen(text
) - 1] == '-')
947 /* This really should not produce an error. Better would
948 be to pretend to hit RETURN here; this would produce a
949 response like "Ambiguous command: foo, foobar, etc",
950 and leave the line available for re-entry with ^P. Instead,
951 this error blows away the user's typed input without
952 any way to get it back. */
953 error (" Unrecognized command.");
957 /* He's typed something ambiguous. This is easier. */
959 list
= complete_on_cmdlist (*result_list
->prefixlist
, text
);
961 list
= complete_on_cmdlist (cmdlist
, text
);
965 /* If we've gotten this far, gdb has recognized a full
966 command. There are several possibilities:
968 1) We need to complete on the command.
969 2) We need to complete on the possibilities coming after
971 2) We need to complete the text of what comes after the
975 /* Always (might be longer versions of thie command). */
976 list
= complete_on_cmdlist (result_list
, text
);
977 else if (!*p
&& !*text
)
980 list
= complete_on_cmdlist (*c
->prefixlist
, "");
982 list
= (*c
->completer
) ("");
986 if (c
->prefixlist
&& !c
->allow_unknown
)
989 /* Something like "info adsfkdj". But error() is not
990 the proper response; just return no completions
993 error ("\"%s\" command requires a subcommand.",
1000 list
= (*c
->completer
) (text
);
1005 /* If the debugged program wasn't compiled with symbols, or if we're
1006 clearly completing on a command and no command matches, return
1009 return ((char *)NULL
);
1011 output
= list
[index
];
1022 #if STOP_SIGNAL == SIGTSTP
1023 signal (SIGTSTP
, SIG_DFL
);
1025 kill (getpid (), SIGTSTP
);
1026 signal (SIGTSTP
, stop_sig
);
1028 signal (STOP_SIGNAL
, stop_sig
);
1030 printf ("%s", prompt
);
1033 /* Forget about any previous command -- null line now will do nothing. */
1036 #endif /* STOP_SIGNAL */
1038 /* Initialize signal handlers. */
1047 extern void request_quit ();
1049 signal (SIGINT
, request_quit
);
1051 /* If we initialize SIGQUIT to SIG_IGN, then the SIG_IGN will get
1052 passed to the inferior, which we don't want. It would be
1053 possible to do a "signal (SIGQUIT, SIG_DFL)" after we fork, but
1054 on BSD4.3 systems using vfork, that can affect the
1055 GDB process as well as the inferior (the signal handling tables
1056 might be in memory, shared between the two). Since we establish
1057 a handler for SIGQUIT, when we call exec it will set the signal
1058 to SIG_DFL for us. */
1059 signal (SIGQUIT
, do_nothing
);
1060 if (signal (SIGHUP
, do_nothing
) != SIG_IGN
)
1061 signal (SIGHUP
, disconnect
);
1062 signal (SIGFPE
, float_handler
);
1065 /* Read one line from the command input stream `instream'
1066 into the local static buffer `linebuffer' (whose current length
1068 The buffer is made bigger as necessary.
1069 Returns the address of the start of the line.
1071 NULL is returned for end of file.
1073 *If* the instream == stdin & stdin is a terminal, the line read
1074 is copied into the file line saver (global var char *line,
1075 length linesize) so that it can be duplicated.
1077 This routine either uses fancy command line editing or
1078 simple input as the user has requested. */
1081 command_line_input (prrompt
, repeat
)
1085 static char *linebuffer
= 0;
1086 static int linelength
= 0;
1090 char *local_prompt
= prrompt
;
1095 if (linebuffer
== 0)
1098 linebuffer
= (char *) xmalloc (linelength
);
1103 /* Control-C quits instantly if typed while in this loop
1104 since it should not wait until the user types a newline. */
1107 signal (STOP_SIGNAL
, stop_sig
);
1112 /* Reports are that some Sys V's don't flush stdout/err on reads
1113 from stdin, when stdin/out are sockets rather than ttys. So we
1114 have to do it ourselves, to make emacs-gdb and xxgdb work.
1115 On other machines, doing this once per input should be a cheap nop. */
1119 /* Don't use fancy stuff if not talking to stdin. */
1120 if (command_editing_p
&& instream
== stdin
1121 && ISATTY (instream
))
1122 rl
= readline (local_prompt
);
1124 rl
= gdb_readline (local_prompt
);
1126 if (!rl
|| rl
== (char *) EOF
)
1131 if (strlen(rl
) + 1 + (p
- linebuffer
) > linelength
)
1133 linelength
= strlen(rl
) + 1 + (p
- linebuffer
);
1134 nline
= (char *) xrealloc (linebuffer
, linelength
);
1135 p
+= nline
- linebuffer
;
1139 /* Copy line. Don't copy null at end. (Leaves line alone
1140 if this was just a newline) */
1144 free (rl
); /* Allocated in readline. */
1146 if (p
== linebuffer
|| *(p
- 1) != '\\')
1149 p
--; /* Put on top of '\'. */
1150 local_prompt
= (char *) 0;
1154 signal (SIGTSTP
, SIG_DFL
);
1161 /* Do history expansion if that is wished. */
1162 if (history_expansion_p
&& instream
== stdin
1163 && ISATTY (instream
))
1165 char *history_value
;
1168 *p
= '\0'; /* Insert null now. */
1169 expanded
= history_expand (linebuffer
, &history_value
);
1172 /* Print the changes. */
1173 printf ("%s\n", history_value
);
1175 /* If there was an error, call this function again. */
1178 free (history_value
);
1179 return command_line_input (prrompt
, repeat
);
1181 if (strlen (history_value
) > linelength
)
1183 linelength
= strlen (history_value
) + 1;
1184 linebuffer
= (char *) xrealloc (linebuffer
, linelength
);
1186 strcpy (linebuffer
, history_value
);
1187 p
= linebuffer
+ strlen(linebuffer
);
1188 free (history_value
);
1192 /* If we just got an empty line, and that is supposed
1193 to repeat the previous command, return the value in the
1197 if (p
== linebuffer
)
1200 while (*p1
== ' ' || *p1
== '\t')
1208 /* Add line to history if appropriate. */
1209 if (instream
== stdin
1210 && ISATTY (stdin
) && *linebuffer
)
1211 add_history (linebuffer
);
1213 /* Note: lines consisting soley of comments are added to the command
1214 history. This is useful when you type a command, and then
1215 realize you don't want to execute it quite yet. You can comment
1216 out the command and then later fetch it from the value history
1217 and remove the '#'. The kill ring is probably better, but some
1218 people are in the habit of commenting things out. */
1220 while ((c
= *p1
++) != '\0')
1223 while ((c
= *p1
++) != '"')
1225 /* Make sure an escaped '"' doesn't make us think the string
1233 while ((c
= *p1
++) != '\'')
1235 /* Make sure an escaped '\'' doesn't make us think the string
1244 /* Found a comment. */
1250 /* Save into global buffer if appropriate. */
1253 if (linelength
> linesize
)
1255 line
= xrealloc (line
, linelength
);
1256 linesize
= linelength
;
1258 strcpy (line
, linebuffer
);
1265 /* Read lines from the input stream
1266 and accumulate them in a chain of struct command_line's
1267 which is then returned. */
1269 struct command_line
*
1270 read_command_lines ()
1272 struct command_line
*first
= 0;
1273 register struct command_line
*next
, *tail
= 0;
1274 register char *p
, *p1
;
1275 struct cleanup
*old_chain
= 0;
1280 p
= command_line_input (0, instream
== stdin
);
1282 /* Treat end of file like "end". */
1285 /* Remove leading and trailing blanks. */
1286 while (*p
== ' ' || *p
== '\t') p
++;
1287 p1
= p
+ strlen (p
);
1288 while (p1
!= p
&& (p1
[-1] == ' ' || p1
[-1] == '\t')) p1
--;
1290 /* Is this "end"? */
1291 if (p1
- p
== 3 && !strncmp (p
, "end", 3))
1294 /* No => add this line to the chain of command lines. */
1295 next
= (struct command_line
*) xmalloc (sizeof (struct command_line
));
1296 next
->line
= savestring (p
, p1
- p
);
1304 /* We just read the first line.
1305 From now on, arrange to throw away the lines we have
1306 if we quit or get an error while inside this function. */
1308 old_chain
= make_cleanup (free_command_lines
, &first
);
1315 /* Now we are about to return the chain to our caller,
1316 so freeing it becomes his responsibility. */
1318 discard_cleanups (old_chain
);
1322 /* Free a chain of struct command_line's. */
1325 free_command_lines (lptr
)
1326 struct command_line
**lptr
;
1328 register struct command_line
*l
= *lptr
;
1329 register struct command_line
*next
;
1340 /* Add an element to the list of info subcommands. */
1343 add_info (name
, fun
, doc
)
1348 add_cmd (name
, no_class
, fun
, doc
, &infolist
);
1351 /* Add an alias to the list of info subcommands. */
1354 add_info_alias (name
, oldname
, abbrev_flag
)
1359 add_alias_cmd (name
, oldname
, 0, abbrev_flag
, &infolist
);
1362 /* The "info" command is defined as a prefix, with allow_unknown = 0.
1363 Therefore, its own definition is called only for "info" with no args. */
1367 info_command (arg
, from_tty
)
1371 printf ("\"info\" must be followed by the name of an info command.\n");
1372 help_list (infolist
, "info ", -1, stdout
);
1375 /* The "show" command with no arguments shows all the settings. */
1379 show_command (arg
, from_tty
)
1383 cmd_show_list (showlist
, from_tty
, "");
1386 /* Add an element to the list of commands. */
1389 add_com (name
, class, fun
, doc
)
1391 enum command_class
class;
1395 add_cmd (name
, class, fun
, doc
, &cmdlist
);
1398 /* Add an alias or abbreviation command to the list of commands. */
1401 add_com_alias (name
, oldname
, class, abbrev_flag
)
1404 enum command_class
class;
1407 add_alias_cmd (name
, oldname
, class, abbrev_flag
, &cmdlist
);
1414 error ("Argument required (%s).", why
);
1419 help_command (command
, from_tty
)
1421 int from_tty
; /* Ignored */
1423 help_cmd (command
, stdout
);
1427 validate_comname (comname
)
1433 error_no_arg ("name of command to define");
1438 if (!(*p
>= 'A' && *p
<= 'Z')
1439 && !(*p
>= 'a' && *p
<= 'z')
1440 && !(*p
>= '0' && *p
<= '9')
1442 error ("Junk in argument list: \"%s\"", p
);
1448 define_command (comname
, from_tty
)
1452 register struct command_line
*cmds
;
1453 register struct cmd_list_element
*c
, *newc
;
1454 char *tem
= comname
;
1455 extern void not_just_help_class_command ();
1457 validate_comname (comname
);
1459 c
= lookup_cmd (&tem
, cmdlist
, "", -1, 1);
1462 if (c
->class == class_user
|| c
->class == class_alias
)
1463 tem
= "Redefine command \"%s\"? ";
1465 tem
= "Really redefine built-in command \"%s\"? ";
1466 if (!query (tem
, comname
))
1467 error ("Command \"%s\" not redefined.", comname
);
1472 printf ("Type commands for definition of \"%s\".\n\
1473 End with a line saying just \"end\".\n", comname
);
1476 comname
= savestring (comname
, strlen (comname
));
1478 cmds
= read_command_lines ();
1480 if (c
&& c
->class == class_user
)
1481 free_command_lines (&c
->user_commands
);
1483 newc
= add_cmd (comname
, class_user
, not_just_help_class_command
,
1484 (c
&& c
->class == class_user
)
1485 ? c
->doc
: savestring ("User-defined.", 13), &cmdlist
);
1486 newc
->user_commands
= cmds
;
1490 document_command (comname
, from_tty
)
1494 struct command_line
*doclines
;
1495 register struct cmd_list_element
*c
;
1496 char *tem
= comname
;
1498 validate_comname (comname
);
1500 c
= lookup_cmd (&tem
, cmdlist
, "", 0, 1);
1502 if (c
->class != class_user
)
1503 error ("Command \"%s\" is built-in.", comname
);
1506 printf ("Type documentation for \"%s\".\n\
1507 End with a line saying just \"end\".\n", comname
);
1509 doclines
= read_command_lines ();
1511 if (c
->doc
) free (c
->doc
);
1514 register struct command_line
*cl1
;
1515 register int len
= 0;
1517 for (cl1
= doclines
; cl1
; cl1
= cl1
->next
)
1518 len
+= strlen (cl1
->line
) + 1;
1520 c
->doc
= (char *) xmalloc (len
+ 1);
1523 for (cl1
= doclines
; cl1
; cl1
= cl1
->next
)
1525 strcat (c
->doc
, cl1
->line
);
1527 strcat (c
->doc
, "\n");
1531 free_command_lines (&doclines
);
1535 print_gnu_advertisement()
1538 GDB is free software and you are welcome to distribute copies of it\n\
1539 under certain conditions; type \"info copying\" to see the conditions.\n\
1540 There is absolutely no warranty for GDB; type \"info warranty\" for details.\n\
1545 print_gdb_version ()
1548 GDB %s, Copyright 1991 Free Software Foundation, Inc.",
1554 show_version (args
, from_tty
)
1559 print_gnu_advertisement ();
1560 print_gdb_version ();
1561 printf_filtered ("\n");
1565 /* xgdb calls this to reprint the usual GDB prompt. */
1570 printf ("%s", prompt
);
1575 quit_command (args
, from_tty
)
1579 if (inferior_pid
!= 0 && target_has_execution
)
1581 if (query ("The program is running. Quit anyway? "))
1583 target_kill (args
, from_tty
);
1586 error ("Not confirmed.");
1588 /* Save the history information if it is appropriate to do so. */
1589 if (write_history_p
&& history_filename
)
1590 write_history (history_filename
);
1595 input_from_terminal_p ()
1597 return (instream
== stdin
) & caution
;
1602 pwd_command (args
, from_tty
)
1606 if (args
) error ("The \"pwd\" command does not take an argument: %s", args
);
1609 if (strcmp (dirbuf
, current_directory
))
1610 printf ("Working directory %s\n (canonically %s).\n",
1611 current_directory
, dirbuf
);
1613 printf ("Working directory %s.\n", current_directory
);
1617 cd_command (dir
, from_tty
)
1624 /* If the new directory is absolute, repeat is a no-op; if relative,
1625 repeat might be useful but is more likely to be a mistake. */
1629 error_no_arg ("new working directory");
1631 dir
= tilde_expand (dir
);
1632 make_cleanup (free
, dir
);
1635 dir
= savestring (dir
, len
- (len
> 1 && dir
[len
-1] == '/'));
1637 current_directory
= dir
;
1640 current_directory
= concat (current_directory
, "/", dir
);
1644 /* Now simplify any occurrences of `.' and `..' in the pathname. */
1652 for (p
= current_directory
; *p
;)
1654 if (!strncmp (p
, "/./", 2)
1655 && (p
[2] == 0 || p
[2] == '/'))
1657 else if (!strncmp (p
, "/..", 3)
1658 && (p
[3] == 0 || p
[3] == '/')
1659 && p
!= current_directory
)
1662 while (q
!= current_directory
&& q
[-1] != '/') q
--;
1663 if (q
!= current_directory
)
1673 if (chdir (dir
) < 0)
1674 perror_with_name (dir
);
1676 forget_cached_source_info ();
1679 pwd_command ((char *) 0, 1);
1684 source_command (args
, from_tty
)
1689 struct cleanup
*cleanups
;
1693 /* Let source without arguments read .gdbinit. */
1696 file
= tilde_expand (file
);
1697 make_cleanup (free
, file
);
1699 stream
= fopen (file
, "r");
1701 perror_with_name (file
);
1703 cleanups
= make_cleanup (fclose
, stream
);
1705 read_command_file (stream
);
1707 do_cleanups (cleanups
);
1712 echo_command (text
, from_tty
)
1724 /* \ at end of argument is used after spaces
1725 so they won't be lost. */
1729 c
= parse_escape (&p
);
1741 dump_me_command (args
, from_tty
)
1745 if (query ("Should GDB dump core? "))
1747 signal (SIGQUIT
, SIG_DFL
);
1748 kill (getpid (), SIGQUIT
);
1752 /* Functions to manipulate command line editing control variables. */
1754 /* Number of commands to print in each call to show_commands. */
1755 #define Hist_print 10
1757 show_commands (args
, from_tty
)
1761 /* Index for history commands. Relative to history_base. */
1764 /* Number of the history entry which we are planning to display next.
1765 Relative to history_base. */
1768 /* The first command in the history which doesn't exist (i.e. one more
1769 than the number of the last command). Relative to history_base. */
1772 struct _hist_entry
*history_get();
1773 extern int history_base
;
1776 /* This is all reported by individual "show" commands. */
1777 printf_filtered ("Interactive command editing is %s.\n",
1778 command_editing_p
? "on" : "off");
1780 printf_filtered ("History expansion of command input is %s.\n",
1781 history_expansion_p
? "on" : "off");
1782 printf_filtered ("Writing of a history record upon exit is %s.\n",
1783 write_history_p
? "enabled" : "disabled");
1784 printf_filtered ("The size of the history list (number of stored commands) is %d.\n",
1786 printf_filtered ("The name of the history record is \"%s\".\n\n",
1787 history_filename
? history_filename
: "");
1790 /* Print out some of the commands from the command history. */
1791 /* First determine the length of the history list. */
1792 hist_len
= history_size
;
1793 for (offset
= 0; offset
< history_size
; offset
++)
1795 if (!history_get (history_base
+ offset
))
1804 if (args
[0] == '+' && args
[1] == '\0')
1805 /* "info editing +" should print from the stored position. */
1808 /* "info editing <exp>" should print around command number <exp>. */
1809 num
= (parse_and_eval_address (args
) - history_base
) - Hist_print
/ 2;
1811 /* "info editing" means print the last Hist_print commands. */
1814 num
= hist_len
- Hist_print
;
1820 /* If there are at least Hist_print commands, we want to display the last
1821 Hist_print rather than, say, the last 6. */
1822 if (hist_len
- num
< Hist_print
)
1824 num
= hist_len
- Hist_print
;
1830 /* No need for a header now that "info editing" only prints one thing. */
1831 if (num
== hist_len
- Hist_print
)
1832 printf_filtered ("The list of the last %d commands is:\n\n", Hist_print
);
1834 printf_filtered ("Some of the stored commands are:\n\n");
1837 for (offset
= num
; offset
< num
+ Hist_print
&& offset
< hist_len
; offset
++)
1839 printf_filtered ("%5d %s\n", history_base
+ offset
,
1840 (history_get (history_base
+ offset
))->line
);
1843 /* The next command we want to display is the next one that we haven't
1847 /* If the user repeats this command with return, it should do what
1848 "info editing +" does. This is unnecessary if arg is null,
1849 because "info editing +" is not useful after "info editing". */
1850 if (from_tty
&& args
)
1857 /* Called by do_setshow_command. */
1860 set_history_size_command (args
, from_tty
, c
)
1863 struct cmd_list_element
*c
;
1865 if (history_size
== UINT_MAX
)
1866 unstifle_history ();
1868 stifle_history (history_size
);
1873 set_history (args
, from_tty
)
1877 printf ("\"set history\" must be followed by the name of a history subcommand.\n");
1878 help_list (sethistlist
, "set history ", -1, stdout
);
1883 show_history (args
, from_tty
)
1887 cmd_show_list (showhistlist
, from_tty
, "");
1890 int info_verbose
= 0; /* Default verbose msgs off */
1892 /* Called by do_setshow_command. An elaborate joke. */
1895 set_verbose (args
, from_tty
, c
)
1898 struct cmd_list_element
*c
;
1900 char *cmdname
= "verbose";
1901 struct cmd_list_element
*showcmd
;
1903 showcmd
= lookup_cmd_1 (&cmdname
, showlist
, NULL
, 1);
1907 c
->doc
= "Set verbose printing of informational messages.";
1908 showcmd
->doc
= "Show verbose printing of informational messages.";
1912 c
->doc
= "Set verbosity.";
1913 showcmd
->doc
= "Show verbosity.";
1920 /* This message is based on ANSI C, section 4.7. Note that integer
1921 divide by zero causes this, so "float" is a misnomer. */
1922 error ("Erroneous arithmetic operation.");
1925 /* Return whether we are running a batch file or from terminal. */
1929 return !(instream
== stdin
&& ISATTY (stdin
));
1934 initialize_cmd_lists ()
1936 cmdlist
= (struct cmd_list_element
*) 0;
1937 infolist
= (struct cmd_list_element
*) 0;
1938 enablelist
= (struct cmd_list_element
*) 0;
1939 disablelist
= (struct cmd_list_element
*) 0;
1940 deletelist
= (struct cmd_list_element
*) 0;
1941 enablebreaklist
= (struct cmd_list_element
*) 0;
1942 setlist
= (struct cmd_list_element
*) 0;
1944 sethistlist
= (struct cmd_list_element
*) 0;
1945 showhistlist
= NULL
;
1946 unsethistlist
= (struct cmd_list_element
*) 0;
1952 struct cmd_list_element
*c
;
1956 #ifdef DEFAULT_PROMPT
1957 prompt
= savestring (DEFAULT_PROMPT
, strlen(DEFAULT_PROMPT
));
1959 prompt
= savestring ("(gdb) ", 6);
1962 /* Set the important stuff up for command editing. */
1963 command_editing_p
= 1;
1964 history_expansion_p
= 0;
1965 write_history_p
= 0;
1967 if (tmpenv
= getenv ("HISTSIZE"))
1968 history_size
= atoi (tmpenv
);
1972 stifle_history (history_size
);
1974 if (tmpenv
= getenv ("GDBHISTFILE"))
1975 history_filename
= savestring (tmpenv
, strlen(tmpenv
));
1977 /* We include the current directory so that if the user changes
1978 directories the file written will be the same as the one
1980 history_filename
= concat (current_directory
, "/.gdb_history", "");
1982 read_history (history_filename
);
1984 /* Setup important stuff for command line editing. */
1985 rl_completion_entry_function
= (int (*)()) symbol_completion_function
;
1986 rl_completer_word_break_characters
= gdb_completer_word_break_characters
;
1987 rl_readline_name
= "gdb";
1989 /* Define the classes of commands.
1990 They will appear in the help list in the reverse of this order. */
1992 add_cmd ("obscure", class_obscure
, NO_FUNCTION
, "Obscure features.", &cmdlist
);
1993 add_cmd ("aliases", class_alias
, NO_FUNCTION
, "Aliases of other commands.", &cmdlist
);
1994 add_cmd ("user-defined", class_user
, NO_FUNCTION
, "User-defined commands.\n\
1995 The commands in this class are those defined by the user.\n\
1996 Use the \"define\" command to define a command.", &cmdlist
);
1997 add_cmd ("support", class_support
, NO_FUNCTION
, "Support facilities.", &cmdlist
);
1998 add_cmd ("status", class_info
, NO_FUNCTION
, "Status inquiries.", &cmdlist
);
1999 add_cmd ("files", class_files
, NO_FUNCTION
, "Specifying and examining files.", &cmdlist
);
2000 add_cmd ("breakpoints", class_breakpoint
, NO_FUNCTION
, "Making program stop at certain points.", &cmdlist
);
2001 add_cmd ("data", class_vars
, NO_FUNCTION
, "Examining data.", &cmdlist
);
2002 add_cmd ("stack", class_stack
, NO_FUNCTION
, "Examining the stack.\n\
2003 The stack is made up of stack frames. Gdb assigns numbers to stack frames\n\
2004 counting from zero for the innermost (currently executing) frame.\n\n\
2005 At any time gdb identifies one frame as the \"selected\" frame.\n\
2006 Variable lookups are done with respect to the selected frame.\n\
2007 When the program being debugged stops, gdb selects the innermost frame.\n\
2008 The commands below can be used to select other frames by number or address.",
2010 add_cmd ("running", class_run
, NO_FUNCTION
, "Running the program.", &cmdlist
);
2012 add_com ("pwd", class_files
, pwd_command
,
2013 "Print working directory. This is used for your program as well.");
2014 add_com ("cd", class_files
, cd_command
,
2015 "Set working directory to DIR for debugger and program being debugged.\n\
2016 The change does not take effect for the program being debugged\n\
2017 until the next time it is started.");
2020 (add_set_cmd ("prompt", class_support
, var_string
, (char *)&prompt
,
2025 add_com ("echo", class_support
, echo_command
,
2026 "Print a constant string. Give string as argument.\n\
2027 C escape sequences may be used in the argument.\n\
2028 No newline is added at the end of the argument;\n\
2029 use \"\\n\" if you want a newline to be printed.\n\
2030 Since leading and trailing whitespace are ignored in command arguments,\n\
2031 if you want to print some you must use \"\\\" before leading whitespace\n\
2032 to be printed or after trailing whitespace.");
2033 add_com ("document", class_support
, document_command
,
2034 "Document a user-defined command.\n\
2035 Give command name as argument. Give documentation on following lines.\n\
2036 End with a line of just \"end\".");
2037 add_com ("define", class_support
, define_command
,
2038 "Define a new command name. Command name is argument.\n\
2039 Definition appears on following lines, one command per line.\n\
2040 End with a line of just \"end\".\n\
2041 Use the \"document\" command to give documentation for the new command.\n\
2042 Commands defined in this way do not take arguments.");
2045 add_com ("source", class_support
, source_command
,
2046 "Read commands from a file named FILE.\n\
2047 Note that the file \"" GDBINIT_FILENAME
"\" is read automatically in this way\n\
2048 when gdb is started.");
2050 /* Punt file name, we can't help it easily. */
2051 add_com ("source", class_support
, source_command
,
2052 "Read commands from a file named FILE.\n\
2053 Note that the file \".gdbinit\" is read automatically in this way\n\
2054 when gdb is started.");
2057 add_com ("quit", class_support
, quit_command
, "Exit gdb.");
2058 add_com ("help", class_support
, help_command
, "Print list of commands.");
2059 add_com_alias ("q", "quit", class_support
, 1);
2060 add_com_alias ("h", "help", class_support
, 1);
2063 c
= add_set_cmd ("verbose", class_support
, var_boolean
, (char *)&info_verbose
,
2066 add_show_from_set (c
, &showlist
);
2067 c
->function
= set_verbose
;
2068 set_verbose (NULL
, 0, c
);
2070 add_com ("dump-me", class_obscure
, dump_me_command
,
2071 "Get fatal error; make debugger dump its core.");
2074 (add_set_cmd ("editing", class_support
, var_boolean
, (char *)&command_editing_p
,
2075 "Set command line editing.\n\
2076 Use \"on\" to enable to enable the editing, and \"off\" to disable it.\n\
2077 Without an argument, command line editing is enabled.", &setlist
),
2080 add_prefix_cmd ("history", class_support
, set_history
,
2081 "Generic command for setting command history parameters.",
2082 &sethistlist
, "set history ", 0, &setlist
);
2083 add_prefix_cmd ("history", class_support
, show_history
,
2084 "Generic command for showing command history parameters.",
2085 &showhistlist
, "show history ", 0, &showlist
);
2088 (add_set_cmd ("expansion", no_class
, var_boolean
, (char *)&history_expansion_p
,
2089 "Set history expansion on command input.\n\
2090 Without an argument, history expansion is enabled.", &sethistlist
),
2094 (add_set_cmd ("save", no_class
, var_boolean
, (char *)&write_history_p
,
2095 "Set saving of the history record on exit.\n\
2096 Use \"on\" to enable to enable the saving, and \"off\" to disable it.\n\
2097 Without an argument, saving is enabled.", &sethistlist
),
2100 c
= add_set_cmd ("size", no_class
, var_uinteger
, (char *)&history_size
,
2101 "Set the size of the command history, \n\
2102 ie. the number of previous commands to keep a record of.", &sethistlist
);
2103 add_show_from_set (c
, &showhistlist
);
2104 c
->function
= set_history_size_command
;
2107 (add_set_cmd ("filename", no_class
, var_filename
, (char *)&history_filename
,
2108 "Set the filename in which to record the command history\n\
2109 (the list of previous commands of which a record is kept).", &sethistlist
),
2113 (add_set_cmd ("confirm", class_support
, var_boolean
,
2115 "Set whether to confirm potentially dangerous operations.",
2119 add_prefix_cmd ("info", class_info
, info_command
,
2120 "Generic command for printing status.",
2121 &infolist
, "info ", 0, &cmdlist
);
2122 add_com_alias ("i", "info", class_info
, 1);
2124 add_prefix_cmd ("show", class_info
, show_command
,
2125 "Generic command for showing things set with \"set\".",
2126 &showlist
, "show ", 0, &cmdlist
);
2127 /* Another way to get at the same thing. */
2128 add_info ("set", show_command
, "Show all GDB settings.");
2130 add_cmd ("commands", no_class
, show_commands
, "Status of command editor.",
2133 add_cmd ("version", no_class
, show_version
,
2134 "Report what version of GDB this is.", &showlist
);