]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/cli/cli-cmds.c
* completer.c (command_completer): New function.
[thirdparty/binutils-gdb.git] / gdb / cli / cli-cmds.c
CommitLineData
d318976c 1/* GDB CLI commands.
2b5436af 2 Copyright 2000, 2001 Free Software Foundation, Inc.
d318976c
FN
3
4 This file is part of GDB.
5
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.
10
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.
15
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., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21#include "defs.h"
22#include "completer.h"
23#include "target.h" /* For baud_rate, remote_debug and remote_timeout */
24#include "gdb_wait.h" /* For shell escape implementation */
f77b92bf 25#include "gdb_regex.h" /* Used by apropos_command */
fe4e3eb8 26#include "filenames.h" /* for DOSish file names */
d318976c
FN
27
28#ifdef UI_OUT
29#include "ui-out.h"
30#endif
31
32#include "top.h"
33#include "cli/cli-decode.h"
34#include "cli/cli-script.h"
35#include "cli/cli-setshow.h"
36#include "cli/cli-cmds.h"
37
38#ifndef GDBINIT_FILENAME
39#define GDBINIT_FILENAME ".gdbinit"
40#endif
41
d318976c
FN
42/* From gdb/top.c */
43
44extern void dont_repeat (void);
45
46extern void set_verbose (char *, int, struct cmd_list_element *);
47
48extern void show_history (char *, int);
49
50extern void set_history (char *, int);
51
52extern void show_commands (char *, int);
53
54/* Prototypes for local functions */
55
56static void complete_command (char *, int);
57
58static void echo_command (char *, int);
59
60static void pwd_command (char *, int);
61
62static void show_version (char *, int);
63
64static void validate_comname (char *);
65
66static void help_command (char *, int);
67
68static void show_command (char *, int);
69
70static void info_command (char *, int);
71
72static void show_debug (char *, int);
73
74static void set_debug (char *, int);
75
76static void show_user (char *, int);
77
78static void make_command (char *, int);
79
80static void shell_escape (char *, int);
81
82void apropos_command (char *, int);
83\f
84/* Define all cmd_list_elements. */
85
86/* Chain containing all defined commands. */
87
88struct cmd_list_element *cmdlist;
89
90/* Chain containing all defined info subcommands. */
91
92struct cmd_list_element *infolist;
93
94/* Chain containing all defined enable subcommands. */
95
96struct cmd_list_element *enablelist;
97
98/* Chain containing all defined disable subcommands. */
99
100struct cmd_list_element *disablelist;
101
102/* Chain containing all defined toggle subcommands. */
103
104struct cmd_list_element *togglelist;
105
106/* Chain containing all defined stop subcommands. */
107
108struct cmd_list_element *stoplist;
109
110/* Chain containing all defined delete subcommands. */
111
112struct cmd_list_element *deletelist;
113
114/* Chain containing all defined "enable breakpoint" subcommands. */
115
116struct cmd_list_element *enablebreaklist;
117
118/* Chain containing all defined set subcommands */
119
120struct cmd_list_element *setlist;
121
122/* Chain containing all defined unset subcommands */
123
124struct cmd_list_element *unsetlist;
125
126/* Chain containing all defined show subcommands. */
127
128struct cmd_list_element *showlist;
129
130/* Chain containing all defined \"set history\". */
131
132struct cmd_list_element *sethistlist;
133
134/* Chain containing all defined \"show history\". */
135
136struct cmd_list_element *showhistlist;
137
138/* Chain containing all defined \"unset history\". */
139
140struct cmd_list_element *unsethistlist;
141
142/* Chain containing all defined maintenance subcommands. */
143
144struct cmd_list_element *maintenancelist;
145
146/* Chain containing all defined "maintenance info" subcommands. */
147
148struct cmd_list_element *maintenanceinfolist;
149
150/* Chain containing all defined "maintenance print" subcommands. */
151
152struct cmd_list_element *maintenanceprintlist;
153
154struct cmd_list_element *setprintlist;
155
156struct cmd_list_element *showprintlist;
157
158struct cmd_list_element *setdebuglist;
159
160struct cmd_list_element *showdebuglist;
161
162struct cmd_list_element *setchecklist;
163
164struct cmd_list_element *showchecklist;
165\f
166/* Utility used everywhere when at least one argument is needed and
167 none is supplied. */
168
169void
170error_no_arg (char *why)
171{
172 error ("Argument required (%s).", why);
173}
174
175/* The "info" command is defined as a prefix, with allow_unknown = 0.
176 Therefore, its own definition is called only for "info" with no args. */
177
178/* ARGSUSED */
179static void
180info_command (char *arg, int from_tty)
181{
182 printf_unfiltered ("\"info\" must be followed by the name of an info command.\n");
183 help_list (infolist, "info ", -1, gdb_stdout);
184}
185
186/* The "show" command with no arguments shows all the settings. */
187
188/* ARGSUSED */
189static void
190show_command (char *arg, int from_tty)
191{
192 cmd_show_list (showlist, from_tty, "");
193}
194\f
195/* Provide documentation on command or list given by COMMAND. FROM_TTY
196 is ignored. */
197
198/* ARGSUSED */
199static void
200help_command (char *command, int from_tty)
201{
202 help_cmd (command, gdb_stdout);
203}
204\f
205/* The "complete" command is used by Emacs to implement completion. */
206
207/* ARGSUSED */
208static void
209complete_command (char *arg, int from_tty)
210{
211 int i;
212 int argpoint;
213 char *completion;
214
215 dont_repeat ();
216
217 if (arg == NULL)
218 arg = "";
219 argpoint = strlen (arg);
220
221 for (completion = line_completion_function (arg, i = 0, arg, argpoint);
222 completion;
223 completion = line_completion_function (arg, ++i, arg, argpoint))
224 {
225 printf_unfiltered ("%s\n", completion);
b8c9b27d 226 xfree (completion);
d318976c
FN
227 }
228}
229
230int is_complete_command (void (*func) (char *args, int from_tty))
231{
232 return func == complete_command;
233}
234
235/* ARGSUSED */
236static void
237show_version (char *args, int from_tty)
238{
239 immediate_quit++;
240 print_gdb_version (gdb_stdout);
241 printf_filtered ("\n");
242 immediate_quit--;
243}
244
245/* Handle the quit command. */
246
247void
248quit_command (char *args, int from_tty)
249{
250 if (!quit_confirm ())
251 error ("Not confirmed.");
252 quit_force (args, from_tty);
253}
254
255/* ARGSUSED */
256static void
257pwd_command (char *args, int from_tty)
258{
259 if (args)
260 error ("The \"pwd\" command does not take an argument: %s", args);
261 getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
262
263 if (!STREQ (gdb_dirbuf, current_directory))
264 printf_unfiltered ("Working directory %s\n (canonically %s).\n",
265 current_directory, gdb_dirbuf);
266 else
267 printf_unfiltered ("Working directory %s.\n", current_directory);
268}
269
270void
271cd_command (char *dir, int from_tty)
272{
273 int len;
274 /* Found something other than leading repetitions of "/..". */
275 int found_real_path;
276 char *p;
277
278 /* If the new directory is absolute, repeat is a no-op; if relative,
279 repeat might be useful but is more likely to be a mistake. */
280 dont_repeat ();
281
282 if (dir == 0)
283 error_no_arg ("new working directory");
284
285 dir = tilde_expand (dir);
b8c9b27d 286 make_cleanup (xfree, dir);
d318976c
FN
287
288 if (chdir (dir) < 0)
289 perror_with_name (dir);
290
c3690141 291#ifdef HAVE_DOS_BASED_FILE_SYSTEM
d318976c
FN
292 /* There's too much mess with DOSish names like "d:", "d:.",
293 "d:./foo" etc. Instead of having lots of special #ifdef'ed code,
294 simply get the canonicalized name of the current directory. */
295 dir = getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
296#endif
297
298 len = strlen (dir);
fe4e3eb8 299 if (IS_DIR_SEPARATOR (dir[len - 1]))
d318976c
FN
300 {
301 /* Remove the trailing slash unless this is a root directory
302 (including a drive letter on non-Unix systems). */
303 if (!(len == 1) /* "/" */
c3690141 304#ifdef HAVE_DOS_BASED_FILE_SYSTEM
fe4e3eb8 305 && !(len == 3 && dir[1] == ':') /* "d:/" */
d318976c
FN
306#endif
307 )
308 len--;
309 }
310
311 dir = savestring (dir, len);
fe4e3eb8 312 if (IS_ABSOLUTE_PATH (dir))
d318976c
FN
313 current_directory = dir;
314 else
315 {
fe4e3eb8 316 if (IS_DIR_SEPARATOR (current_directory[strlen (current_directory) - 1]))
d318976c
FN
317 current_directory = concat (current_directory, dir, NULL);
318 else
319 current_directory = concat (current_directory, SLASH_STRING, dir, NULL);
b8c9b27d 320 xfree (dir);
d318976c
FN
321 }
322
323 /* Now simplify any occurrences of `.' and `..' in the pathname. */
324
325 found_real_path = 0;
326 for (p = current_directory; *p;)
327 {
fe4e3eb8
EZ
328 if (IS_DIR_SEPARATOR (p[0]) && p[1] == '.'
329 && (p[2] == 0 || IS_DIR_SEPARATOR (p[2])))
d318976c 330 strcpy (p, p + 2);
fe4e3eb8
EZ
331 else if (IS_DIR_SEPARATOR (p[0]) && p[1] == '.' && p[2] == '.'
332 && (p[3] == 0 || IS_DIR_SEPARATOR (p[3])))
d318976c
FN
333 {
334 if (found_real_path)
335 {
336 /* Search backwards for the directory just before the "/.."
337 and obliterate it and the "/..". */
338 char *q = p;
fe4e3eb8 339 while (q != current_directory && !IS_DIR_SEPARATOR (q[-1]))
d318976c
FN
340 --q;
341
342 if (q == current_directory)
343 /* current_directory is
344 a relative pathname ("can't happen"--leave it alone). */
345 ++p;
346 else
347 {
348 strcpy (q - 1, p + 3);
349 p = q - 1;
350 }
351 }
352 else
353 /* We are dealing with leading repetitions of "/..", for example
354 "/../..", which is the Mach super-root. */
355 p += 3;
356 }
357 else
358 {
359 found_real_path = 1;
360 ++p;
361 }
362 }
363
364 forget_cached_source_info ();
365
366 if (from_tty)
367 pwd_command ((char *) 0, 1);
368}
369\f
370void
371source_command (char *args, int from_tty)
372{
373 FILE *stream;
374 struct cleanup *old_cleanups;
375 char *file = args;
376
377 if (file == NULL)
378 {
379 error ("source command requires pathname of file to source.");
380 }
381
382 file = tilde_expand (file);
b8c9b27d 383 old_cleanups = make_cleanup (xfree, file);
d318976c
FN
384
385 stream = fopen (file, FOPEN_RT);
386 if (!stream)
387 {
388 if (from_tty)
389 perror_with_name (file);
390 else
391 return;
392 }
393
394 script_from_file (stream, file);
395
396 do_cleanups (old_cleanups);
397}
398
399/* ARGSUSED */
400static void
401echo_command (char *text, int from_tty)
402{
403 char *p = text;
404 register int c;
405
406 if (text)
407 while ((c = *p++) != '\0')
408 {
409 if (c == '\\')
410 {
411 /* \ at end of argument is used after spaces
412 so they won't be lost. */
413 if (*p == 0)
414 return;
415
416 c = parse_escape (&p);
417 if (c >= 0)
418 printf_filtered ("%c", c);
419 }
420 else
421 printf_filtered ("%c", c);
422 }
423
424 /* Force this output to appear now. */
425 wrap_here ("");
426 gdb_flush (gdb_stdout);
427}
428
429/* ARGSUSED */
430static void
431shell_escape (char *arg, int from_tty)
432{
433#ifdef CANT_FORK
434 /* If ARG is NULL, they want an inferior shell, but `system' just
435 reports if the shell is available when passed a NULL arg. */
436 int rc = system (arg ? arg : "");
437
438 if (!arg)
439 arg = "inferior shell";
440
441 if (rc == -1)
442 {
443 fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", arg,
444 safe_strerror (errno));
445 gdb_flush (gdb_stderr);
446 }
447 else if (rc)
448 {
449 fprintf_unfiltered (gdb_stderr, "%s exited with status %d\n", arg, rc);
450 gdb_flush (gdb_stderr);
451 }
2584159e 452#ifdef GLOBAL_CURDIR
d318976c
FN
453 /* Make sure to return to the directory GDB thinks it is, in case the
454 shell command we just ran changed it. */
455 chdir (current_directory);
456#endif
457#else /* Can fork. */
458 int rc, status, pid;
459 char *p, *user_shell;
460
461 if ((user_shell = (char *) getenv ("SHELL")) == NULL)
462 user_shell = "/bin/sh";
463
464 /* Get the name of the shell for arg0 */
465 if ((p = strrchr (user_shell, '/')) == NULL)
466 p = user_shell;
467 else
468 p++; /* Get past '/' */
469
470 if ((pid = fork ()) == 0)
471 {
472 if (!arg)
473 execl (user_shell, p, 0);
474 else
475 execl (user_shell, p, "-c", arg, 0);
476
477 fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", user_shell,
478 safe_strerror (errno));
479 gdb_flush (gdb_stderr);
480 _exit (0177);
481 }
482
483 if (pid != -1)
484 while ((rc = wait (&status)) != pid && rc != -1)
485 ;
486 else
487 error ("Fork failed");
488#endif /* Can fork. */
489}
490
491static void
492make_command (char *arg, int from_tty)
493{
494 char *p;
495
496 if (arg == 0)
497 p = "make";
498 else
499 {
500 p = xmalloc (sizeof ("make ") + strlen (arg));
501 strcpy (p, "make ");
502 strcpy (p + sizeof ("make ") - 1, arg);
503 }
504
505 shell_escape (p, from_tty);
506}
507
508/* ARGSUSED */
509static void
510show_user (char *args, int from_tty)
511{
512 struct cmd_list_element *c;
513 extern struct cmd_list_element *cmdlist;
514
515 if (args)
516 {
517 c = lookup_cmd (&args, cmdlist, "", 0, 1);
518 if (c->class != class_user)
519 error ("Not a user command.");
520 show_user_1 (c, gdb_stdout);
521 }
522 else
523 {
524 for (c = cmdlist; c; c = c->next)
525 {
526 if (c->class == class_user)
527 show_user_1 (c, gdb_stdout);
528 }
529 }
530}
531
532/* Search through names of commands and documentations for a certain
533 regular expression.
534*/
535void
536apropos_command (char *searchstr, int from_tty)
537{
538 extern struct cmd_list_element *cmdlist; /*This is the main command list*/
539 regex_t pattern;
540 char *pattern_fastmap;
541 char errorbuffer[512];
2e94c453 542 pattern_fastmap = xcalloc (256, sizeof (char));
d318976c
FN
543 if (searchstr == NULL)
544 error("REGEXP string is empty");
545
546 if (regcomp(&pattern,searchstr,REG_ICASE) == 0)
547 {
548 pattern.fastmap=pattern_fastmap;
549 re_compile_fastmap(&pattern);
550 apropos_cmd (gdb_stdout,cmdlist,&pattern,"");
551 }
552 else
553 {
554 regerror(regcomp(&pattern,searchstr,REG_ICASE),NULL,errorbuffer,512);
555 error("Error in regular expression:%s",errorbuffer);
556 }
2b5436af 557 xfree (pattern_fastmap);
d318976c
FN
558}
559\f
560static void
561set_debug (char *arg, int from_tty)
562{
563 printf_unfiltered ("\"set debug\" must be followed by the name of a print subcommand.\n");
564 help_list (setdebuglist, "set debug ", -1, gdb_stdout);
565}
566
567static void
568show_debug (char *args, int from_tty)
569{
570 cmd_show_list (showdebuglist, from_tty, "");
571}
572
573void
574init_cmd_lists (void)
575{
576 cmdlist = NULL;
577 infolist = NULL;
578 enablelist = NULL;
579 disablelist = NULL;
580 togglelist = NULL;
581 stoplist = NULL;
582 deletelist = NULL;
583 enablebreaklist = NULL;
584 setlist = NULL;
585 unsetlist = NULL;
586 showlist = NULL;
587 sethistlist = NULL;
588 showhistlist = NULL;
589 unsethistlist = NULL;
590 maintenancelist = NULL;
591 maintenanceinfolist = NULL;
592 maintenanceprintlist = NULL;
593 setprintlist = NULL;
594 showprintlist = NULL;
595 setchecklist = NULL;
596 showchecklist = NULL;
597}
598
599\f
600void
601init_cli_cmds (void)
602{
603 struct cmd_list_element *c;
604
605 /* Define the classes of commands.
606 They will appear in the help list in the reverse of this order. */
607
608 add_cmd ("internals", class_maintenance, NO_FUNCTION,
609 "Maintenance commands.\n\
610Some gdb commands are provided just for use by gdb maintainers.\n\
611These commands are subject to frequent change, and may not be as\n\
612well documented as user commands.",
613 &cmdlist);
614 add_cmd ("obscure", class_obscure, NO_FUNCTION, "Obscure features.", &cmdlist);
615 add_cmd ("aliases", class_alias, NO_FUNCTION, "Aliases of other commands.", &cmdlist);
616 add_cmd ("user-defined", class_user, NO_FUNCTION, "User-defined commands.\n\
617The commands in this class are those defined by the user.\n\
618Use the \"define\" command to define a command.", &cmdlist);
619 add_cmd ("support", class_support, NO_FUNCTION, "Support facilities.", &cmdlist);
620 if (!dbx_commands)
621 add_cmd ("status", class_info, NO_FUNCTION, "Status inquiries.", &cmdlist);
622 add_cmd ("files", class_files, NO_FUNCTION, "Specifying and examining files.", &cmdlist);
623 add_cmd ("breakpoints", class_breakpoint, NO_FUNCTION, "Making program stop at certain points.", &cmdlist);
624 add_cmd ("data", class_vars, NO_FUNCTION, "Examining data.", &cmdlist);
625 add_cmd ("stack", class_stack, NO_FUNCTION, "Examining the stack.\n\
626The stack is made up of stack frames. Gdb assigns numbers to stack frames\n\
627counting from zero for the innermost (currently executing) frame.\n\n\
628At any time gdb identifies one frame as the \"selected\" frame.\n\
629Variable lookups are done with respect to the selected frame.\n\
630When the program being debugged stops, gdb selects the innermost frame.\n\
631The commands below can be used to select other frames by number or address.",
632 &cmdlist);
633 add_cmd ("running", class_run, NO_FUNCTION, "Running the program.", &cmdlist);
634
635 /* Define general commands. */
636
637 add_com ("pwd", class_files, pwd_command,
638 "Print working directory. This is used for your program as well.");
639 c = add_cmd ("cd", class_files, cd_command,
640 "Set working directory to DIR for debugger and program being debugged.\n\
641The change does not take effect for the program being debugged\n\
642until the next time it is started.", &cmdlist);
643 c->completer = filename_completer;
644
645 add_com ("echo", class_support, echo_command,
646 "Print a constant string. Give string as argument.\n\
647C escape sequences may be used in the argument.\n\
648No newline is added at the end of the argument;\n\
649use \"\\n\" if you want a newline to be printed.\n\
650Since leading and trailing whitespace are ignored in command arguments,\n\
651if you want to print some you must use \"\\\" before leading whitespace\n\
652to be printed or after trailing whitespace.");
653 add_com ("document", class_support, document_command,
654 "Document a user-defined command.\n\
655Give command name as argument. Give documentation on following lines.\n\
656End with a line of just \"end\".");
657 add_com ("define", class_support, define_command,
658 "Define a new command name. Command name is argument.\n\
659Definition appears on following lines, one command per line.\n\
660End with a line of just \"end\".\n\
661Use the \"document\" command to give documentation for the new command.\n\
662Commands defined in this way may have up to ten arguments.");
663
d318976c
FN
664 c = add_cmd ("source", class_support, source_command,
665 "Read commands from a file named FILE.\n\
666Note that the file \"" GDBINIT_FILENAME "\" is read automatically in this way\n\
667when gdb is started.", &cmdlist);
d318976c
FN
668 c->completer = filename_completer;
669
670 add_com ("quit", class_support, quit_command, "Exit gdb.");
db60ec62
EZ
671 c = add_com ("help", class_support, help_command, "Print list of commands.");
672 c->completer = command_completer;
d318976c
FN
673 add_com_alias ("q", "quit", class_support, 1);
674 add_com_alias ("h", "help", class_support, 1);
675
676 c = add_set_cmd ("verbose", class_support, var_boolean, (char *) &info_verbose,
677 "Set ",
678 &setlist),
679 add_show_from_set (c, &showlist);
680 c->function.sfunc = set_verbose;
681 set_verbose (NULL, 0, c);
682
683 add_prefix_cmd ("history", class_support, set_history,
684 "Generic command for setting command history parameters.",
685 &sethistlist, "set history ", 0, &setlist);
686 add_prefix_cmd ("history", class_support, show_history,
687 "Generic command for showing command history parameters.",
688 &showhistlist, "show history ", 0, &showlist);
689
690 add_show_from_set
691 (add_set_cmd ("expansion", no_class, var_boolean, (char *) &history_expansion_p,
692 "Set history expansion on command input.\n\
693Without an argument, history expansion is enabled.", &sethistlist),
694 &showhistlist);
695
696 add_prefix_cmd ("info", class_info, info_command,
697 "Generic command for showing things about the program being debugged.",
698 &infolist, "info ", 0, &cmdlist);
699 add_com_alias ("i", "info", class_info, 1);
700
701 add_com ("complete", class_obscure, complete_command,
702 "List the completions for the rest of the line as a command.");
703
704 add_prefix_cmd ("show", class_info, show_command,
705 "Generic command for showing things about the debugger.",
706 &showlist, "show ", 0, &cmdlist);
707 /* Another way to get at the same thing. */
708 add_info ("set", show_command, "Show all GDB settings.");
709
710 add_cmd ("commands", no_class, show_commands,
711 "Show the history of commands you typed.\n\
712You can supply a command number to start with, or a `+' to start after\n\
713the previous command number shown.",
714 &showlist);
715
716 add_cmd ("version", no_class, show_version,
717 "Show what version of GDB this is.", &showlist);
718
719 add_com ("while", class_support, while_command,
720 "Execute nested commands WHILE the conditional expression is non zero.\n\
721The conditional expression must follow the word `while' and must in turn be\n\
722followed by a new line. The nested commands must be entered one per line,\n\
723and should be terminated by the word `end'.");
724
725 add_com ("if", class_support, if_command,
726 "Execute nested commands once IF the conditional expression is non zero.\n\
727The conditional expression must follow the word `if' and must in turn be\n\
728followed by a new line. The nested commands must be entered one per line,\n\
729and should be terminated by the word 'else' or `end'. If an else clause\n\
730is used, the same rules apply to its nested commands as to the first ones.");
731
732 /* If target is open when baud changes, it doesn't take effect until the
733 next open (I think, not sure). */
734 add_show_from_set (add_set_cmd ("remotebaud", no_class,
735 var_zinteger, (char *) &baud_rate,
736 "Set baud rate for remote serial I/O.\n\
737This value is used to set the speed of the serial port when debugging\n\
738using remote targets.", &setlist),
739 &showlist);
740
741 c = add_set_cmd ("remotedebug", no_class, var_zinteger,
742 (char *) &remote_debug,
743 "Set debugging of remote protocol.\n\
744When enabled, each packet sent or received with the remote target\n\
745is displayed.", &setlist);
746 deprecate_cmd (c, "set debug remote");
747 deprecate_cmd (add_show_from_set (c, &showlist), "show debug remote");
748
749 add_show_from_set (add_set_cmd ("remote", no_class, var_zinteger,
750 (char *) &remote_debug,
751 "Set debugging of remote protocol.\n\
752When enabled, each packet sent or received with the remote target\n\
753is displayed.", &setdebuglist),
754 &showdebuglist);
755
756 add_show_from_set (
757 add_set_cmd ("remotetimeout", no_class, var_integer, (char *) &remote_timeout,
758 "Set timeout limit to wait for target to respond.\n\
759This value is used to set the time limit for gdb to wait for a response\n\
760from the target.", &setlist),
761 &showlist);
762
763 add_prefix_cmd ("debug", no_class, set_debug,
764 "Generic command for setting gdb debugging flags",
765 &setdebuglist, "set debug ", 0, &setlist);
766
767 add_prefix_cmd ("debug", no_class, show_debug,
768 "Generic command for showing gdb debugging flags",
769 &showdebuglist, "show debug ", 0, &showlist);
770
fa58ee11
EZ
771 c = add_com ("shell", class_support, shell_escape,
772 "Execute the rest of the line as a shell command. \n\
d318976c 773With no arguments, run an inferior shell.");
fa58ee11 774 c->completer = filename_completer;
d318976c
FN
775
776 /* NOTE: cagney/2000-03-20: Being able to enter ``(gdb) !ls'' would
777 be a really useful feature. Unfortunately, the below wont do
778 this. Instead it adds support for the form ``(gdb) ! ls''
779 (i.e. the space is required). If the ``!'' command below is
780 added the complains about no ``!'' command would be replaced by
781 complains about how the ``!'' command is broken :-) */
782 if (xdb_commands)
783 add_com_alias ("!", "shell", class_support, 0);
784
fa58ee11
EZ
785 c = add_com ("make", class_support, make_command,
786 "Run the ``make'' program using the rest of the line as arguments.");
787 c->completer = filename_completer;
d318976c
FN
788 add_cmd ("user", no_class, show_user,
789 "Show definitions of user defined commands.\n\
790Argument is the name of the user defined command.\n\
791With no argument, show definitions of all user defined commands.", &showlist);
792 add_com ("apropos", class_support, apropos_command, "Search for commands matching a REGEXP");
793}